Bug 325092

Summary: Feature Request: Pointcut selector for Meta Annotation Type.
Product: [Tools] AspectJ Reporter: Marko Umek <marko.umek>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: aclement, eclipsebugs
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Marko Umek CLA 2010-09-13 05:33:33 EDT
Build Identifier: 

For example: I'd like to select all methods which are marked by a Annotation which are itself have a been annotated by a specific (meta) annotation type.

Example: I've a meta annotation like SeverityLevelAnnotation and some Annotation which are using SeverityLevelAnnotation (it's somehow a kind of annotation derivation). All methods which are marked with @Warning (see below) , @Info, ... should be selected, without explicit naming these "derived" annotations.

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
@SeverityLevelAnnotation(text = SeverityLevels.WARNING_TEXT, severityLevel = SeverityLevels.WARNING, filterLevel = FilterLevel.WARNING)
public @interface Warning {
	String value() default "";
}

The proposed pointcut definition could be like this:

pointcut allSeverityLevels() : execution(* *.*(..)) && @annotation(SeverityLevelAnnotation+);

or

pointcut allSeverityLevels(SeverityLevelAnnotation+ sevrityLevel) : execution(* *.*(..)) && @annotation(sevrityLevel);



Reproducible: Always
Comment 1 Carlos Vara CLA 2010-10-08 10:46:03 EDT
I am also very interested in this functionality. It will greatly reduce the amount of boiler plate code (declaring new pointcut definitions for every annotation that contains the meta-annotation) that needs to be added at the moment.

Big +1 here to this.
Comment 2 Andrew Clement CLA 2013-06-24 11:04:06 EDT
unsetting the target field which is currently set for something already released