Author: bodewig
Date: Sun Jan 29 19:22:17 2012
New Revision: 1237421

URL: http://svn.apache.org/viewvc?rev=1237421&view=rev
Log:
also set -source implicitly if -target uses 5 rather than 1.5 etc.

Modified:
    
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
    
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java?rev=1237421&r1=1237420&r2=1237421&view=diff
==============================================================================
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
 Sun Jan 29 19:22:17 2012
@@ -364,10 +364,11 @@ public abstract class DefaultCompilerAda
                                            ? "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);
             }
         }

Modified: 
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java?rev=1237421&r1=1237420&r2=1237421&view=diff
==============================================================================
--- 
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
 (original)
+++ 
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
 Sun Jan 29 19:22:17 2012
@@ -99,14 +99,12 @@ public class DefaultCompilerAdapterTest 
         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 
         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 
         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");
     }


Reply via email to