[jboss-jira] [JBoss JIRA] Commented: (JBAOP-660) VerifyError on Illegal bytecode generated with cross-package inheritence

Jason T. Greene (JIRA) jira-events at lists.jboss.org
Tue Oct 7 10:13:21 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBAOP-660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12432898#action_12432898 ] 

Jason T. Greene commented on JBAOP-660:
---------------------------------------

Ok, the reason the test wasn't failing is because the adviser class was not yet loaded. Calling _getInstanceAdvisor() forces it to load. I have modified the test to generate the failure now, and you should now receive the below stack trace.

I would have just changed these internal fields to be public, to solve the problem, but I didn't want to just go around making major design changes in your project ;)

Testcase: testBaseClass took 0.743 sec
Testcase: testChildClass took 0.077 sec
        Caused an ERROR
(class: org/jboss/test/aop/inheritanceacrosspackages/child/Child$ChildInstanceAdvisor, method: base_N_2417233087267927612 sign
ature: (Lorg/jboss/test/aop/inheritanceacrosspackages/base/Base;)V) Bad access to protected data
java.lang.VerifyError: (class: org/jboss/test/aop/inheritanceacrosspackages/child/Child$ChildInstanceAdvisor, method: base_N_2
417233087267927612 signature: (Lorg/jboss/test/aop/inheritanceacrosspackages/base/Base;)V) Bad access to protected data
        at org.jboss.test.aop.inheritanceacrosspackages.child.Child$ChildAdvisor.createInstanceAdvisor(Child$ChildAdvisor.java
)
        at org.jboss.test.aop.inheritanceacrosspackages.child.Child._getInstanceAdvisor(Child.java)
        at org.jboss.test.aop.inheritanceacrosspackages.InheritanceAcrossPackagesTestCase.testChildClass(InheritanceAcrossPack
agesTestCase.java:52)

> VerifyError on Illegal bytecode generated with cross-package inheritence
> ------------------------------------------------------------------------
>
>                 Key: JBAOP-660
>                 URL: https://jira.jboss.org/jira/browse/JBAOP-660
>             Project: JBoss AOP
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 2.0.0.alpha1, 2.0.0.alpha2, 2.0.0.alpha3, 2.0.0.alpha4, 2.0.0.alpha5, 2.0.0.alpha6, 2.0.0.beta1, 2.0.0.beta2, 2.0.0.CR1, 2.0.0.CR2, 2.0.0.CR3, 2.0.0.CR4, 2.0.0.CR5, 2.0.0.CR6, 2.0.0.CR7, 2.0.0.CR8, 2.0.0.CR9, 2.0.0.CR10, 2.0.0.CR11, 2.0.0.CR12, 2.0.0.CR13, 2.0.0.CR14, 2.0.0.CR15, 2.0.0.CR16, 2.0.0.CR17, 2.0.0.CR18
>            Reporter: Jason T. Greene
>            Assignee: Flavia Rainone
>            Priority: Critical
>             Fix For: 2.0.0.GA
>
>
> If two classes in an inheritance tree are both weaved, and the classes are in different packages, the generated adviser classes contain bytecode that violates the protected member access restrictions:
> 33:	getfield	#617; //Field two/Bar$BarInstanceAdvisor.parent:Ltwo/Bar$BarAdvisor;
> 36:	getfield	#619; //Field one/Foo$FooAdvisor.aop$FieldInfo_w_blah:Lorg/jboss/aop/FieldInfo;
> A protected member can only be accessed on an object instance that is the same type or a subtype of the code touching the protected field, unless both classes are in the same package, in which case normal package access rules supersede.
> Adding a method call indirection, or making the fields public would be possible solutions.
> To reproduce, just create two small classes in different packages where one inherits the other, and both are weaved. Then call Advised._getInstanceAdvisor(), which will attempt to load the class, resulting in a VerifyError

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list