[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Execution pointcut semantics

Title: Message

I believe it actually has to do with a change in the Java VM semantics. I believe if you try this with AspectJ 5 on Java 1.3 or earlier (and probably with –target 1.3 too) you will reproduce the results in the paper.

 

See http://aosd.net/pipermail/discuss_aosd.net/2005-January/001324.html for a discussion about this from 14 months ago

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Jon S. Baekken
Sent: Friday, April 07, 2006 12:19 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Execution pointcut semantics

 

Thanks, that was useful reading.

 

I tried the same code examples as in the paper with AspectJ 1.5, and got the same results except for one case. The paper says that "[..] the pointcut call(void A3.g()) does not capture any join points in our example, not even s3.g()!" (page 2) and concludes from this that it is necessary for the method to be lexically defined within the specified class - inheritance is not enough. But when I tried this pointcut it did indeed match the call s3.g(). I don't know the reason for this, maybe a change in the semantics at some point in time...?

 

Jon

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Thiago Bartolomei
Sent: Thursday, April 06, 2006 4:26 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Execution pointcut semantics

Hi,

I think this paper may help you:

http://www.cs.iastate.edu/~leavens/FOAL/papers-2004/barzilay-etal.pdf

Basically, the difference is that call pointcuts semantics depend on the static types, whereas execution pointcuts depend on dynamic types. A more detailed explanation is in the paper (I read it a while ago). At least it was true for version 1.1.1, I haven't tested it with new versions...

Hope it helps,
Thiago Bartolomei

On 4/7/06, Jon S. Baekken < jbaekken@xxxxxxxxxxxx> wrote:

Yes, I've tried that, but it doesn't make me any wiser, as with the + I get
a superset of what I get without it, and without it I'm already matching
more than I expected.

Any AspectJ developers who know more on this?

Jon

-----Original Message-----
From: Ron DiFrango [mailto: aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of
Ron DiFrango
Sent: Thursday, April 06, 2006 12:32 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Execution pointcut semantics


Jon,

I am not sure what exact matching rules are coming into play, but did you
try something like the following:

pointcut p() : execution(public void Class0+.m());


This should pickup the execution of any call to this method in any object in
Class0's heirarchy.

I think by matching, at the Class1 level even though it is inherit limits it
to the Class1.  One of hte aspectj developers would be able to give a better
explanation than I.

Ron

  _____

From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Jon S. Baekken
Sent: Thu 4/6/2006 3:07 PM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Execution pointcut semantics



Folks,

I wondered if somebody could explain the semantics of the execution pointcut
in the context of inheritance. Consider the following example.

public class Class0 {
        public void m() {
                System.out.println("m");
        }
}

public class Class1 extends Class0 {
}

public class Class2 extends Class1 {
}

public class Client {
        public static void main(String[] args) {
                Class2 c = new Class2();
                c.m();
        }
}

public aspect A {
        pointcut p() : execution(public void Class1.m());
        before() : p() {
                System.out.println(thisJoinPoint);
        }
}

When running this example, p() does not match the execution of c.m(). Notice
that Class1 is the class specified in the pointcut, and that m() is not
declared in Class1. However, Class1 inherits m() from Class0, and so does
Class2. A call pointcut would match in this situation, so there is obviously
a difference in the semantics of the two.

What confuses me though, is that if we add m() to Class2:

public class Class2 extends Class1 {
        public void m() {
                System.out.println("m");
        }
}

The pointcut p() matches. But this happens only if both Class0 and Class2
declares m(), not just one of them. Why is this, and what is the matching
rule coming into play here? Is it overriding that somehow is the key?

Jon

http://www.eecs.wsu.edu/~jbaekken/


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users