Bug 169428

Summary: No error is issued for using @DeclareParents inside a non-@Aspect class
Product: [Tools] AspectJ Reporter: Ramnivas Laddad <ramnivas>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: aclement
Version: DEVELOPMENT   
Target Milestone: 1.5.4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ramnivas Laddad CLA 2007-01-03 08:52:12 EST
AJDT: 1.5.0.200612220629
AJ: 1.5.3.200612081116

Unlike @Before() etc., there is no error issued for including a @DeclareParents 
inside a class without an @Aspect annotation.

For example, the following code compiles just fine with 'ajc' (through AJDT):
// Note no @Aspect
public class AnAspect {
	@DeclareParents("test.*")
	public java.io.Serializable s;
}

Of course, while it compiles fine, there is no effect of such statement and that can lead to surprises (for example, I kept rechecking my type pattern).
Comment 1 Andrew Clement CLA 2007-11-07 04:56:44 EST
fixes and test committed, new error is:

"DeclareParents can only be used inside an aspect type"

Interestingly you get a hideous error in the case of code style aspects if you specify declare parents inside a non-aspect, but that needs grammar changes to fix.