Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] perthis instantiation model aspects

Hello Matthew,

 

thank you very much for clarifying this and writing the bug report for me J.

 

Vincenz

 


Von: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] Im Auftrag von Matthew Webster
Gesendet: Donnerstag, 2. März 2006 15:20
An: aspectj-users@xxxxxxxxxxx
Betreff: Re: [aspectj-users] perthis instantiation model aspects

 


Vincenz,

I believe this is a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=130119.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        <aspectj-users@xxxxxxxxxxx>
cc:        
Subject:        [aspectj-users] perthis instantiation model aspects


Hello,
 
I refactored an aspect using perthis instantiation type and faced a behaviour
I did not expected and I can not find a reason for. Could somebody show me the problem, please?
 
Take this simple interface:
 
public  interface A {
 
            public  void a();
}
 
And this class:
 
public class B implements A {
           
            public void a() {
                        System.out.println("in B");
            }
           
public static void main(String[] args) {
                        new B().a();
            }
}
 
Having this aspect:
public aspect TestAspect perthis(test(A)){
 
            // this does match at runtime with runtime test
            //pointcut test(A a): execution(public void A+.a()) && this(a);
           
            // this does not match at runtime with runtime test
            pointcut test(A a): execution(public void A.a()) && this(a);
           
            void around(A a): test(a) {
                        System.err.println(thisJoinPoint);
                        proceed(a);
            }
}
 
public aspect ExecutionAspect {
           
            // this does match
            //pointcut test(A a): execution(public void A+.a()) && this(a);
           
// this also does match
            pointcut test(A a): execution(public void A.a()) && this(a);
           
            void around(A a): test(a) {
                        System.err.println(thisJoinPoint);
                        proceed(a);
            }
}
 
I know I could simply drop the declaring type in the pointcut declaration.
But I “feel” the second pointcut declaration in the aspect using perthis instantiation model
should also work. Why is that not the case?

 
Thank you very much,
Vincenz_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top