Community
Participate
Working Groups
Assuming (without adk15 objection) that parameterized aspects can be instantiated per-object, I am not seeing an aspectOf(..) method, only aspectof(). Not true of unparameterized types. -------------------------------------------------------- public class PerTarget { public static void main(String[] args) { C c = new C(); c.go(); A a = A.aspectOf(c); // ok, illegal - aspectOf only on concrete aspects? // AA aa = AA.aspectOf(c); // hmm - n/a for parameterized types? //CAPT capt = CAPT.aspectOf(c); // unexpected compile error here //System.out.println("A " + a + " capt " + capt); } static class C { void go() {} } abstract static aspect AA pertarget(pc()) { abstract pointcut pc(); before() : pc() { System.out.println("go()"); } } static aspect A extends AA { pointcut pc() : call(void C.go()); } abstract static aspect APT<T> pertarget(pc()) { abstract pointcut pc(); before() : pc() { System.out.println("go()"); } } static aspect CAPT extends APT<C> { pointcut pc() : call(void C.go()); } }
I think it is generating an aspectOf() - the problem is the type checking during compilation isn't able to *see* the aspectOf(), it is probably asking the wrong object (maybe the generic type, when the aspectOf is on the parameterized form).
oops - spoke too soon, aspectOf() that is generated isnt quite right...
What a can of worms!! The problem was that we werent correctly looking up the perclause of the super aspect if it was a parameterized type - I added the logic for this. Without this we default to persingleton(). This then revealed some problems with @AJ processing of per clauses - I am concerned that we test whether a class is 'AnnotationStyleAspect' by checking for the existence of the 'Aspect' annotation - because we have a visitor that runs over any code style aspect and adds those annotations. I haven't fixed this problem but merely fixed up the handling of perclauses to be correct (at least correct enough for all our existing testcases). fix checked in.
fix available.