javanetbeans

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.


Solution

  • 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.