From: chiba Date: Mon, 16 May 2005 14:53:51 +0000 (+0000) Subject: Changed ClassPool.get() to accept the descriptors of array types. X-Git-Tag: rel_3_17_1_ga~451 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5b7f8857037a9fd931ef1d6171fee6e7f2f0ec2e;p=javassist.git Changed ClassPool.get() to accept the descriptors of array types. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@170 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index 28b795c6..bf1c73ac 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -22,6 +22,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.util.Hashtable; +import javassist.bytecode.Descriptor; /** * A container of CtClass objects. @@ -348,6 +349,10 @@ public class ClassPool { * @return null if the class file could not be found. */ protected CtClass createCtClass(String classname, boolean useCache) { + // accept "[L;" as a class name. + if (classname.charAt(0) == '[') + classname = Descriptor.toClassName(classname); + if (classname.endsWith("[]")) { String base = classname.substring(0, classname.indexOf('[')); if ((!useCache || getCached(base) == null) && find(base) == null) diff --git a/src/main/javassist/expr/MethodCall.java b/src/main/javassist/expr/MethodCall.java index 3bd7d098..ded74e0c 100644 --- a/src/main/javassist/expr/MethodCall.java +++ b/src/main/javassist/expr/MethodCall.java @@ -93,7 +93,10 @@ public class MethodCall extends Expr { else cname = cp.getMethodrefClassName(index); - return cname; + if (cname.charAt(0) == '[') + cname = Descriptor.toClassName(cname); + + return cname; } /**