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 2021/12/25 08:54:18 UTC

[groovy] branch master updated: GROOVY-10417: MethodNode toString() could add quotes when name contains spaces (additional refactor)

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


The following commit(s) were added to refs/heads/master by this push:
     new bdb2f7a  GROOVY-10417: MethodNode toString() could add quotes when name contains spaces (additional refactor)
bdb2f7a is described below

commit bdb2f7a482a4daec2bee01acd5590241c356e966
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Dec 25 18:54:10 2021 +1000

    GROOVY-10417: MethodNode toString() could add quotes when name contains spaces (additional refactor)
---
 src/main/java/org/codehaus/groovy/ast/MethodNode.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/ast/MethodNode.java b/src/main/java/org/codehaus/groovy/ast/MethodNode.java
index 82b1a1a..34f9419 100644
--- a/src/main/java/org/codehaus/groovy/ast/MethodNode.java
+++ b/src/main/java/org/codehaus/groovy/ast/MethodNode.java
@@ -84,10 +84,9 @@ public class MethodNode extends AnnotatedNode {
     }
 
     /**
-     * The type descriptor for a method node is a string containing the name of the method, its return type,
-     * and its parameter types in a canonical form. For simplicity, we use the format of a Java declaration
-     * without parameter names or generics.
+     * @deprecated use {@link org.apache.groovy.ast.tools.MethodNodeUtils#methodDescriptor(MethodNode, boolean)}
      */
+    @Deprecated
     public String getTypeDescriptor(final boolean pretty) {
         return methodDescriptor(this, pretty);
     }
@@ -309,6 +308,6 @@ public class MethodNode extends AnnotatedNode {
     @Override
     public String toString() {
         ClassNode declaringClass = getDeclaringClass();
-        return super.toString() + "[" + getTypeDescriptor(true) + (declaringClass == null ? "" : " from " + formatTypeName(declaringClass)) + "]";
+        return super.toString() + "[" + methodDescriptor(this, true) + (declaringClass == null ? "" : " from " + formatTypeName(declaringClass)) + "]";
     }
 }