Bug 114504

Summary: pertarget conflict with !pointcut?
Product: [Tools] AspectJ Reporter: Wes Isberg <wes>
Component: CompilerAssignee: Adrian Colyer <adrian.colyer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2    
Version: 1.5.0M4   
Target Milestone: 1.5.0RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Wes Isberg CLA 2005-11-01 07:27:37 EST
This is weird: comment out *either* marked line, and the aspect works.  But the
&&! pointcut seems to convince pertarget that there is no target.  Not true of
AspectJ 1.2.1.  (I can't believe it: it took me 2 hours to isolate this *smile*)

-------------------------------------------------------------
package bugs;

public class Temp {
	public static boolean passed;
	public static void main(String[] args) {
		SampleSeries me = new SampleSeries();
		me.okSeries();
		me.open();
		me.close();
		if (!passed) {
			throw new Error("failed to advise...");
		}
	}
	static class SampleSeries {
		void open() {}
		void close() {}
		void okSeries() {open(); close();}
	}
	static aspect AAAA 
	// comment this out, and !call(...) works
	pertarget(tracked())
	{
	    protected final pointcut tracked() : 
			call(void SampleSeries.*()) 
			// comment this out, and pertarget works...
			&& !call(void SampleSeries.*Series())
			;
		before() : tracked() {
			Temp.passed = true;
		}		
	}
}
Comment 1 Adrian Colyer CLA 2005-11-23 11:21:10 EST
This was caused by some optimisations added for @AspectJ to try and narrow down the number
of
places the ajc$mightHaveAspect interface is added. In this case it generates an erroneous
test
like:

(Temp.SampleSeries && !Temp.SampleSeries)

the visitor that builds the tests
wasn't
quite careful enough when it came to negatation. 

Waiting on build...

Comment 2 Adrian Colyer CLA 2005-11-24 03:32:52 EST
fix now available