Community
Participate
Working Groups
If I have these classes: class A { Number foo(); } class B extends A { Integer foo(); } and I now have this aspect: aspect X { Number around(A a): call(Number A.foo()) && target(a) { Number num = proceed(); return num; } } I'm going to get an error trying to weave the code. The problem is that there is (apparently) no way to express that the around advice is going to return a different type, depending on the type foo() returns. I.e. in pseudosyntax: <T extends Number> T around(A a): call(T A.foo()) && target(a) { ... }
You can generalize the advice to just Object return and it will successfully advise both. But that is just a workaround.