You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/05/10 22:26:32 UTC

[04/50] [abbrv] groovy git commit: clean-up now that jdk7 is baseline (closes #526)

clean-up now that jdk7 is baseline (closes #526)


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

Branch: refs/heads/parrot
Commit: 84df2e11fcbdcafe032910b3e1320f6be59377d1
Parents: 8a17a1e
Author: PascalSchumacher <pa...@gmx.net>
Authored: Fri Apr 21 20:27:22 2017 +0200
Committer: paulk <pa...@asert.com.au>
Committed: Thu May 11 08:04:03 2017 +1000

----------------------------------------------------------------------
 .../groovy/control/CompilerConfiguration.java   | 10 +-----
 src/spec/doc/invokedynamic-support.adoc         |  7 ++---
 .../CircularLanguageReferenceTest.groovy        | 33 --------------------
 .../PropertyUsageFromJavaTest.groovy            | 33 --------------------
 .../src/main/java/groovy/json/internal/Sys.java |  8 +----
 5 files changed, 5 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/84df2e11/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
index a3107ac..1ee26d3 100644
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -37,8 +37,6 @@ import java.util.*;
 
 public class CompilerConfiguration {
 
-    private static final String JDK5_CLASSNAME_CHECK = "java.lang.annotation.Annotation";
-
     /** This (<code>"indy"</code>) is the Optimization Option value for enabling <code>invokedynamic</code> complilation. */
     public static final String INVOKEDYNAMIC = "indy";
 
@@ -800,13 +798,7 @@ public class CompilerConfiguration {
     }
     
     private static String getVMVersion() {
-        try {
-            Class.forName(JDK5_CLASSNAME_CHECK);
-            return POST_JDK5;
-        } catch(Exception ex) {
-            // IGNORE
-        }
-        return PRE_JDK5;
+        return POST_JDK5;
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/84df2e11/src/spec/doc/invokedynamic-support.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/invokedynamic-support.adoc b/src/spec/doc/invokedynamic-support.adoc
index 7c3314a..944d938 100644
--- a/src/spec/doc/invokedynamic-support.adoc
+++ b/src/spec/doc/invokedynamic-support.adoc
@@ -28,7 +28,6 @@ Since Groovy 2.0, we added support for the JVM http://docs.oracle.com/javase/7/d
 
 This means that unlike APIs, AST transformations or syntactic sugar, this feature is **not visible** to the developer or the end user. It is a compilation and runtime feature only. This means that given two programs written in Groovy, you have the choice to compile it with or without invokedynamic support. Whatever you choose, it comes with pros and cons:
 
-- classes compiled with invokedynamic can only be used on JDK 1.7+ (without invokedynamic, Groovy classes are still compatible with JDK 1.5+)
 - call site caching, as implemented in "normal" Groovy is replaced with invokedynamic since Groovy 2.1
 - it is possible to mix classes compiled with and without invokedynamic in the same project, as long as you run JDK 1.7+
 - depending on the JVM (even different minor versions of the JVM), you can target close to Java performance for dynamic Groovy with invokedynamic support activated
@@ -39,8 +38,8 @@ This means that unlike APIs, AST transformations or syntactic sugar, this featur
 
 The Groovy distribution comes with **two** jars:
 
-- groovy-x.y.z.jar : compatible with JDK 1.5+, makes use of call site caching
-- groovy-x-y-z-indy.jar : compatible with JDK 1.7+ only, has invokedynamic support bundled, old call site caching still possible
+- groovy-x.y.z.jar : makes use of call site caching
+- groovy-x-y-z-indy.jar : has invokedynamic support bundled, old call site caching still possible
 
 The first jar is Groovy compiled without invokedynamic support, while the second one has invokedynamic support bundled. As Groovy core and the groovy modules are sometimes written in Groovy, we currently have no choice but issuing two distinct versions of Groovy. This means that if you pick the "normal" jar, the groovy classes of groovy itself are compiled with call site caching (1.5+), while if you use the "indy" jar, the groovy classes of groovy itself are compiled using invokedynamic. This means that the invokedynamic version of Groovy doesn't make use of the old call site caching mechanism.
 
@@ -96,4 +95,4 @@ Independently of the jar version that you use (and after having exchanged the ja
 |invokedynamic
 |===
 
-So even if you use the indy jar, if you don't use the invokedynamic flag at compile time, then the compiled classes will use the "old" format, meaning they will use the JDK1.5+ classes without invokedynamic.
\ No newline at end of file
+So even if you use the indy jar, if you don't use the invokedynamic flag at compile time, then the compiled classes will use the "old" format.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/groovy/blob/84df2e11/src/test/org/codehaus/groovy/tools/stubgenerator/CircularLanguageReferenceTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/CircularLanguageReferenceTest.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/CircularLanguageReferenceTest.groovy
index 1035cbd..4450bed 100644
--- a/src/test/org/codehaus/groovy/tools/stubgenerator/CircularLanguageReferenceTest.groovy
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/CircularLanguageReferenceTest.groovy
@@ -18,12 +18,6 @@
  */
 package org.codehaus.groovy.tools.stubgenerator
 
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-
 /**
  * Test circular reference between Java and Groovy, as well as inheritance:
  * a Shape Java interface is implemented by a Rectangle Groovy class,
@@ -33,30 +27,8 @@ import org.junit.runners.JUnit4
  *
  * @author Guillaume Laforge
  */
-import static org.junit.Assume.assumeFalse
-
-@RunWith(JUnit4)
 class CircularLanguageReferenceTest extends StubTestCase {
 
-    @Before
-    void setUp() {
-        assumeNotOnTravisCIAndNotJava6()
-        super.setUp()
-    }
-
-    private assumeNotOnTravisCIAndNotJava6() {
-        boolean travisCI = new File('.').absolutePath =~ /travis/
-        boolean java6 = System.getProperty('java.version').startsWith('1.6')
-
-        assumeFalse('''Test always fails with "java.lang.IllegalArgumentException: URI is not hierarchical"
-            on open jdk used by travis.''', travisCI && java6)
-    }
-
-    @Test
-    void test() {
-        super.testRun()
-    }
-
     void verifyStubs() {
         classes['stubgenerator.circularLanguageReference.Rectangle'].with {
             assert methods['area'     ].signature == "public double area()"
@@ -67,10 +39,5 @@ class CircularLanguageReferenceTest extends StubTestCase {
             assert imports == ['java.lang.*', 'java.io.*', 'java.net.*', 'java.util.*', 'groovy.lang.*', 'groovy.util.*']
         }
     }
-
-    @After
-    void tearDown() {
-        super.tearDown()
-    }
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/84df2e11/src/test/org/codehaus/groovy/tools/stubgenerator/PropertyUsageFromJavaTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/PropertyUsageFromJavaTest.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/PropertyUsageFromJavaTest.groovy
index e199972..eb34176 100644
--- a/src/test/org/codehaus/groovy/tools/stubgenerator/PropertyUsageFromJavaTest.groovy
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/PropertyUsageFromJavaTest.groovy
@@ -18,41 +18,13 @@
  */
 package org.codehaus.groovy.tools.stubgenerator
 
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-
-import static org.junit.Assume.assumeFalse
-
 /**
  * Tests Groovy properties and how they can be used from Java.
  *
  * @author Guillaume Laforge
  */
-@RunWith(JUnit4)
 class PropertyUsageFromJavaTest extends StubTestCase {
 
-    @Before
-    void setUp() {
-        assumeNotOnTravisCIAndNotJava6()
-        super.setUp()
-    }
-
-    private assumeNotOnTravisCIAndNotJava6() {
-        boolean travisCI = new File('.').absolutePath =~ /travis/
-        boolean java6 = System.getProperty('java.version').startsWith('1.6')
-
-        assumeFalse('''Test always fails with "java.lang.IllegalArgumentException: URI is not hierarchical"
-            on open jdk used by travis.''', travisCI && java6)
-    }
-
-    @Test
-    void test() {
-        super.testRun()
-    }
-
     void verifyStubs() {
         classes['stubgenerator.propertyUsageFromJava.somepackage.GroovyPogo'].with {
             assert methods['getAge'].signature == "public int getAge()"
@@ -61,10 +33,5 @@ class PropertyUsageFromJavaTest extends StubTestCase {
             assert methods['setName'].signature == "public void setName(java.lang.String value)"
         }
     }
-
-    @After
-    void tearDown() {
-        super.tearDown()
-    }
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/84df2e11/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
index 8c2953c..4d8c3ed 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
@@ -24,7 +24,6 @@ import java.util.regex.Pattern;
 
 class Sys {
 
-    private static final boolean is1_7OrLater;
     private static final boolean is1_8OrLater;
     private static final boolean is1_7;
     private static final boolean is1_8;
@@ -37,10 +36,6 @@ class Sys {
             try {
                 String ver = split[0];
 
-                if (ver.startsWith("1.6")) {
-                    v = new BigDecimal("1.6");
-                }
-
                 if (ver.startsWith("1.7")) {
                     v = new BigDecimal("1.7");
                 }
@@ -66,14 +61,13 @@ class Sys {
             }
         }
 
-        is1_7OrLater = v.compareTo(new BigDecimal("1.7")) >= 0;
         is1_8OrLater = v.compareTo(new BigDecimal("1.8")) >= 0;
         is1_7 = v.compareTo(new BigDecimal("1.7")) == 0;
         is1_8 = v.compareTo(new BigDecimal("1.8")) == 0;
     }
 
     public static boolean is1_7OrLater() {
-        return is1_7OrLater;
+        return true;
     }
 
     public static boolean is1_8OrLater() {