You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/04/26 13:57:20 UTC

[2/2] groovy git commit: GROOVY-6184: Make ClassHelper more consistent in the way it creates class nodes

GROOVY-6184: Make ClassHelper more consistent in the way it creates class nodes


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 783683e15728460e308c9c6dc9f381a1a84d0522
Parents: 4e513cc
Author: Cedric Champeau <ce...@gmail.com>
Authored: Mon Mar 16 18:41:24 2015 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Wed Apr 26 23:53:14 2017 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/ast/ClassHelper.java    | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/783683e1/src/main/org/codehaus/groovy/ast/ClassHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/ast/ClassHelper.java b/src/main/org/codehaus/groovy/ast/ClassHelper.java
index a09c258..a52085d 100644
--- a/src/main/org/codehaus/groovy/ast/ClassHelper.java
+++ b/src/main/org/codehaus/groovy/ast/ClassHelper.java
@@ -28,6 +28,8 @@ import org.codehaus.groovy.util.ReferenceBundle;
 import org.codehaus.groovy.vmplugin.VMPluginFactory;
 import org.objectweb.asm.Opcodes;
 
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Iterator;
@@ -87,25 +89,19 @@ public class ClassHelper {
         void_WRAPPER_TYPE = makeCached(Void.class),   METACLASS_TYPE = makeCached(MetaClass.class),
         Iterator_TYPE = makeCached(Iterator.class),
 
+        Enum_Type = makeWithoutCaching(Enum.class),
+        Annotation_TYPE = makeCached(Annotation.class),
+        ELEMENT_TYPE_TYPE = makeCached(ElementType.class),
+
         // uncached constants.
         CLASS_Type = makeWithoutCaching(Class.class), COMPARABLE_TYPE = makeWithoutCaching(Comparable.class),        
         GENERATED_CLOSURE_Type = makeWithoutCaching(GeneratedClosure.class),
         GROOVY_OBJECT_SUPPORT_TYPE = makeWithoutCaching(GroovyObjectSupport.class),
         GROOVY_OBJECT_TYPE = makeWithoutCaching(GroovyObject.class),
-        GROOVY_INTERCEPTABLE_TYPE = makeWithoutCaching(GroovyInterceptable.class),
-        
-        Enum_Type = new ClassNode("java.lang.Enum",0,OBJECT_TYPE),
-        Annotation_TYPE = new ClassNode("java.lang.annotation.Annotation",0,OBJECT_TYPE),
-        ELEMENT_TYPE_TYPE = new ClassNode("java.lang.annotation.ElementType",0,Enum_Type)
+        GROOVY_INTERCEPTABLE_TYPE = makeWithoutCaching(GroovyInterceptable.class)
         ;
-        
-        
-    static {
-        Enum_Type.isPrimaryNode = false;
-        Annotation_TYPE.isPrimaryNode = false;
-    }
     
-    private static ClassNode[] types = new ClassNode[] {
+    private static final ClassNode[] types = new ClassNode[] {
         OBJECT_TYPE,
         boolean_TYPE, char_TYPE, byte_TYPE, short_TYPE,
         int_TYPE, long_TYPE, double_TYPE, float_TYPE,