Bug 364380 - Cannot use pointcut in @DeclareError; stack overflow
Summary: Cannot use pointcut in @DeclareError; stack overflow
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.12   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.7.0   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-21 11:46 EST by Jni CLA
Modified: 2011-11-22 14:32 EST (History)
2 users (show)

See Also:


Attachments
The ajcore with the stack overflow (178.56 KB, text/plain)
2011-11-21 11:46 EST, Jni CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.