groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Port native lambda to Java7: check whether using Parrot parser or not
Date Sun, 18 Feb 2018 05:34:55 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X e5809ccc4 -> a2492184e


Port native lambda to Java7: check whether using Parrot parser or not


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

Branch: refs/heads/GROOVY_2_6_X
Commit: a2492184e6b3233b617a4a241377d5c1dccc052e
Parents: e5809cc
Author: danielsun1106 <realbluesun@hotmail.com>
Authored: Sun Feb 18 13:34:49 2018 +0800
Committer: danielsun1106 <realbluesun@hotmail.com>
Committed: Sun Feb 18 13:34:49 2018 +0800

----------------------------------------------------------------------
 src/test/groovy/transform/stc/LambdaTest.groovy | 65 ++++++++++----------
 1 file changed, 34 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/a2492184/src/test/groovy/transform/stc/LambdaTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/LambdaTest.groovy b/src/test/groovy/transform/stc/LambdaTest.groovy
index 0e2345f..cbe7432 100644
--- a/src/test/groovy/transform/stc/LambdaTest.groovy
+++ b/src/test/groovy/transform/stc/LambdaTest.groovy
@@ -19,14 +19,17 @@
 
 package groovy.transform.stc
 
+import org.codehaus.groovy.control.CompilerConfiguration
+import org.codehaus.groovy.control.ParserVersion
 import org.codehaus.groovy.vmplugin.VMPluginFactory
 
 class LambdaTest extends GroovyTestCase {
     private static final boolean SKIP_ERRORS = true;
     private static final boolean PRE_JAVA8 = VMPluginFactory.getPlugin().getVersion() <
8;
+    private static final boolean USE_PARROT = ParserVersion.V_2 != CompilerConfiguration.DEFAULT.parserVersion
 
     void testFunction() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -47,7 +50,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionScript() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -64,7 +67,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testBinaryOperator() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -85,7 +88,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testConsumer() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -107,7 +110,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testPredicate() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -130,7 +133,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testUnaryOperator() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -153,7 +156,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testBiConsumer() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -175,7 +178,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithLocalVariables() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -198,7 +201,7 @@ class LambdaTest extends GroovyTestCase {
 
 
     void testFunctionWithLocalVariables2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -221,7 +224,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithLocalVariables4() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -244,7 +247,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithStaticMethodCall() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -271,7 +274,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithStaticMethodCall2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -298,7 +301,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithInstanceMethodCall() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -323,7 +326,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionInConstructor() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -348,7 +351,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithInstanceMethodCall2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -373,7 +376,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithInstanceMethodCall3() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -398,7 +401,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionCall() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -421,7 +424,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionCall2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -444,7 +447,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionCall3() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -467,7 +470,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testConsumerCall() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -492,7 +495,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testConsumerCall2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -517,7 +520,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testConsumerCall3() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -542,7 +545,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testSamCall() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -569,7 +572,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testSamCall2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -596,7 +599,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithUpdatingLocalVariable() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -619,7 +622,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithUpdatingLocalVariable2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -642,7 +645,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithVariableDeclaration() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -666,7 +669,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithMixingVariableDeclarationAndMethodInvocation() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -696,7 +699,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithNestedLambda() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -725,7 +728,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithNestedLambda2() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic
@@ -752,7 +755,7 @@ class LambdaTest extends GroovyTestCase {
     }
 
     void testFunctionWithNestedLambda3() {
-        if (PRE_JAVA8) return;
+        if (PRE_JAVA8 || !USE_PARROT) return;
 
         assertScript '''
         import groovy.transform.CompileStatic


Mime
View raw message