user496934
user496934

Reputation: 4020

Compiling issue in NetBeans

I have created a project in NetBeans by downloading some third party jars of Bouncy castle, which provides some java cryptography API's. I have also downloaded the souce code and put them under the src folder as per package name. However a few java files which I have in my project are showing in red with errors. here is one such as --

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 , compilation is successful and the final jar file got 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 is the compilation going through even though some files seem to have errors? Can I ignore these as benign?

How to compile with -Xlint in NetBeans because I am compiling by clicking in the project and Clean and Build option.

Upvotes: 3

Views: 16367

Answers (2)

martinusadyh
martinusadyh

Reputation: 1120

agree with @Harry Joy, deprecation is not an error. If you can, you must avoid using deprecated method or API. Because we don't know when Oracle will remove this deprecated method in next release of JDK.

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

In Properties window, choose Build > Compiling. Please search field "Additional Compiler Options" then put Xlint:deprecation in this field. After doing that, you can press OK button.

Btw you can pass any other options in that field like "Xlint:unchecked" :)

Upvotes: 2

toto2
toto2

Reputation: 5326

It looks like you have a naming conflict. You probably have

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

but both packages define ECParameterSpec. If that is your problem, you can either define your variable type explicitly with rg.bountycaslte.jce.ECParameterSpec myvar = ... or you can add an import statement import rg.bouncycastle.jce.ECParameterSpec; to specify which one you really want.

Upvotes: 1

Related Questions