groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 14/20: Simplify the prefix of synthetic method name
Date Mon, 08 Apr 2019 12:59:06 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit d8aac4e063ebc3981c6efe7c42c278a1c2f580ef
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Mon Mar 18 23:18:14 2019 +0800

    Simplify the prefix of synthetic method name
---
 src/main/java/org/codehaus/groovy/ast/ClassNode.java             | 4 +++-
 src/main/java/org/codehaus/groovy/classgen/GeneratorContext.java | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/ast/ClassNode.java b/src/main/java/org/codehaus/groovy/ast/ClassNode.java
index 8099c8c..ead078e 100644
--- a/src/main/java/org/codehaus/groovy/ast/ClassNode.java
+++ b/src/main/java/org/codehaus/groovy/ast/ClassNode.java
@@ -1140,12 +1140,14 @@ public class ClassNode extends AnnotatedNode implements Opcodes {
     }
 
     private void visitMethods(GroovyClassVisitor visitor) {
+        // create snapshot of the method list to avoid java.util.ConcurrentModificationException
         List<MethodNode> methodList = new ArrayList<>(getMethods());
         for (MethodNode mn : methodList) {
             visitor.visitMethod(mn);
         }
 
-        // visit the method node added while iterating the above methodList, e.g. synthetic
method for constructor reference
+        // visit the method nodes added while iterating,
+        // e.g. synthetic method for constructor reference
         List<MethodNode> changedMethodList = new ArrayList<>(getMethods());
         boolean changed = changedMethodList.removeAll(methodList);
         if (changed) {
diff --git a/src/main/java/org/codehaus/groovy/classgen/GeneratorContext.java b/src/main/java/org/codehaus/groovy/classgen/GeneratorContext.java
index c80a8dd..ea4f973 100644
--- a/src/main/java/org/codehaus/groovy/classgen/GeneratorContext.java
+++ b/src/main/java/org/codehaus/groovy/classgen/GeneratorContext.java
@@ -76,7 +76,7 @@ public class GeneratorContext {
     }
 
     public String getNextConstructorReferenceSyntheticMethodName(MethodNode enclosingMethodNode)
{
-        return "constructorReference$"
+        return "ctorRef$"
                 + (null == enclosingMethodNode
                         ? ""
                         : enclosingMethodNode.getName().replace("<", "").replace(">",
"") + "$" )


Mime
View raw message