Community
Participate
Working Groups
Usign such build script: <?xml version="1.0" encoding="UTF-8"?> <project name="compile" default="main" basedir="../."> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> <property name="src" value="${basedir}/src"/> <property name="out" value="${basedir}/out" /> <target name="main"> <delete dir="${out}"/> <mkdir dir="${out}"/> <javac srcdir="${src}" destdir="${out}" source="1.4" target="1.4" debug="on" nowarn="true"> <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-1.4"/> </javac> </target> </project> The ant adapter is compiling in source 1.3 and target 1.2 mode. Assert statements are reported as errors. The problem comes from the fact that source="1.4" and target="1.4" sets the value in the custom options. But -1.4 overrides the source and target settings because it believes that no source and target have been specified.
Created attachment 25064 [details] Proposed fix With this fix it works fine. I didn't use the same mecanism for didSpecifyCompliance because the user might want to override the inferred compliance in a compilerarg argument.
Will it allow me to do: -1.5 -source 1.3 -target 1.4 ?
No. This is not intended. It would still be rejected.
Target level cannot be higher than the source level.
I don't know if we should allow source and target values to be specified through the compiler arg since the javac task has some predefined attributes for source and target.
Fixed and released in HEAD. There is no regression test for the ant adapter.
Verified for 3.2 M6 using build I20060328-0010