Repository: groovy
Updated Branches:
  refs/heads/master ddcb01a3e -> c123dc365


Revert "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/c123dc36
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c123dc36
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c123dc36

Branch: refs/heads/master
Commit: c123dc365f4a8c82810d531ff4774cc4ccd26e23
Parents: ddcb01a
Author: sunlan <sun...@apache.org>
Authored: Mon Aug 7 08:47:14 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Mon Aug 7 08:47:14 2017 +0800

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


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

http://git-wip-us.apache.org/repos/asf/groovy/blob/c123dc36/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 8e230ea..e924c2c 100644
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -95,8 +95,6 @@ public class CompilerConfiguration {
      */
     public static final CompilerConfiguration DEFAULT = new 
CompilerConfiguration();
 
-    private static final String GROOVY_ANTLR4_OPT = "groovy.antlr4";
-
     /**
      * See {@link WarningMessage} for levels.
      */
@@ -198,11 +196,8 @@ 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 boolean antlr2Parser = false;
+    private boolean antlr2Parser = true;
 
     /**
      * Sets the Flags to defaults.
@@ -258,11 +253,7 @@ public class CompilerConfiguration {
         setOptimizationOptions(options);
 
         try {
-            String groovyAntlr4Opt = System.getProperty(GROOVY_ANTLR4_OPT);
-
-            if (null != groovyAntlr4Opt) {
-                antlr2Parser = !Boolean.valueOf(groovyAntlr4Opt);
-            }
+            antlr2Parser = !"true".equals(System.getProperty("groovy.antlr4"));
         } catch (Exception e) {
             // IGNORE
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/c123dc36/src/test/gls/syntax/MethodCallValidationTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/syntax/MethodCallValidationTest.groovy 
b/src/test/gls/syntax/MethodCallValidationTest.groovy
index 2bb5587..9fe6d52 100644
--- a/src/test/gls/syntax/MethodCallValidationTest.groovy
+++ b/src/test/gls/syntax/MethodCallValidationTest.groovy
@@ -18,17 +18,9 @@
  */
 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/c123dc36/subprojects/groovy-console/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/build.gradle 
b/subprojects/groovy-console/build.gradle
index b9209ab..bc38c53 100644
--- a/subprojects/groovy-console/build.gradle
+++ b/subprojects/groovy-console/build.gradle
@@ -27,7 +27,9 @@ dependencies {
 }
 
 task console(type: JavaExec, dependsOn:classes) {
-    jvmArgs += ["-Dgroovy.attach.groovydoc=true"]
+    if (rootProject.hasProperty('useAntlr4')) {
+        jvmArgs += ["-Dgroovy.antlr4=true", "-Dgroovy.attach.groovydoc=true"]
+    }
 
     main = 'groovy.ui.Console'
     classpath = sourceSets.main.runtimeClasspath

http://git-wip-us.apache.org/repos/asf/groovy/blob/c123dc36/subprojects/parser-antlr4/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/build.gradle 
b/subprojects/parser-antlr4/build.gradle
index fc7239a..a2a28a3 100644
--- a/subprojects/parser-antlr4/build.gradle
+++ b/subprojects/parser-antlr4/build.gradle
@@ -16,6 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
+if (!rootProject.hasProperty('useAntlr4')) return
 
 apply plugin: 'antlr'
 
@@ -59,6 +60,12 @@ 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