@Alert(role="Manager")
@Alert(role="Administrator")
public class UnauthorizedAccessException { ... }
@Alert
annotation has to be meta-annotated with java.lang.annotation.Repeatable
.
Tools, which heavily rely on annotation processing may need to review their code to get ready for Java 8. Existing methods, such as AnnotatedElement.getAnnotations()
, have not been retrofitted to return repeatable annotations. Instead, other, new methods, such as AnnotatedElement.getAnnotationsByType(Class)
and AnnotatedElement.getDeclaredAnnotationsByType(Class)
have been added to the JDK, in order to be able to discover repeated annotations on any element.
More authoritative information can be found here:
- http://docs.oracle.com/javase/tutorial/java/annotations/repeating.html
- http://openjdk.java.net/jeps/120
- http://download.java.net/jdk8/docs/api/java/lang/reflect/AnnotatedElement.html
- http://download.java.net/jdk8/docs/api/java/lang/annotation/Repeatable.html
- http://cr.openjdk.java.net/~abuckley/8misc.pdf