How to recompile with -Xlint:unchecked in Ant build task?

两盒软妹~` 提交于 2019-12-21 03:22:11

问题


When I run the "compile" target of my Ant "build.xml" file, then I get the following message:

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

My compile target is the following:

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

What do I have to change in my build.xml file so that -Xlint:unchecked is done there?


回答1:


Add the following element in <javac></javac> section:

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



回答2:


In AndroidStudio, do this:

allprojects {
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:deprecation"
    }
}


来源:https://stackoverflow.com/questions/4597968/how-to-recompile-with-xlintunchecked-in-ant-build-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!