Bug 239042

Summary: NPE when compiling !pointcut
Product: [Tools] AspectJ Reporter: R. Koo <reema_koo>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: 1.5.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description R. Koo CLA 2008-06-30 15:24:10 EDT
+++ This bug was initially created as a clone of Bug #162657 +++

java.lang.NullPointerException
at org.aspectj.weaver.bcel.BcelWeaver.raiseAmbiguityInDisjunctionError(BcelWeaver.java:822)
at org.aspectj.weaver.bcel.BcelWeaver.validateOrBranch(BcelWeaver.java:663)
at org.aspectj.weaver.bcel.BcelWeaver.validateBindings(BcelWeaver.java:623)
at org.aspectj.weaver.bcel.BcelWeaver.rewritePointcuts(BcelWeaver.java:561)
at org.aspectj.weaver.bcel.BcelWeaver.prepareForWeave(BcelWeaver.java:483)
at org.aspect ... pter.java:107)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

NullPointerException thrown: null


-------------------------------------------------

Looks like this bug is back in version 1.5.4 and 1.6.0. I just tried upgrading from 1.5.3 and I ran into this issue. I went through my offending aspect and remove all the !within(...) statements, and the aspect compiled just fine.
Comment 1 Andrew Clement CLA 2008-06-30 16:48:20 EDT
can you possibly tell me what level of code you used to create that stack trace.  Or is that just the old stack trace from the other bug pasted in?  That stack trace only means something on 1.5.3 aspectj.

The test program attached to 162657 is:
====
public aspect TestAspect {
	private pointcut inTest(): within(TestComp);
	
	private pointcut inAdd(BaseModel m): inTest() &&
		execution(public BaseModel+ BaseComp+.add*(BaseModel+)) &&
		args(m);
	
	private pointcut inGetSearchByObj(BaseModel m): inTest() &&
		(execution(public * BaseComp+.get*(BaseModel+)) ||
		execution(public * BaseComp+.search*(BaseModel+))) &&
		args(m);

	private pointcut inGrate():
	(execution(public * BaseComp+.get*(BaseModel+)) ||
	execution(public * BaseComp+.search*(BaseModel+)));
	
	private pointcut inUpdate(BaseModel m): inTest() &&
		execution(public * BaseComp+.*(BaseModel+)) &&
		args(m) && !inAdd(BaseModel) && !inGrate();
	
	before(BaseModel m): inUpdate(m) {	}
}


abstract class BaseComp { }
abstract class BaseModel {}
class TestComp {}

===
And it has been running fine since put into the test suite.

Can you tell me how your pointcuts differ from that?  Or can you give me an up to date stack trace for the failure (either at 1.5.4 or 1.6.0 but preferably at the 1.6.1rc1 level of AspectJ)?  Clearly it can't be with !pointcuts in general as 1000s of test programs are using them, so it must be something unusual with how your pointcuts are formed.  if you let me know, I will try and fix it for 1.6.1 final.
Comment 2 R. Koo CLA 2008-06-30 20:01:02 EDT
I just tried with 1.6.1rc1 and it looks like the problem is gone.  I'll close the bug.