Bug 64238

Summary: Regression or change of language definition when compiling aspect
Product: [Tools] AspectJ Reporter: Macneil Shonle <mshonle>
Component: CompilerAssignee: Adrian Colyer <adrian.colyer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.2   
Target Milestone: 1.5.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Macneil Shonle CLA 2004-05-26 18:01:25 EDT
The below code is a simplification of an event listener style poincut
interface: (See below for a description of the bug itself.)

public class AnyoneListening {
	public static void main(String[] args) {
		AnyoneListening a = new AnyoneListening();
		Util u = new Util();
		a.doStuff(u);
	}
	
	public void doStuff(Util u) {
		notifyUtilUsed(u);
	}
	
	private void notifyUtilUsed(Util u) {/*intentionally left blank*/}
	public pointcut utilUsed(AnyoneListening al, Util u):
		this(al) && args(u) && execution(void AnyoneListening.doStuff
(Util));
	
	private void notifyUtilLookedAt(Util u) {/*intentionally left blank*/}
	public pointcut utilLookedAt(AnyoneListening al, Util u):
		execution(void AnyoneListening.notifyUtilLookedAt(Util))
		&& this(al) && args(u);
	
	public pointcut utilTouched(AnyoneListening al, Util u):
		utilUsed(al, u) || utilLookedAt(al, u);
}

class Util {
}

aspect Observer {
	before(AnyoneListening al, Util u): AnyoneListening.utilTouched(al, u) {
		System.out.println("Someone used it");
	}
}

//////////////////

This code compiles fine with ajc 1.1.1, but under 1.2 I get the following
error message:

Ambiguous binding of type Util using args(..) at this line.  Use one args(..) 
per matched join point, see secondary source location for location of 
extraneous args(..).

It worked in 1.1.1, and supposedly 1.2 didn't change the semantics of the
language, thus I file. :-)
Comment 1 Andrew Clement CLA 2004-05-27 03:32:20 EDT
I'll just point out the bug that caused the introduction of this new message,
bug 61568.
Comment 2 Andrew Clement CLA 2006-05-30 04:15:59 EDT
pointcut rewriting in AspectJ5 means the program compiles fine now.