Bug 237381 - @DeclareWarning and @DeclareError not working in code style aspect---can't mix annotation style with code style
Summary: @DeclareWarning and @DeclareError not working in code style aspect---can't mi...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.6.1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-16 17:52 EDT by Andrew Eisenberg CLA
Modified: 2008-06-17 16:29 EDT (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 Andrew Eisenberg CLA 2008-06-16 17:52:38 EDT
The following should raise an error on the foo() method, but does not:

import org.aspectj.lang.annotation.DeclareWarning;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public aspect A {
	@DeclareWarning("execution(void *.foo(..))")
	static final String h = "barf";
	void foo() { }
}


The following does work as expected:
import org.aspectj.lang.annotation.DeclareWarning;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class A {
	@DeclareWarning("execution(void *.foo(..))")
	static final String h = "barf";
	void foo() { }
}

so it seems like it is not possibleto mix @AspectJ style declares in code style aspects.
Comment 1 Andrew Clement CLA 2008-06-17 16:29:56 EDT
this was actually policed by the compiler to behave in this way.  I've changed it to allow it - I am concerned a little about performance but we do seem to check the constant pool for references to any kind of annotation before doing a detailed analysis of whether every method is a pointcut or an advice or deow, etc.

it is not common to mix things up in this way, in fact I'd have thought the other way round was more likely (@Aspect on the class then code style syntax inside, as that may keep other parts of JDT happier whilst you are editing a mostly regular class).