ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1236803 - in /ant/core/trunk: ./ manual/Tasks/ src/main/org/apache/tools/ant/taskdefs/ src/main/org/apache/tools/ant/taskdefs/compilers/ src/main/org/apache/tools/ant/util/ src/tests/antunit/
Date Fri, 27 Jan 2012 18:23:57 GMT
Author: bodewig
Date: Fri Jan 27 18:23:56 2012
New Revision: 1236803

URL: http://svn.apache.org/viewvc?rev=1236803&view=rev
Log:
OpenJDK8 snaphot works, I have found a new class in java.lang.reflect and OpenJDK's javac
defaults to -source 8.  No, I don't like the code in DefaultCompilerAdapter either.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/build.xml
    ant/core/trunk/manual/Tasks/javac.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
    ant/core/trunk/src/tests/antunit/antunit-base.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1236803&r1=1236802&r2=1236803&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Jan 27 18:23:56 2012
@@ -178,6 +178,8 @@ Other changes:
    algorithms.
    Bugzilla Report 52344.
 
+ * Initial support for Java 8.
+
 Changes from Ant 1.8.1 TO Ant 1.8.2
 ===================================
 

Modified: ant/core/trunk/build.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/build.xml?rev=1236803&r1=1236802&r2=1236803&view=diff
==============================================================================
--- ant/core/trunk/build.xml (original)
+++ ant/core/trunk/build.xml Fri Jan 27 18:23:56 2012
@@ -369,6 +369,7 @@
     <available property="jdk1.5+" classname="java.net.Proxy"/>
     <available property="jdk1.6+" classname="java.net.CookieStore"/>
     <available property="jdk1.7+" classname="java.nio.file.FileSystem"/>
+    <available property="jdk1.8+" classname="java.lang.reflect.Executable"/>
     <available property="kaffe" classname="kaffe.util.NotImplemented"/>
     <available property="harmony"
                classname="org.apache.harmony.luni.util.Base64"/>

Modified: ant/core/trunk/manual/Tasks/javac.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/manual/Tasks/javac.html?rev=1236803&r1=1236802&r2=1236803&view=diff
==============================================================================
--- ant/core/trunk/manual/Tasks/javac.html (original)
+++ ant/core/trunk/manual/Tasks/javac.html Fri Jan 27 18:23:56 2012
@@ -72,12 +72,13 @@ attribute are:</a></p>
   <li><code>classic</code> (the standard compiler of JDK 1.1/1.2) &ndash;
       <code>javac1.1</code> and
       <code>javac1.2</code> can be used as aliases.</li>
-  <li><code>modern</code> (the standard compiler of JDK 1.3/1.4/1.5/1.6/1.7)
&ndash;
+  <li><code>modern</code> (the standard compiler of JDK 1.3/1.4/1.5/1.6/1.7/1.8)
&ndash;
       <code>javac1.3</code> and
       <code>javac1.4</code> and
       <code>javac1.5</code> and
       <code>javac1.6</code> and
-      <code>javac1.7</code> (<em>since Ant 1.8.2</em>) can be used
as aliases.</li>
+      <code>javac1.7</code> (<em>since Ant 1.8.2</em>) and
+      <code>javac1.8</code> (<em>since Ant 1.8.3</em>) can be used
as aliases.</li>
   <li><code>jikes</code> (the <a
     href="http://jikes.sourceforge.net/" target="_top">Jikes</a>
     compiler).</li>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java?rev=1236803&r1=1236802&r2=1236803&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java Fri Jan 27 18:23:56 2012
@@ -80,6 +80,7 @@ public class Javac extends MatchingTask 
     private static final String FAIL_MSG
         = "Compile failed; see the compiler error output for details.";
 
+    private static final String JAVAC18 = "javac1.8";
     private static final String JAVAC17 = "javac1.7";
     private static final String JAVAC16 = "javac1.6";
     private static final String JAVAC15 = "javac1.5";
@@ -149,6 +150,8 @@ public class Javac extends MatchingTask 
             return JAVAC16;
         } else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_7)) {
             return JAVAC17;
+        } else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_8)) {
+            return JAVAC18;
         } else {
             return CLASSIC;
         }
@@ -600,7 +603,7 @@ public class Javac extends MatchingTask 
     /**
      * Sets the target VM that the classes will be compiled for. Valid
      * values depend on the compiler, for jdk 1.4 the valid values are
-     * "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "5", "6" and "7".
+     * "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "5", "6", "7" and "8".
      * @param target the target VM
      */
     public void setTarget(String target) {
@@ -765,6 +768,7 @@ public class Javac extends MatchingTask 
 
     private String getAltCompilerName(String anImplementation) {
         if (JAVAC17.equalsIgnoreCase(anImplementation)
+                || JAVAC18.equalsIgnoreCase(anImplementation)
                 || JAVAC16.equalsIgnoreCase(anImplementation)
                 || JAVAC15.equalsIgnoreCase(anImplementation)
                 || JAVAC14.equalsIgnoreCase(anImplementation)
@@ -778,6 +782,7 @@ public class Javac extends MatchingTask 
         if (MODERN.equalsIgnoreCase(anImplementation)) {
             String nextSelected = assumedJavaVersion();
             if (JAVAC17.equalsIgnoreCase(nextSelected)
+                    || JAVAC18.equalsIgnoreCase(nextSelected)
                     || JAVAC16.equalsIgnoreCase(nextSelected)
                     || JAVAC15.equalsIgnoreCase(nextSelected)
                     || JAVAC14.equalsIgnoreCase(nextSelected)
@@ -1014,6 +1019,7 @@ public class Javac extends MatchingTask 
     protected boolean isJdkCompiler(String compilerImpl) {
         return MODERN.equals(compilerImpl)
             || CLASSIC.equals(compilerImpl)
+            || JAVAC18.equals(compilerImpl)
             || JAVAC17.equals(compilerImpl)
             || JAVAC16.equals(compilerImpl)
             || JAVAC15.equals(compilerImpl)

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=1236803&r1=1236802&r2=1236803&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
Fri Jan 27 18:23:56 2012
@@ -348,7 +348,7 @@ public abstract class DefaultCompilerAda
             } else {
                 cmd.createArgument().setValue(source);
             }
-        } else if ((assumeJava15() || assumeJava16() || assumeJava17())
+        } else if ((assumeJava15() || assumeJava16() || assumeJava17() || assumeJava18())
                    && attributes.getTarget() != null) {
             String t = attributes.getTarget();
             if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3")
@@ -360,10 +360,15 @@ public abstract class DefaultCompilerAda
                 }
                 setImplicitSourceSwitch((assumeJava15() || assumeJava16())
                                         ? "1.5 in JDK 1.5 and 1.6"
-                                        : "1.7 in JDK 1.7",
+                                        : (assumeJava17()
+                                           ? "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"))) {
                 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"))) {
+                setImplicitSourceSwitch("1.8 in JDK 1.8", cmd, t, t);
             }
         }
         return cmd;
@@ -638,6 +643,21 @@ public abstract class DefaultCompilerAda
     }
 
     /**
+     * Shall we assume JDK 1.8 command line switches?
+     * @return true if JDK 1.8
+     * @since Ant 1.8.3
+     */
+    protected boolean assumeJava18() {
+        return "javac1.8".equals(attributes.getCompilerVersion())
+            || ("classic".equals(attributes.getCompilerVersion())
+                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_8))
+            || ("modern".equals(attributes.getCompilerVersion())
+                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_8))
+            || ("extJavac".equals(attributes.getCompilerVersion())
+                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_8));
+    }
+
+    /**
      * Combines a user specified bootclasspath with the system
      * bootclasspath taking build.sysclasspath into account.
      *

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java?rev=1236803&r1=1236802&r2=1236803&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java Fri Jan 27 18:23:56
2012
@@ -94,6 +94,11 @@ public final class JavaEnvUtils {
     /** Number Version constant for Java 1.7 */
     public static final int VERSION_1_7 = 17;
 
+    /** Version constant for Java 1.8 */
+    public static final String JAVA_1_8 = "1.8";
+    /** Number Version constant for Java 1.8 */
+    public static final int VERSION_1_8 = 18;
+
     /** Whether this is the Kaffe VM */
     private static boolean kaffeDetected;
     /** Whether this is the GNU VM (gcj/gij) */
@@ -140,6 +145,9 @@ public final class JavaEnvUtils {
             Class.forName("java.nio.file.FileSystem");
             javaVersion = JAVA_1_7;
             javaVersionNumber++;
+            Class.forName("java.lang.reflect.Executable");
+            javaVersion = JAVA_1_8;
+            javaVersionNumber++;
         } catch (Throwable t) {
             // swallow as we've hit the max class version that
             // we have
@@ -370,6 +378,7 @@ public final class JavaEnvUtils {
     private static void buildJrePackages() {
         jrePackages = new Vector();
         switch(javaVersionNumber) {
+            case VERSION_1_8:
             case VERSION_1_7:
             case VERSION_1_6:
             case VERSION_1_5:
@@ -421,6 +430,7 @@ public final class JavaEnvUtils {
         Vector tests = new Vector();
         tests.addElement("java.lang.Object");
         switch(javaVersionNumber) {
+            case VERSION_1_8:
             case VERSION_1_7:
             case VERSION_1_6:
             case VERSION_1_5:

Modified: ant/core/trunk/src/tests/antunit/antunit-base.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/antunit-base.xml?rev=1236803&r1=1236802&r2=1236803&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/antunit-base.xml (original)
+++ ant/core/trunk/src/tests/antunit/antunit-base.xml Fri Jan 27 18:23:56 2012
@@ -26,6 +26,7 @@
   <property name="test3.jar" location="${java.io.tmpdir}/test3.jar"/>
   <property name="test4.jar" location="${java.io.tmpdir}/test4.jar"/>
   <property name="test5.jar" location="${java.io.tmpdir}/test5.jar"/>
+  <available property="jdk1.8+" classname="java.lang.reflect.Executable"/>
   <available property="jdk1.7+" classname="java.nio.file.FileSystem"/>
   <available property="jdk1.6+" classname="java.net.CookieStore"/>
   <available property="jdk1.5+" classname="java.net.Proxy"/>



Mime
View raw message