groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: support detecting JDK9+ in vmplugin
Date Wed, 08 Aug 2018 05:06:22 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 3d3df8daf -> 6cabae08f


support detecting JDK9+ in vmplugin


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6cabae08
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6cabae08
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6cabae08

Branch: refs/heads/GROOVY_2_5_X
Commit: 6cabae08f1a4652fef5b198b633a8fb1daff368e
Parents: 3d3df8d
Author: Paul King <paulk@asert.com.au>
Authored: Wed Aug 8 09:37:48 2018 +1000
Committer: Paul King <paulk@asert.com.au>
Committed: Wed Aug 8 15:06:07 2018 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/vmplugin/VMPlugin.java  |  4 +--
 .../groovy/vmplugin/VMPluginFactory.java        | 11 +++++--
 .../org/codehaus/groovy/vmplugin/v9/Java9.java  | 31 ++++++++++++++++++++
 3 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6cabae08/src/main/java/org/codehaus/groovy/vmplugin/VMPlugin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/VMPlugin.java b/src/main/java/org/codehaus/groovy/vmplugin/VMPlugin.java
index 449398a..88b2076 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/VMPlugin.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/VMPlugin.java
@@ -27,8 +27,6 @@ import java.lang.reflect.Method;
 /**
  * Interface to access VM version based actions.
  * This interface is for internal use only!
- * 
- * @author Jochen Theodorou
  */
 public interface VMPlugin {
     void setAdditionalClassInformation(ClassNode c);
@@ -58,7 +56,7 @@ public interface VMPlugin {
 
     /**
      * Gives the version the plugin is made for
-     * @return 5 for jdk5, 6 for jdk6, 7 for jdk7, 8 for jdk8 or higher
+     * @return 7 for jdk7, 8 for jdk8, 9 for jdk9 or higher
      */
     int getVersion();
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/6cabae08/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java b/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
index a456e5a..25a1269 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
@@ -24,19 +24,24 @@ import org.codehaus.groovy.vmplugin.v7.Java7;
  * Factory class to get functionality based on the VM version.
  * The usage of this class is not for public use, only for the
  * runtime.
- * @author Jochen Theodorou
  */
 public class VMPluginFactory {
 
     private static final String JDK8_CLASSNAME_CHECK = "java.util.Optional";
+    private static final String JDK9_CLASSNAME_CHECK = "java.lang.Module";
+
     private static final String JDK8_PLUGIN_NAME = "org.codehaus.groovy.vmplugin.v8.Java8";
+    private static final String JDK9_PLUGIN_NAME = "org.codehaus.groovy.vmplugin.v9.Java9";
 
     private static final VMPlugin plugin;
 
     static {
-        VMPlugin target = createPlugin(JDK8_CLASSNAME_CHECK, JDK8_PLUGIN_NAME);
+        VMPlugin target = createPlugin(JDK9_CLASSNAME_CHECK, JDK9_PLUGIN_NAME);
         if (target == null) {
-            target = new Java7();
+            target = createPlugin(JDK8_CLASSNAME_CHECK, JDK8_PLUGIN_NAME);
+            if (target == null) {
+                target = new Java7();
+            }
         }
         plugin = target;
     }

http://git-wip-us.apache.org/repos/asf/groovy/blob/6cabae08/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
new file mode 100644
index 0000000..7468581
--- /dev/null
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.vmplugin.v9;
+
+import org.codehaus.groovy.vmplugin.v8.Java8;
+
+/**
+ * Java 9 based functions will be added here if needed.
+ */
+public class Java9 extends Java8 {
+    @Override
+    public int getVersion() {
+        return 9;
+    }
+}


Mime
View raw message