Bug 169428 - No error is issued for using @DeclareParents inside a non-@Aspect class
Summary: No error is issued for using @DeclareParents inside a non-@Aspect class
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 major with 1 vote (vote)
Target Milestone: 1.5.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-03 08:52 EST by Ramnivas Laddad CLA
Modified: 2007-11-07 04:56 EST (History)
1 user (show)

See Also:


Attachments

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