Repository: groovy
Updated Branches:
  refs/heads/master cf2658b9d -> 350b684f7


Enable the new parser Parrot by default(Groovy 3.0.0+ Only)


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

Branch: refs/heads/master
Commit: 350b684f7e5427c0b75453fcfae1a58a04b49f46
Parents: cf2658b
Author: sunlan <sun...@apache.org>
Authored: Wed Aug 9 01:26:38 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Wed Aug 9 01:26:38 2017 +0800

----------------------------------------------------------------------
 .travis.yml                                         |  2 +-
 .../groovy/control/CompilerConfiguration.java       | 16 ++++++++++++----
 src/test/gls/syntax/MethodCallValidationTest.groovy |  8 ++++++++
 subprojects/groovy-console/build.gradle             |  4 +---
 subprojects/parser-antlr4/build.gradle              |  7 -------
 5 files changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/350b684f/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e4f512c..9bf1700 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ matrix:
 
 install: true
 
-script: travis_wait 60 ./gradlew -PuseAntlr4=true test
+script: travis_wait 60 ./gradlew test
 
 before_cache:
   - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

http://git-wip-us.apache.org/repos/asf/groovy/blob/350b684f/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 ca02d10..3b624a3 100644
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -95,6 +95,8 @@ public class CompilerConfiguration {
      */
     public static final CompilerConfiguration DEFAULT = new 
CompilerConfiguration();
 
+    private static final String GROOVY_ANTLR4_OPT = "groovy.antlr4";
+
     /**
      * See {@link WarningMessage} for levels.
      */
@@ -196,8 +198,11 @@ public class CompilerConfiguration {
     /**
      * defines if antlr2 parser should be used or the antlr4 one if
      * no factory is set yet
+     *
+     * The antlr4 parser Parrot is enabled by default
+     *
      */
-    private ParserVersion parserVersion = ParserVersion.V_2;
+    private ParserVersion parserVersion = ParserVersion.V_4;
 
     /**
      * Sets the Flags to defaults.
@@ -253,9 +258,12 @@ public class CompilerConfiguration {
         setOptimizationOptions(options);
 
         try {
-            if ("true".equals(System.getProperty("groovy.antlr4"))) {
-                this.parserVersion = ParserVersion.V_4;
-            }
+            String groovyAntlr4Opt = System.getProperty(GROOVY_ANTLR4_OPT);
+
+            this.parserVersion =
+                    null == groovyAntlr4Opt || Boolean.valueOf(groovyAntlr4Opt)
+                            ? ParserVersion.V_4
+                            : ParserVersion.V_2;
         } catch (Exception e) {
             // IGNORE
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/350b684f/src/test/gls/syntax/MethodCallValidationTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/syntax/MethodCallValidationTest.groovy 
b/src/test/gls/syntax/MethodCallValidationTest.groovy
index 9fe6d52..2bb5587 100644
--- a/src/test/gls/syntax/MethodCallValidationTest.groovy
+++ b/src/test/gls/syntax/MethodCallValidationTest.groovy
@@ -18,9 +18,17 @@
  */
 package gls.syntax
 
+import org.codehaus.groovy.control.CompilerConfiguration
+import org.codehaus.groovy.control.ParserVersion
+
 public class MethodCallValidationTest extends gls.CompilableTestSupport {
 
     void testDeclarationInMethodCall() {
+        if (ParserVersion.V_4 == CompilerConfiguration.DEFAULT.parserVersion) {
+            // FIXME GROOVY-8277
+            return
+        }
+
         shouldNotCompile """
             foo(String a)
         """

http://git-wip-us.apache.org/repos/asf/groovy/blob/350b684f/subprojects/groovy-console/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/build.gradle 
b/subprojects/groovy-console/build.gradle
index bc38c53..b9209ab 100644
--- a/subprojects/groovy-console/build.gradle
+++ b/subprojects/groovy-console/build.gradle
@@ -27,9 +27,7 @@ dependencies {
 }
 
 task console(type: JavaExec, dependsOn:classes) {
-    if (rootProject.hasProperty('useAntlr4')) {
-        jvmArgs += ["-Dgroovy.antlr4=true", "-Dgroovy.attach.groovydoc=true"]
-    }
+    jvmArgs += ["-Dgroovy.attach.groovydoc=true"]
 
     main = 'groovy.ui.Console'
     classpath = sourceSets.main.runtimeClasspath

http://git-wip-us.apache.org/repos/asf/groovy/blob/350b684f/subprojects/parser-antlr4/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/build.gradle 
b/subprojects/parser-antlr4/build.gradle
index a2a28a3..fc7239a 100644
--- a/subprojects/parser-antlr4/build.gradle
+++ b/subprojects/parser-antlr4/build.gradle
@@ -16,7 +16,6 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-if (!rootProject.hasProperty('useAntlr4')) return
 
 apply plugin: 'antlr'
 
@@ -60,12 +59,6 @@ sourceSets.test.groovy.srcDirs += file("$srcTest/groovy");
 sourceSets.test.resources.srcDirs += file("$srcTest/resources");
 
 
-allprojects {
-    tasks.withType(GroovyCompile) {
-        groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
-    }
-}
-
 test {
     jvmArgs "-Dgroovy.attach.groovydoc=true", 
"-Dgroovy.antlr4.cache.threshold=100"
 }
\ No newline at end of file

Reply via email to