[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-dev] The type of advice arguments should equal the one of pointcut
|
How about modifying AnAspect as follows:
aspect AnAspect {
before(Bar bar)
: APointcut.aPointcut(Foo) && target(bar) {
bar.n();
}
}
-Ramnivas
--- Susumu YAMAZAKI <yamazaki@xxxxxxxxxxxxxxx> wrote:
> 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>
=====
Ramnivas Laddad
Author, AspectJ in Action
http://www.manning.com/laddad
http://www.amazon.com/exec/obidos/ASIN/1930110936
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com