[jboss-jira] [JBoss JIRA] Updated: (JBAOP-339) FieldAccess for inherited fields does not get replaced

dunks80 (JIRA) jira-events at jboss.com
Thu Jan 18 13:09:53 EST 2007


     [ http://jira.jboss.com/jira/browse/JBAOP-339?page=all ]

dunks80 updated JBAOP-339:
--------------------------

    Attachment: testcase2.tar

test case to demonstrate problem with field level access from with class hierarchy not causing interceptor to run

> FieldAccess for inherited fields does not get replaced
> ------------------------------------------------------
>
>                 Key: JBAOP-339
>                 URL: http://jira.jboss.com/jira/browse/JBAOP-339
>             Project: JBoss AOP
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 1.5.2.GA
>         Environment: JBoss 4.0.5.GA
> JBoss AOP 1.5.2.GA load time weaving
> Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode) 
>            Reporter: dunks80
>         Assigned To: Kabir Khan
>             Fix For: 1.5.3.GA
>
>         Attachments: testcase.tar, testcase2.tar
>
>
> I'm seeing the following unexpected behavior
> Code:
> public abstract class A
> {
>    @MyFieldAnnotation
>    protected Object myField;
> ...
> }
> public abstract class B<Z> extends A
> {
> ...
> }
> public class C extends B<Y>
> {
> ...
> }  
> @InterceptorDef(scope = Scope.PER_VM)
> @Bind(pointcut = "get(* *->@MyFieldAnnotation)")
> public class MyFieldInterceptor implements Interceptor
> {
> ...
> }
> 	
> When i try to call myField on an instance of C from within a method in C my interceptor is not run. However if I duplicate the annotated field in class B like this...
> Code:
> public abstract class A
> {
>    @MyFieldAnnotation
>    protected Object myField;
> ...
> }
> public abstract class B<Z> extends A
> {
>  @MyFieldAnnotation
>    protected Object myField;
> ...
> }
> 	
> ...then the interceptor works when calling myField from an instance of C. I'm guess that since B is generic some sort of erasure of the annotation is happening. As a work around in the meantime I've just duplicated the annotated field. I just wanted to know whether this issue was known to the developers (if not I'll post it to jira) and whether or not there was some way to get this working without the need to duplicate that field.
> Thanks

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

        



More information about the jboss-jira mailing list