[jboss-jira] [JBoss JIRA] Commented: (JASSIST-136) getDeclaringClass() throws IncompatibleClassChangeError on copy of inner class

Shigeru Chiba (JIRA) jira-events at lists.jboss.org
Thu Jan 27 10:46:04 EST 2011


    [ https://issues.jboss.org/browse/JASSIST-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578454#comment-12578454 ] 

Shigeru Chiba commented on JASSIST-136:
---------------------------------------

If a class A is a static nested class in class B, then both A and B have a special attribute indicating that A is in B.  So when you make a copy of A and name it A2, B's attribute must be updated to indicate A2 is also in B.  Unfortunately, Javassist does not support such an update.  I will check supporting it is possible.

Furthermore, according to Java's naming convention, GetDeclaringClassTest$Foo$BackRef is a static nested class BackRef in Foo, which is a nested class in GetDeclaringClassTest.  In this case, updating attributes is more complex.

> getDeclaringClass() throws IncompatibleClassChangeError on copy of inner class
> ------------------------------------------------------------------------------
>
>                 Key: JASSIST-136
>                 URL: https://issues.jboss.org/browse/JASSIST-136
>             Project: Javassist
>          Issue Type: Bug
>    Affects Versions: 3.14.0.GA
>         Environment: sun jdk1.6.0_21
>            Reporter: Ragnar Rova
>            Assignee: Shigeru Chiba
>
> Creating a copy of a inner class and then calling getDeclaringClass() on the copied class causes error. How to create a copy of such a class?
> java.lang.IncompatibleClassChangeError: foo.GetDeclaringClassTest and foo.GetDeclaringClassTest$Foo$BackRef disagree on InnerClasses attribute
> 	at java.lang.Class.getDeclaringClass(Native Method)
> 	at foo.GetDeclaringClassTest.get_declaring_class_should_not_throw_error(GetDeclaringClassTest.java:20)

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list