ant javac Xlint:unchecked
You are porting your code to Java 5.0 (aka 1.5); building your project under Xcode gives the following notes from javac:
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
This raises the following question:Q: How do I pass
-Xlint:unchecked
to an ant javac task? A: Edit the relevant target in your
build.xml
file to add an embedded compilerarg
entry, to the javac task: <compilerarg value="-Xlint:unchecked"/>
or
<compilerarg value="-Xlint"/>
so it reads something like this:
<target name="compile" description="Compile code">
<mkdir dir="${bin}"/>
<mkdir dir="${lib}"/>
<javac srcdir="${src}" destdir="${bin}"
includeAntRuntime="no"
classpathref="lib.path"
debug="${compile.debug}">
<compilerarg value="-Xlint"/>
</javac>
</target>
Using "-Xlint"
enables all recommended Xlint options, including :unchecked
. See the Sun javac documentation (scroll down to Xlint) for details of other options, giving finer control if you need it.