aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/javac/handlers/PKG.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/lombok/javac/handlers/PKG.java')
-rw-r--r--src/lombok/javac/handlers/PKG.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/lombok/javac/handlers/PKG.java b/src/lombok/javac/handlers/PKG.java
index 205a2b6e..bc5b691c 100644
--- a/src/lombok/javac/handlers/PKG.java
+++ b/src/lombok/javac/handlers/PKG.java
@@ -23,20 +23,22 @@ package lombok.javac.handlers;
import java.lang.reflect.Modifier;
+import lombok.AccessLevel;
+import lombok.core.TransformationsUtil;
+import lombok.core.AST.Kind;
+import lombok.javac.JavacAST;
+import lombok.javac.JavacAST.Node;
+
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.List;
-import lombok.AccessLevel;
-import lombok.core.TransformationsUtil;
-import lombok.core.AST.Kind;
-import lombok.javac.JavacAST;
-
/**
* Container for static utility methods relevant to this package.
*/
@@ -251,4 +253,17 @@ class PKG {
return e;
}
+
+ static JCAnnotation findNonNullAnnotation(Node fieldNode) {
+ for ( Node child : fieldNode.down() ) {
+ if ( child.getKind() == Kind.ANNOTATION ) {
+ JCAnnotation annotation = (JCAnnotation) child.get();
+ String name = annotation.annotationType.toString();
+ if (name.equals("NonNull") || name.endsWith(".NonNull")) {
+ return annotation;
+ }
+ }
+ }
+ return null;
+ }
}