Community
Participate
Working Groups
Advice not applied in subaspect using parameterized superaspect pointcut without qualifying with type parameter. Declare error using same locution works. Doc ambiguous: "All references to a pointcut declared in a generic type from outside of that type must be via a parameterized type reference, and not a raw type reference." I get no compiler error in either case, so perhaps "outside of that type or subtypes." But can't interfaces can be parameterized and pointcuts declared on interfaces? Eek! This was disconcerting because the declare warning showed the pointcut was correct, but still the advice was not being applied. (My initial aspect was a perthis(), so I thought that was the problem.) Not sure if this is treated by bug 112105 or any other generics bugs (is there a tag for them?) ------------------------------------------------------- package bugs; public class ParameterizedTypeInPointcut { public static void main(String[] args) { C.go(); } static class C { static void go() {} } } abstract aspect AA_ParameterizedTypeInPointcut<Target> { pointcut going() :call(void Target.go()) ; before() : going() { System.out.println("AA.going()"); } } aspect A_ParameterizedTypeInPointcut extends AA_ParameterizedTypeInPointcut<ParameterizedTypeInPointcut.C>{ declare warning : going() : "going()"; // works fine before() : going() { // advice not applied System.out.println("A.going()"); } }
I should add my original case is more like abstract aspect A1 { abstract pointcut pc(); before() : pc() {} } abstract aspect A2<T> { abstract pointcut foo(); pointcut pc() : call(void T.go()) && foo(); } aspect A extends A2<C> { pointcut foo() : if(true); }
Just a quick note. Bug 112105 is really for ITDs rather than pointcuts. I don't know of another bug open relating just to generic pointcut problems.
The logic that collected advice members from aspects was missing the code to walk up the hierarchy looking for parameterized supertypes when deciding whether or not parameterization was necessary (the declare collecting logic *did* have this fix in). Solution was to look up the hierarchy when collecting advice too. Bug would have affected any advice in a concrete sub-aspect using a pointcut declared in a parameterized super-aspect where the pointcut used a type parameter.
fix checked in, waiting on build...
fix now available