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:19 UTC

[1/2] groovy git commit: GROOVY-8127: Access to Trait$Trait$Helper#$self is forbidden (tweak for static final props)

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X f24c3c113 -> 783683e15


GROOVY-8127: Access to Trait$Trait$Helper#$self is forbidden (tweak for static final props)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 4e513ccec066ffcdbd5acef55473d3acfb1aa33e
Parents: f24c3c1
Author: paulk <pa...@asert.com.au>
Authored: Wed Apr 26 23:42:15 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Wed Apr 26 23:42:15 2017 +1000

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/transform/trait/TraitComposer.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/4e513cce/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java b/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java
index 324bd4a..29540bb 100644
--- a/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java
+++ b/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java
@@ -74,6 +74,7 @@ import java.util.Map;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.args;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.assignX;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.callX;
+import static org.codehaus.groovy.ast.tools.GeneralUtils.classX;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.stmt;
 import static org.codehaus.groovy.ast.tools.GeneralUtils.varX;
@@ -264,7 +265,7 @@ public abstract class TraitComposer {
                             // so instead set within (static) initializer
                             if (fieldNode.isFinal()) {
                                 String baseName = fieldNode.isStatic() ? Traits.STATIC_INIT_METHOD : Traits.INIT_METHOD;
-                                Expression mce = callX(helperClassNode, baseName + fieldNode.getName(), args(varX("this")));
+                                Expression mce = callX(helperClassNode, baseName + fieldNode.getName(), args(fieldNode.isStatic() ? classX(cNode) : varX("this")));
                                 Statement stmt = stmt(assignX(varX(fieldNode.getName(), fieldNode.getType()), mce));
                                 if (isStatic == 0) {
                                     cNode.addObjectInitializerStatements(stmt);


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

Posted by pa...@apache.org.
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,