From f280738536267d7ec1f6de1052861007a16a794a Mon Sep 17 00:00:00 2001 From: adrian Date: Wed, 15 Feb 2006 14:55:59 +0000 Subject: [PATCH] Allow access to the constructor signature. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@245 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/expr/NewExpr.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/javassist/expr/NewExpr.java b/src/main/javassist/expr/NewExpr.java index a75a0a5c..835485f5 100644 --- a/src/main/javassist/expr/NewExpr.java +++ b/src/main/javassist/expr/NewExpr.java @@ -37,6 +37,9 @@ public class NewExpr extends Expr { newPos = np; } + /* + * Not used + * private int getNameAndType(ConstPool cp) { int pos = currentPos; int c = iterator.byteAt(pos); @@ -46,7 +49,7 @@ public class NewExpr extends Expr { return cp.getInterfaceMethodrefNameAndType(index); else return cp.getMethodrefNameAndType(index); - } + } */ /** * Returns the method or constructor containing the new @@ -87,6 +90,18 @@ public class NewExpr extends Expr { return newTypeName; } + /** + * Get the signature of the constructor + * + * @return the signature + */ + public String getSignature() + { + ConstPool constPool = getConstPool(); + int methodIndex = iterator.u16bitAt(currentPos + 1); // constructor + return constPool.getMethodrefType(methodIndex); + } + /** * Returns the constructor called for creating the object. */ @@ -131,7 +146,7 @@ public class NewExpr extends Expr { throw new CannotCompileException( "sorry, cannot edit NEW followed by no DUP"); } - + /** * Replaces the new expression with the bytecode derived from * the given source text. -- 2.39.5