如何使用-Xlint重新编译:在Ant构建任务中未选中?

问题描述 投票:36回答:2

当我运行Ant“ build.xml”文件的“ compile”目标时,我得到以下消息:

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

我的编译目标如下:

  <target name="compile">
    <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" debuglevel="lines,source" includeantruntime="false">
      <classpath refid="class.path" />
    </javac>
    <javac srcdir="${test.dir}" destdir="${classes.dir}" debug="true" debuglevel="lines,source" includeantruntime="false">
      <classpath refid="class.path" />
    </javac>
  </target>

我必须在build.xml文件中进行什么更改,以便在那里完成[[-Xlint:unchecked?

ant compilation target build.xml
2个回答
62
投票
<javac></javac>部分中添加以下元素:

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


2
投票

AndroidStudio中,执行此操作:

allprojects { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" } }
© www.soinside.com 2019 - 2024. All rights reserved.