java – 无法阻止ant生成编译器Sun专有API警告

前端之家收集整理的这篇文章主要介绍了java – 无法阻止ant生成编译器Sun专有API警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我从这个ant脚本调用 javac:
<javac srcdir="src" 
   destdir="build/classes" source="1.6" 
   target="1.6" debug="true" encoding="Cp1252"
   nowarn="true">

但它仍然在输出中引发编译器警告:

[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

我也试过

<compilerarg line="-Xlint:-unchecked -Xlint:-deprecation"/>

<compilerarg value="-Xlint:none"/>

但这也没有效果.如何清除警告?

解决方法

将-XDignore.symbol.file选项添加到为我工作的javac命令行.

猜你在找的Java相关文章