From 7a0427656df231a5c27339e4d1d3d5e49b9b6e04 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sun, 29 Jan 2012 19:17:57 +0000 Subject: [PATCH] either Java 1.5 accepts -source 1.2 or it doesn't, be consistent git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1237420 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/taskdefs/compilers/DefaultCompilerAdapter.java | 6 +++--- .../taskdefs/compilers/DefaultCompilerAdapterTest.java | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) 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");