Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] More simple questions

Hello, I posted "A very simple question" a week or so ago.  I was asking how 
to obtain a reference to an instance of the object that a pointcut targets.  
Ron Bodkin posted this example:

pointcut p(Foo foo) : execution(public void com.Foo.doThis(..)) && this(foo);

after(Foo foo) : p(foo) {
  // foo is the currently executing object at the join point
  // picked out by p
  foo.doSomething();
}

I rewrote my aspect in the above form and it still doesn't work.  Here is 
mine:
    public aspect TestAspect {
        pointcut p(WP wp) : 
            execution(public void com.wp.WP.setText(String)) && this(wp);
        
        after(WP wp) : p(wp) {
            wp.setText("This is TestAspect calling!");
        }
    }

WP is a text editing component.

Here is the error from ajc:
    /com/wp/TestAspect.java:15 error WP cannot be resolved (or is not a valid 
type) for the argument wp of the method ajc$pointcut$$p$1b1
    pointcut p(WP wp) : 
               
    /com/wp/TestAspect.java:18 error WP cannot be resolved (or is not a valid 
type) for the argument wp of the method ajc$after$com_wp_TestAspect$1$63e43b8
    after(WP wp) : p(wp) {


My system is:
    Mac OSX 10.2.8
    Java 1.4.1
    AspectJ 1.2




Back to the top