From 79bfcc4f7ae4bcd61f7f942bfefb940c77927b71 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 27 Aug 2018 18:36:13 -0400 Subject: Add configuration key, handle whereever NULLABLE is handled, support Eclipse. --- src/core/lombok/javac/handlers/JavacHandlerUtil.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java') diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 92c642d4..cb729183 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -1335,6 +1335,23 @@ public class JavacHandlerUtil { return result.toList(); } + /** + * Searches the given field node for annotations and returns each one that matches the provided list of names. + */ + public static List findExactAnnotations(JavacNode fieldNode, java.util.List names) { + ListBuffer result = new ListBuffer(); + for (JavacNode child : fieldNode.down()) { + if (child.getKind() == Kind.ANNOTATION) { + JCAnnotation annotation = (JCAnnotation) child.get(); + String annoname = annotation.annotationType.toString(); + if (names.contains(annoname)) { + result.append(annotation); + } + } + } + return result.toList(); + } + /** * Generates a new statement that checks if the given variable is null, and if so, throws a configured exception with the * variable name as message. -- cgit