I call javac from my ant script like this:
<javac srcdir="src"
destdir="build/classes" source="1.6"
target="1.6" debug="true" encoding="Cp1252"
nowarn="true">
But it still throws compiler warnings in the output:
[javac] Compiling 73 source files to C:\IKOfficeRoot\Java\ERP\Framework\build\classes
[javac] C:\IKOfficeRoot\Java\ERP\Framework\src\de\ikoffice\util\LoggerFactory.java:49: warning: sun.reflect.Reflection is Sun proprietary API and may be removed in a future release
[javac] return Logger.getLogger(Reflection.getCallerClass(2));
[javac] ^
[javac] Note: C:\IKOfficeRoot\Java\ERP\Framework\src\de\ikoffice\db\SingleShotResultSet.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 warning
I also tried
<compilerarg line="-Xlint:-unchecked -Xlint:-deprecation"/>
and
<compilerarg value="-Xlint:none"/>
but this has no effect either. How to I remove the warnings?
The best way to do this is to use the sunapi
suppression, i.e. either -Xlint:-sunapi
for the entire compile, or @SuppressWarnings("sunapi")
at your required scope.
Note, the only way to use this suppression though, is to first enable it with the compiler option -XDenableSunApiLintControl
enableSunApiLintControl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With