diff options
author | Roel Spilker <r.spilker@gmail.com> | 2009-07-31 18:44:13 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2009-07-31 18:44:13 +0200 |
commit | 0cfa9e99d99fc353d0c486e96cc53f5214ab031c (patch) | |
tree | 5ea939bd0c1eec4a554786d95e32b3af23e1238c /src/lombok/javac/handlers/PKG.java | |
parent | 2bdc1210d7a26df8b69563f0de22524398ba9bfd (diff) | |
download | lombok-0cfa9e99d99fc353d0c486e96cc53f5214ab031c.tar.gz lombok-0cfa9e99d99fc353d0c486e96cc53f5214ab031c.tar.bz2 lombok-0cfa9e99d99fc353d0c486e96cc53f5214ab031c.zip |
Added support for @NonNull in the @Setter annotation
Diffstat (limited to 'src/lombok/javac/handlers/PKG.java')
-rw-r--r-- | src/lombok/javac/handlers/PKG.java | 25 |
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; + } } |