Bug 54986 - AspectJ behaves radical different for execution joinpoints than AspectJ <1.0.6
Summary: AspectJ behaves radical different for execution joinpoints than AspectJ <1.0.6
Status: RESOLVED INVALID
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 1.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-16 13:24 EST by Arno Schmidmeier CLA
Modified: 2004-10-21 04:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arno Schmidmeier CLA 2004-03-16 13:24:33 EST
Hello,
I have one project which contains one class, the output of this project is on 
the classpath of the next. 

package de.aspectsoft.tests.subclasses;

import de.aspectsoft.tests.coretest.CoreObject;

/**
 * @author Arno Schmidmeier
 * 
 */
public class SubClassDemo extends CoreObject {

    public static void main(String[] args) {
        new SubClassDemo().foo();
        new SubClassDemo().toString();
        
        
        new MySubClass().foo();
        new MySubClass().toString();
    }
}


And a second project with the classes: 
package de.aspectsoft.tests.subclasses;


/**
 * @author Arno Schmidmeier
 * 
 */
public aspect SubClassDemoAspect {
    before():execution(public * SubClassDemo.*(..)){
        System.out.println("SubClassDemo+ execution(public * SubClassDemo.*
(..))"+thisJoinPoint);
    }

    before():execution(* *.*(..))&&this(SubClassDemo){
         System.out.println("SubClassDemo+ execution(* *.*(..))&&this
(SubClassDemo))"+thisJoinPoint);
    }


    before():execution(public * MySubClass.*(..)){
        System.out.println("SubClassDemo+ execution(public * SubClassDemo.*
(..))"+thisJoinPoint);
    }

    before():execution(* *.*(..))&&this(MySubClass){
         System.out.println("SubClassDemo+ execution(* *.*(..))&&this
(SubClassDemo))"+thisJoinPoint);
    }

}

package de.aspectsoft.tests.subclasses;

/**
 * @author Arno Schmidmeier
 * 
 */
public class MyCore {
    public void foo(){
    }
}

package de.aspectsoft.tests.subclasses;

/**
 * @author Arno Schmidmeier
 * 
 */
public class MySubClass extends MyCore{

}


Runing the second project generates following output.

SubClassDemo+ execution(public * SubClassDemo.*(..))execution(void 
de.aspectsoft.tests.subclasses.SubClassDemo.main(String[]))
SubClassDemo+ execution(* *.*(..))&&this(SubClassDemo))execution(void 
de.aspectsoft.tests.subclasses.MyCore.foo())

There are several execution Joinpoints missing.
e.g. all executions of to .toString()
e.g. the execution of SubClassDemo.foo();

Plattform AspectJ 1.1.6 form Ajdt 1.1.6 (development branch)
eclipse 2.1.1, windows XP and jdk 1.3

If you have some additional questions please do not hesitate to ask me.
Comment 1 Arno Schmidmeier CLA 2004-03-17 03:54:06 EST
AspectJ 1.1 behaves in the same way. 
Comment 2 Jim Hugunin CLA 2004-03-18 13:03:15 EST
It looks to me that your program is being handled correctly by AspectJ-1.1.1 
and I'd be surprised if this same program compiled in the same way would 
behave any differently under AspectJ-1.0.x.  Can you show what the output is 
that you get from AspectJ-1.0.x (specifying exactly which version) for 
compiling EXACTLY this same code?
Comment 3 Andrew Clement CLA 2004-08-06 05:26:52 EDT
I'm going to close this bug (reopen if it is still a problem).

execution() advice can only be affected on methods/ctors declarations that are
given to the AspectJ compiler for weaving.  In the code sample in the initial
bug report, the toString() is not implemented in any of the code we can see, so
presumably it is defaulting to using the toString() implementation on
java.lang.Object.  As java.lang.Object is not usually woven by the compiler, it
cannot affect advice that matches on execution() of toString(). (the join point
for execution() of toString() was never available for matching).  Similarly I
can't see the implementation of SubClassDemo().foo() so the join point is
probably not available for matching against execution() advice.  To match on the
toString() or foo() calls - use call() PCD instead.
Comment 4 Adrian Colyer CLA 2004-10-21 04:31:22 EDT
Fix released as part of AspectJ 1.2.1