Bug 114495 - unqualified superaspect<T> pointcut sortafunny in subaspect
Summary: unqualified superaspect<T> pointcut sortafunny in subaspect
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M4   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-01 05:43 EST by Wes Isberg CLA
Modified: 2005-11-24 03:37 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Isberg CLA 2005-11-01 05:43:00 EST
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()");
	}
}
Comment 1 Wes Isberg CLA 2005-11-01 06:03:06 EST
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);
}
Comment 2 Andrew Clement CLA 2005-11-01 06:09:12 EST
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.
Comment 3 Adrian Colyer CLA 2005-11-23 14:01:12 EST
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.
Comment 4 Adrian Colyer CLA 2005-11-23 14:21:31 EST
fix checked in, waiting on build...
Comment 5 Adrian Colyer CLA 2005-11-24 03:37:00 EST
fix now available