From 549aab4f06dd07cd5b5330c269937181b4fc7cc4 Mon Sep 17 00:00:00 2001 From: chiba Date: Sat, 12 Nov 2005 15:38:12 +0000 Subject: [PATCH] implemented getSignature() in javassist.expr.MethodCall git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@223 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/CtBehavior.java | 9 +++++++-- src/main/javassist/CtClass.java | 1 + src/main/javassist/expr/ConstructorCall.java | 2 +- src/main/javassist/expr/MethodCall.java | 13 ++++++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java index 749caf33..41e1df7e 100644 --- a/src/main/javassist/CtBehavior.java +++ b/src/main/javassist/CtBehavior.java @@ -169,11 +169,16 @@ public abstract class CtBehavior extends CtMember { } /** - * Returns the character string representing the parameter types - * and the return type. If two methods/constructors have + * Returns the method signature (the parameter types + * and the return type). + * The method signature is represented by a character string + * called method descriptor, which is defined in the JVM specification. + * If two methods/constructors have * the same parameter types * and the return type, getSignature() returns the * same string (the return type of constructors is void). + * + * @see javassist.bytecode.Descriptor */ public String getSignature() { return methodInfo.getDescriptor(); diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 55f81b81..74ab0d3e 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -703,6 +703,7 @@ public abstract class CtClass { * * @param name method name * @param desc method descriptor + * @see CtBehavior.getSignature() * @see javassist.bytecode.Descriptor */ public CtMethod getMethod(String name, String desc) diff --git a/src/main/javassist/expr/ConstructorCall.java b/src/main/javassist/expr/ConstructorCall.java index fb50b6a8..df3b01e0 100644 --- a/src/main/javassist/expr/ConstructorCall.java +++ b/src/main/javassist/expr/ConstructorCall.java @@ -41,7 +41,7 @@ public class ConstructorCall extends MethodCall { * Returns the called constructor. */ public CtConstructor getConstructor() throws NotFoundException { - return getCtClass().getConstructor(getMethodDesc()); + return getCtClass().getConstructor(getSignature()); } /** diff --git a/src/main/javassist/expr/MethodCall.java b/src/main/javassist/expr/MethodCall.java index ecb6ee86..7bc2c388 100644 --- a/src/main/javassist/expr/MethodCall.java +++ b/src/main/javassist/expr/MethodCall.java @@ -111,13 +111,20 @@ public class MethodCall extends Expr { * Returns the called method. */ public CtMethod getMethod() throws NotFoundException { - return getCtClass().getMethod(getMethodName(), getMethodDesc()); + return getCtClass().getMethod(getMethodName(), getSignature()); } /** - * Returns the descriptor of the called method. + * Returns the method signature (the parameter types + * and the return type). + * The method signature is represented by a character string + * called method descriptor, which is defined in the JVM specification. + * + * @see javassist.CtBehavior.getSignature() + * @see javassist.bytecode.Descriptor + * @since 3.1 */ - protected String getMethodDesc() { + public String getSignature() { ConstPool cp = getConstPool(); int nt = getNameAndType(cp); return cp.getUtf8Info(cp.getNameAndTypeDescriptor(nt)); -- 2.39.5