Compilation of a problem in NetBeans

I created a project in NetBeans by downloading some third-party banks of Bouncy Castle, which provides some Java cryptography APIs. I also downloaded souce code and placed them under the src folder according to the package name. However, several java files that I have in my project are displayed in red with errors. here is one of them -

getparams() in org.bouncycastle.jce.provider.JCEECPrivateKey cannot implement getParams() in rg.bouncycastle.jce.interfaces.ECKey found : java.security.spec.ECParameterSpec required: rg.bouncycastle.jce.ECParameterSpec 

But the strange part is that when I actually compile the code from NetBeans, the compilation is successful and the last jar file is created. However, the compilation says the following:

 Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 

My questions are: why does compilation happen, although some files have errors? Can I ignore them as benign?

How to compile with -Xlint in NetBeans because I compile by clicking in the project and selecting "Clean and Build".

+2
java compiler-construction netbeans
source share
2 answers

It looks like you have a name conflict. You probably

 import java.security.spec.*; import rg.bouncycastle.jce.*; 

but both packages define ECParameterSpec . If this is your problem, you can explicitly determine your variable type using rg.bountycaslte.jce.ECParameterSpec myvar = ... or you can add the import statement import rg.bouncycastle.jce.ECParameterSpec; to indicate which one you really need.

+1
source share

agree with @Harry Joy, obsolescence is not a mistake. If you can, you should avoid using an obsolete method or API. Since we do not know when Oracle will remove this deprecated method in the next version of the JDK.

If you want to compile with -Xlint: debrecation in NetBeans, you can right-click your node project (in the inspector window), then select Properties.

In the Properties window, choose Build> Compile. Please find the "Advanced Compiler Options" field and then enter Xlint: debrecation in this field. After that you can click OK.

Btw you can pass any other parameters in this field, for example "Xlint: unchecked" :)

0
source share

All Articles