Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] The type of advice arguments should equal the one of pointcut

Dear all,

I feel inconvenient to have to write as the following to call the
method n:

aspect APointcut {
    pointcut aPointcut(Foo foo) 
        : execution(int Foo+.m()) && target(foo);
}

aspect AnAspect {
    before(Foo foo)
        : APointcut.aPointcut(foo) && target(Bar) {
	 Bar bar = (Bar)foo; // Inconvenient!
	 bar.n();
    }
}

class Foo {
    void m() {...}
}

class Bar extends Foo {
    void m() {...}
    void n() {...}
}

I want to rewrite AnAspect as the following, but the current AspectJ
does not allow this:

aspect AnAspect {
    before(Bar bar)
        : APointcut.aPointcut(bar) && target(Bar) {
	 bar.n();
    }
}

Thanks,

Susumu YAMAZAKI <yamazaki@xxxxxxxxxxxxxxx>


Back to the top