Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364380

Summary: Cannot use pointcut in @DeclareError; stack overflow
Product: [Tools] AspectJ Reporter: Jni <jni.viens>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement, jni.viens
Version: 1.6.12   
Target Milestone: 1.7.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
The ajcore with the stack overflow none

Description Jni CLA 2011-11-21 11:46:22 EST
Created attachment 207317 [details]
The ajcore with the stack overflow

Hi, 

Here are 2 aspects with the same pointcut : 

#####################
@Aspect
public class OwnershipSecurityAspect {

	@DeclareError("myPcut()") 
	public static final String securityError = "An advice already exists for setting an owner";
	
	@Pointcut("call(public void ca..setOwner(..)) && !within(ca..OwnershipSecurityAspect) && !within(ca..*Test)")
	protected void myPcut() {}
	
}
#####################
@Aspect
public class OwnershipSecurityAspect {

	@DeclareError("call(public void ca..setOwner(..)) && !within(ca..OwnershipSecurityAspect) && !within(ca..*Test)") 
	public static final String securityError = "An advice already exists for setting an owner";
}
#####################

Those are classes in my project. If i use the first one, I get a stack overflow. In fact, I get it only once. For example "mvn clean jetty:run" will produce an error the first time "jetty:run" is ran after a clean, i.e. "mvn clean" (works) --> "mvn jetty:run" (crashes) --> "mvn jetty:run" (works). 

However, when I use the second version, it never crashes, even after a "mvn clean". The pointcut is the same, just placed elsewhere. We use CTW.

Complete ajcore is attached.

Thanks,
Jni
Comment 1 Andrew Clement CLA 2011-11-22 14:32:56 EST
fixed, it was a circular set of calls attempting to resolve the same thing over and over because it didn't notice the type declaring the pointcut was the same as the type containing the declare.