diff options
Diffstat (limited to 'src/core/lombok/javac/JavacAnnotationHandler.java')
-rw-r--r-- | src/core/lombok/javac/JavacAnnotationHandler.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/lombok/javac/JavacAnnotationHandler.java b/src/core/lombok/javac/JavacAnnotationHandler.java index 434eab46..169e2026 100644 --- a/src/core/lombok/javac/JavacAnnotationHandler.java +++ b/src/core/lombok/javac/JavacAnnotationHandler.java @@ -24,6 +24,7 @@ package lombok.javac; import java.lang.annotation.Annotation; import lombok.core.AnnotationValues; +import lombok.core.SpiLoadUtil; import com.sun.tools.javac.tree.JCTree.JCAnnotation; @@ -53,4 +54,13 @@ public abstract class JavacAnnotationHandler<T extends Annotation> { * as access useful methods such as generating warnings or errors focused on the annotation. */ public abstract void handle(AnnotationValues<T> annotation, JCAnnotation ast, JavacNode annotationNode); + + /** + * This handler is a handler for the given annotation; you don't normally need to override this class + * as the annotation type is extracted from your {@code extends EclipseAnnotationHandler<AnnotationTypeHere>} + * signature. + */ + @SuppressWarnings("unchecked") public Class<T> getAnnotationHandledByThisHandler() { + return (Class<T>) SpiLoadUtil.findAnnotationClass(getClass(), JavacAnnotationHandler.class); + } } |