Browse Source

also set -source implicitly if -target uses 5 rather than 1.5 etc.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1237421 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 13 years ago
parent
commit
ec4f345742
2 changed files with 3 additions and 6 deletions
  1. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  2. +0
    -4
      src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java

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

@@ -364,10 +364,11 @@ public abstract class DefaultCompilerAdapter
? "1.7 in JDK 1.7"
: "1.8 in JDK 1.8"),
cmd, t, s);
} else if (assumeJava17() && (t.equals("1.5") || t.equals("1.6"))) {
} else if (assumeJava17() && (t.equals("1.5") || t.equals("1.6") || t.equals("5") || t.equals("6"))) {
setImplicitSourceSwitch("1.7 in JDK 1.7", cmd, t, t);
} else if (assumeJava18() &&
(t.equals("1.5") || t.equals("1.6") || t.equals("1.7"))) {
(t.equals("1.5") || t.equals("1.6") || t.equals("1.7")
|| t.equals("5") || t.equals("6") || t.equals("7"))) {
setImplicitSourceSwitch("1.8 in JDK 1.8", cmd, t, t);
}
}


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

@@ -99,14 +99,12 @@ public class DefaultCompilerAdapterTest extends TestCase {
testSource("1.6", "javac1.7",
"If you specify -target 1.6 you now must also specify"
+ " -source 1.6", "1.6");
/* FIXME - should be adapted as well
testSource("5", "javac1.7",
"If you specify -target 5 you now must also specify"
+ " -source 5", "5");
testSource("6", "javac1.7",
"If you specify -target 6 you now must also specify"
+ " -source 6", "6");
*/
testSource(null, "javac1.7", "", "1.7");
testSource(null, "javac1.7", "", "7");
}
@@ -122,7 +120,6 @@ public class DefaultCompilerAdapterTest extends TestCase {
testSource("1.7", "javac1.8",
"If you specify -target 1.7 you now must also specify"
+ " -source 1.7", "1.7");
/* FIXME - should be adapted as well
testSource("5", "javac1.8",
"If you specify -target 5 you now must also specify"
+ " -source 5", "5");
@@ -132,7 +129,6 @@ public class DefaultCompilerAdapterTest extends TestCase {
testSource("7", "javac1.8",
"If you specify -target 7 you now must also specify"
+ " -source 7", "7");
*/
testSource(null, "javac1.8", "", "1.8");
testSource(null, "javac1.8", "", "8");
}


Loading…
Cancel
Save