Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 112F2200CA8 for ; Thu, 11 May 2017 00:26:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0FD53160BB4; Wed, 10 May 2017 22:26:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0FDA6160BC9 for ; Thu, 11 May 2017 00:26:31 +0200 (CEST) Received: (qmail 95760 invoked by uid 500); 10 May 2017 22:26:31 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 95255 invoked by uid 99); 10 May 2017 22:26:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 22:26:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8DCA4E35E9; Wed, 10 May 2017 22:26:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Date: Wed, 10 May 2017 22:26:32 -0000 Message-Id: In-Reply-To: <08576301a28a4d6c9b372a46e9c44259@git.apache.org> References: <08576301a28a4d6c9b372a46e9c44259@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/50] [abbrv] groovy git commit: clean-up now that jdk7 is baseline (closes #526) archived-at: Wed, 10 May 2017 22:26:34 -0000 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 Authored: Fri Apr 21 20:27:22 2017 +0200 Committer: paulk 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 ("indy") is the Optimization Option value for enabling invokedynamic 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() {