]
Ben Romberg commented on JASSIST-209:
-------------------------------------
Workaround (hack):
{code}
package javassist.bytecode.annotation;
import javassist.bytecode.Descriptor;
public class ClassMemberValueReader {
public static String readClassMemberValue(ClassMemberValue classMemberValue) {
String v = classMemberValue.cp.getUtf8Info(classMemberValue.valueIndex);
return Descriptor.toClassName(v);
}
}
{code}
Nested classes read from ClassMemberValue cannot be loaded
----------------------------------------------------------
Key: JASSIST-209
URL:
https://issues.jboss.org/browse/JASSIST-209
Project: Javassist
Issue Type: Bug
Affects Versions: 3.18.0-GA
Reporter: Ben Romberg
Assignee: Shigeru Chiba
I'm trying to upgrade Javassist in my project from version 3.16.1 to 3.18.0. I'm
using the ClassMemberValue to load the (String) class-name of an annotation value, in
order to load the class with Javassist using ClassPool.get(...).
In 3.16.1, the returned class-name String for nested classes contained the $-sign, as in
package.ParentClass$NestedClass, which didn't have any issues using the String with
ClassPool.get(...).
In 3.18.0 however, the returned class-name String for nested classes changed to a pure
dot-notation, as in package.ParentClass.NestedClass, which cannot be used with
ClassPool.get(...) anymore, as Javassist tries to load the class-file from
package/ParentClass/NestedClass.class instead of package/ParentClass$NestedClass.class.
I don't see any way to work around the issue without hacking into internal API, as
the class-name String is the only way to get the annotation value. As this is a generic
class (and not always a nested class), I also cannot simply replace the last dot with a
$-sign.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: