Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot stop ant from generating compiler Sun proprietary API warnings

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?

like image 859
Daniel Avatar asked Mar 08 '12 06:03

Daniel


1 Answers

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

like image 95
Alun Avatar answered Sep 29 '22 18:09

Alun