diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2011-07-08 09:10:34 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2011-07-08 09:10:34 +0000 |
commit | c944f7ab91da8e9b3a1c8bc98cf7aae32bfbb086 (patch) | |
tree | d7e9ab575eeab9bae8e572fd05a8d69a091fbd7a /src | |
parent | 121a67e8df095ee2159ed987b0c64728fe3a39ed (diff) | |
download | javassist-c944f7ab91da8e9b3a1c8bc98cf7aae32bfbb086.tar.gz javassist-c944f7ab91da8e9b3a1c8bc98cf7aae32bfbb086.zip |
fixed JASSIST-138
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@585 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src')
-rw-r--r-- | src/main/javassist/bytecode/ConstPool.java | 22 | ||||
-rw-r--r-- | src/main/javassist/bytecode/analysis/Executor.java | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/main/javassist/bytecode/ConstPool.java b/src/main/javassist/bytecode/ConstPool.java index bba4175d..a04ba128 100644 --- a/src/main/javassist/bytecode/ConstPool.java +++ b/src/main/javassist/bytecode/ConstPool.java @@ -215,6 +215,28 @@ public final class ConstPool { } /** + * Reads <code>CONSTANT_Class_info</code> structure + * at the given index. + * + * @return the descriptor of the type specified + * by <code>name_index</code>. + * @see javassist.ClassPool#getCtClass(String) + * @since 3.15 + */ + public String getClassInfoByDescriptor(int index) { + ClassInfo c = (ClassInfo)getItem(index); + if (c == null) + return null; + else { + String className = getUtf8Info(c.name); + if (className.charAt(0) == '[') + return className; + else + return Descriptor.of(className); + } + } + + /** * Reads the <code>name_index</code> field of the * <code>CONSTANT_NameAndType_info</code> structure * at the given index. diff --git a/src/main/javassist/bytecode/analysis/Executor.java b/src/main/javassist/bytecode/analysis/Executor.java index 33c54b75..f53e98bf 100644 --- a/src/main/javassist/bytecode/analysis/Executor.java +++ b/src/main/javassist/bytecode/analysis/Executor.java @@ -596,7 +596,7 @@ public class Executor implements Opcode { break; case CHECKCAST: verifyAssignable(Type.OBJECT, simplePop(frame)); - frame.push(typeFromDesc(constPool.getClassInfo(iter.u16bitAt(pos + 1)))); + frame.push(typeFromDesc(constPool.getClassInfoByDescriptor(iter.u16bitAt(pos + 1)))); break; case INSTANCEOF: verifyAssignable(Type.OBJECT, simplePop(frame)); |