Browse Source

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
master
Stefan Bodewig 13 years ago
parent
commit
7a0427656d
2 changed files with 7 additions and 8 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  2. +4
    -5
      src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java

+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -354,9 +354,9 @@ public abstract class DefaultCompilerAdapter
if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3") if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3")
|| t.equals("1.4")) { || t.equals("1.4")) {
String s = t; 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()) setImplicitSourceSwitch((assumeJava15() || assumeJava16())
? "1.5 in JDK 1.5 and 1.6" ? "1.5 in JDK 1.5 and 1.6"


+ 4
- 5
src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java View File

@@ -138,13 +138,12 @@ public class DefaultCompilerAdapterTest extends TestCase {
} }


private void commonSourceDowngrades(String javaVersion) { 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" "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" "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, testSource("1.3", javaVersion,
"If you specify -target 1.3 you now must also specify" "If you specify -target 1.3 you now must also specify"
+ " -source 1.3", "1.3"); + " -source 1.3", "1.3");


Loading…
Cancel
Save