diff options
author | Werner Dietl <wdietl@gmail.com> | 2018-08-27 18:36:13 -0400 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-09-11 01:59:19 +0200 |
commit | 79bfcc4f7ae4bcd61f7f942bfefb940c77927b71 (patch) | |
tree | 382b77e1806bd3513dc8f49b009e1aa23cc4dd2d /src/core/lombok/javac/handlers/JavacHandlerUtil.java | |
parent | 7a575e1e5d1c78fa5be1deca7fc308bd9eb390dd (diff) | |
download | lombok-79bfcc4f7ae4bcd61f7f942bfefb940c77927b71.tar.gz lombok-79bfcc4f7ae4bcd61f7f942bfefb940c77927b71.tar.bz2 lombok-79bfcc4f7ae4bcd61f7f942bfefb940c77927b71.zip |
Add configuration key, handle whereever NULLABLE is handled, support Eclipse.
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ -1336,6 +1336,23 @@ public class JavacHandlerUtil { } /** + * Searches the given field node for annotations and returns each one that matches the provided list of names. + */ + public static List<JCAnnotation> findExactAnnotations(JavacNode fieldNode, java.util.List<String> names) { + ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>(); + 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. */ |