Bug 114504 - pertarget conflict with !pointcut?
Summary: pertarget conflict with !pointcut?
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 07:27 EST by Wes Isberg CLA
Modified: 2005-11-24 03:32 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 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