Browse Source

implemented getSignature() in javassist.expr.MethodCall


git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@223 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
tags/rel_3_17_1_ga
chiba 18 years ago
parent
commit
549aab4f06

+ 7
- 2
src/main/javassist/CtBehavior.java View File

@@ -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, <code>getSignature()</code> returns the
* same string (the return type of constructors is <code>void</code>).
*
* @see javassist.bytecode.Descriptor
*/
public String getSignature() {
return methodInfo.getDescriptor();

+ 1
- 0
src/main/javassist/CtClass.java View File

@@ -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)

+ 1
- 1
src/main/javassist/expr/ConstructorCall.java View File

@@ -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());
}

/**

+ 10
- 3
src/main/javassist/expr/MethodCall.java View File

@@ -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));

Loading…
Cancel
Save