diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 320426285..cfabdeba8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -354,9 +354,9 @@ public abstract class DefaultCompilerAdapter if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3") || t.equals("1.4")) { String s = t; - if (t.equals("1.1")) { - // 1.5.0 doesn't support -source 1.1 - s = "1.2"; + if (t.equals("1.1") || t.equals("1.2")) { + // 1.5.0 doesn't support -source 1.1 or 1.2 + s = "1.3"; } setImplicitSourceSwitch((assumeJava15() || assumeJava16()) ? "1.5 in JDK 1.5 and 1.6" diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java index 946346ecf..48075df45 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java @@ -138,13 +138,12 @@ public class DefaultCompilerAdapterTest extends TestCase { } private void commonSourceDowngrades(String javaVersion) { - // FIXME, should be minimum 1.3 as -source - testSource("1.2", javaVersion, + testSource("1.3", javaVersion, "If you specify -target 1.1 you now must also specify" - + " -source 1.2", "1.1"); - testSource("1.2", javaVersion, + + " -source 1.3", "1.1"); + testSource("1.3", javaVersion, "If you specify -target 1.2 you now must also specify" - + " -source 1.2", "1.2"); + + " -source 1.3", "1.2"); testSource("1.3", javaVersion, "If you specify -target 1.3 you now must also specify" + " -source 1.3", "1.3");