You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/05/09 10:56:46 UTC

groovy git commit: Revert "GROOVY-8543: Support setting compileStatic by default via system properties"

Repository: groovy
Updated Branches:
  refs/heads/master 2e31936d2 -> 84771d3b0


Revert "GROOVY-8543: Support setting compileStatic by default via system properties"


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

Branch: refs/heads/master
Commit: 84771d3b0b731add85a4b8f6d52f4ebc04e2e796
Parents: 2e31936
Author: sunlan <su...@apache.org>
Authored: Wed May 9 18:56:41 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Wed May 9 18:56:41 2018 +0800

----------------------------------------------------------------------
 .../groovy/control/CompilerConfiguration.java   | 103 +++++++++----------
 1 file changed, 51 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/84771d3b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index 749f879..3de7535 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -19,11 +19,6 @@
 package org.codehaus.groovy.control;
 
 import org.apache.groovy.util.Maps;
-import org.codehaus.groovy.ast.AnnotationNode;
-import org.codehaus.groovy.ast.ClassCodeVisitorSupport;
-import org.codehaus.groovy.ast.ClassHelper;
-import org.codehaus.groovy.ast.ClassNode;
-import org.codehaus.groovy.classgen.GeneratorContext;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;
 import org.codehaus.groovy.control.io.NullWriter;
 import org.codehaus.groovy.control.messages.WarningMessage;
@@ -899,51 +894,55 @@ public class CompilerConfiguration {
         return indyEnabled;
     }
 
-    {
-        // this object initializer assures that `enableCompileStaticByDefault` must be invoked no matter which constructor called.
-        if (getBooleanSafe("groovy.compile.static")) {
-            enableCompileStaticByDefault();
-        }
-    }
-
-    private void enableCompileStaticByDefault() {
-        compilationCustomizers.add(
-            new CompilationCustomizer(CompilePhase.CONVERSION) {
-                @Override
-                public void call(final SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException {
-                    for (ClassNode cn : source.getAST().getClasses()) {
-                        newClassCodeVisitor(source).visitClass(cn);
-                    }
-                }
-
-                private ClassCodeVisitorSupport newClassCodeVisitor(SourceUnit source) {
-                    return new ClassCodeVisitorSupport() {
-                        @Override
-                        public void visitClass(ClassNode node) {
-                            enableCompileStatic(node);
-                        }
-
-                        private void enableCompileStatic(ClassNode classNode) {
-                            if (!classNode.getAnnotations(ClassHelper.make(GROOVY_TRANSFORM_COMPILE_STATIC)).isEmpty()) {
-                                return;
-                            }
-                            if (!classNode.getAnnotations(ClassHelper.make(GROOVY_TRANSFORM_COMPILE_DYNAMIC)).isEmpty()) {
-                                return;
-                            }
-
-                            classNode.addAnnotation(new AnnotationNode(ClassHelper.make(GROOVY_TRANSFORM_COMPILE_STATIC)));
-                        }
-
-                        @Override
-                        protected SourceUnit getSourceUnit() {
-                            return source;
-                        }
-
-                        private static final String GROOVY_TRANSFORM_COMPILE_STATIC = "groovy.transform.CompileStatic";
-                        private static final String GROOVY_TRANSFORM_COMPILE_DYNAMIC = "groovy.transform.CompileDynamic";
-                    };
-                }
-            }
-        );
-    }
+//       See http://groovy.329449.n5.nabble.com/What-the-static-compile-by-default-tt5750118.html
+//           https://issues.apache.org/jira/browse/GROOVY-8543
+//
+//    {
+//        // this object initializer assures that `enableCompileStaticByDefault` must be invoked no matter which constructor called.
+//        if (getBooleanSafe("groovy.compile.static")) {
+//            enableCompileStaticByDefault();
+//        }
+//    }
+//
+//
+//    private void enableCompileStaticByDefault() {
+//        compilationCustomizers.add(
+//            new CompilationCustomizer(CompilePhase.CONVERSION) {
+//                @Override
+//                public void call(final SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException {
+//                    for (ClassNode cn : source.getAST().getClasses()) {
+//                        newClassCodeVisitor(source).visitClass(cn);
+//                    }
+//                }
+//
+//                private ClassCodeVisitorSupport newClassCodeVisitor(SourceUnit source) {
+//                    return new ClassCodeVisitorSupport() {
+//                        @Override
+//                        public void visitClass(ClassNode node) {
+//                            enableCompileStatic(node);
+//                        }
+//
+//                        private void enableCompileStatic(ClassNode classNode) {
+//                            if (!classNode.getAnnotations(ClassHelper.make(GROOVY_TRANSFORM_COMPILE_STATIC)).isEmpty()) {
+//                                return;
+//                            }
+//                            if (!classNode.getAnnotations(ClassHelper.make(GROOVY_TRANSFORM_COMPILE_DYNAMIC)).isEmpty()) {
+//                                return;
+//                            }
+//
+//                            classNode.addAnnotation(new AnnotationNode(ClassHelper.make(GROOVY_TRANSFORM_COMPILE_STATIC)));
+//                        }
+//
+//                        @Override
+//                        protected SourceUnit getSourceUnit() {
+//                            return source;
+//                        }
+//
+//                        private static final String GROOVY_TRANSFORM_COMPILE_STATIC = "groovy.transform.CompileStatic";
+//                        private static final String GROOVY_TRANSFORM_COMPILE_DYNAMIC = "groovy.transform.CompileDynamic";
+//                    };
+//                }
+//            }
+//        );
+//    }
 }