[jboss-jira] [JBoss JIRA] (JASSIST-209) Nested classes read from ClassMemberValue cannot be loaded
Ben Romberg (JIRA)
jira-events at lists.jboss.org
Wed Oct 2 04:53:02 EDT 2013
[ https://issues.jboss.org/browse/JASSIST-209?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ben Romberg updated JASSIST-209:
--------------------------------
Description:
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.
was:
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 (by inheriting from ClassMemberValue within my own package javassist.bytecode.annotation to gain access to the package private fields), 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.
> 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: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list