Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] bug with pertarget ?

Hi all,

I have encountered something strange and i'm wondering if its a bug or simply my misunderstanding. The test case is:

> public aspect taspect pertarget(call(test.new(..))) {
>    after() : call(* *.*(..)) && !within(taspect) {
>      System.err.println("GOT HERE");
> }  }
>
> public class test {
>    int aField;
>    void aMethod() { aField = 0; }
>
>    public static void main(String argv[]) {
>	System.err.println("BEFORE");
>	test t = new test();
>	t.aMethod();
>	System.err.println("AFTER");
> }  }

Observed Output:

> BEFORE
> AFTER

But, I expected to see "GOT HERE" as well. What is more, if a change the first line to:

> public aspect taspect pertarget(initialization(test.new(..))) {

Then I do see "GOT HERE". But, I don't understand why the first one does not work ??

Cheers,

Dave


Back to the top