Bug 78055 - False ambiguity error in AspectJ Pointcut definition
Summary: False ambiguity error in AspectJ Pointcut definition
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2.1   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 1.5.0   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-08 05:26 EST by Maximilian Stoerzer CLA
Modified: 2006-05-30 09:10 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maximilian Stoerzer CLA 2004-11-08 05:26:25 EST
Hi all,

the simple pointcut definition below does not compile, as the compiler claims
the binding of the this-argument is ambiguous. However, this binding is sound,
reference theRefObj is bound to exactly one variable in each case.

Error message is:  "Ambiguous binding of type PointcutBinding using args(..) at
this line - formal is already bound.  See secondary source location for location
of args(..)".


public aspect PointcutBinding {
	public void method_1(String arg2) {
		System.out.println("method1:String");
	}
	public void method_2(PointcutBinding rep, String arg2) {
		System.out.println("method2:PointcutBinding, String");
	}
	public pointcut _pc(String aParameter, PointcutBinding theRefObj) :
	        (execution (public void method_1(String)) && args(aParameter) &&
this(theRefObj)) ||
	        (execution (public void method_2(PointcutBinding, String)) 
	        		&& args(theRefObj, aParameter) && this(PointcutBinding));
	before(String arg1, PointcutBinding refObj) :  _pc(arg1, refObj) {
		System.out.println("advice");
	}
}

Best regards,
Comment 1 Andrew Clement CLA 2006-05-30 09:10:41 EDT
Confirmed fixed by the pointcut rewriter in AspectJ5.  the binding behaves as expected.