Bug 325092 - Feature Request: Pointcut selector for Meta Annotation Type.
Summary: Feature Request: Pointcut selector for Meta Annotation Type.
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-13 05:33 EDT by Marko Umek CLA
Modified: 2013-06-24 11:04 EDT (History)
2 users (show)

See Also:


Attachments

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