diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2013-04-17 13:58:39 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2013-04-17 13:58:39 +0000 |
commit | 7a49552112a2e59dc9d5afc135dba918b8c36751 (patch) | |
tree | ee44a11c0de9895a2d63282ce7924e3df4a50eb2 /src/main | |
parent | 81e75232f4deaf5c9d45a4956d87a37f03722ca9 (diff) | |
download | javassist-7a49552112a2e59dc9d5afc135dba918b8c36751.tar.gz javassist-7a49552112a2e59dc9d5afc135dba918b8c36751.zip |
fixed JASSIST-181
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@706 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/javassist/bytecode/SignatureAttribute.java | 17 | ||||
-rw-r--r-- | src/main/javassist/bytecode/annotation/ClassMemberValue.java | 11 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/main/javassist/bytecode/SignatureAttribute.java b/src/main/javassist/bytecode/SignatureAttribute.java index 1ab101e6..64b53952 100644 --- a/src/main/javassist/bytecode/SignatureAttribute.java +++ b/src/main/javassist/bytecode/SignatureAttribute.java @@ -942,6 +942,23 @@ public class SignatureAttribute extends AttributeInfo { } } + /** + * Parses the given signature string as a type signature. + * The type signature is either the field type signature or a base type + * descriptor including <code>void</code> type. + * + * @throws BadBytecode thrown when a syntactical error is found. + * @since 3.18 + */ + public static Type toTypeSignature(String sig) throws BadBytecode { + try { + return parseType(sig, new Cursor()); + } + catch (IndexOutOfBoundsException e) { + throw error(sig); + } + } + private static ClassSignature parseSig(String sig) throws BadBytecode, IndexOutOfBoundsException { diff --git a/src/main/javassist/bytecode/annotation/ClassMemberValue.java b/src/main/javassist/bytecode/annotation/ClassMemberValue.java index ad27e7b2..19f8560f 100644 --- a/src/main/javassist/bytecode/annotation/ClassMemberValue.java +++ b/src/main/javassist/bytecode/annotation/ClassMemberValue.java @@ -17,8 +17,11 @@ package javassist.bytecode.annotation; import javassist.ClassPool; +import javassist.bytecode.BadBytecode; import javassist.bytecode.ConstPool; import javassist.bytecode.Descriptor; +import javassist.bytecode.SignatureAttribute; + import java.io.IOException; import java.lang.reflect.Method; @@ -97,7 +100,11 @@ public class ClassMemberValue extends MemberValue { */ public String getValue() { String v = cp.getUtf8Info(valueIndex); - return Descriptor.toClassName(v); + try { + return SignatureAttribute.toTypeSignature(v).toString(); + } catch (BadBytecode e) { + throw new RuntimeException(e); + } } /** @@ -114,7 +121,7 @@ public class ClassMemberValue extends MemberValue { * Obtains the string representation of this object. */ public String toString() { - return "<" + getValue() + " class>"; + return getValue() + ".class"; } /** |