aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/eclipse/handlers/PKG.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2009-07-31 18:44:13 +0200
committerRoel Spilker <r.spilker@gmail.com>2009-07-31 18:44:13 +0200
commit0cfa9e99d99fc353d0c486e96cc53f5214ab031c (patch)
tree5ea939bd0c1eec4a554786d95e32b3af23e1238c /src/lombok/eclipse/handlers/PKG.java
parent2bdc1210d7a26df8b69563f0de22524398ba9bfd (diff)
downloadlombok-0cfa9e99d99fc353d0c486e96cc53f5214ab031c.tar.gz
lombok-0cfa9e99d99fc353d0c486e96cc53f5214ab031c.tar.bz2
lombok-0cfa9e99d99fc353d0c486e96cc53f5214ab031c.zip
Added support for @NonNull in the @Setter annotation
Diffstat (limited to 'src/lombok/eclipse/handlers/PKG.java')
-rw-r--r--src/lombok/eclipse/handlers/PKG.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lombok/eclipse/handlers/PKG.java b/src/lombok/eclipse/handlers/PKG.java
index 7fdf7afd..db38e3df 100644
--- a/src/lombok/eclipse/handlers/PKG.java
+++ b/src/lombok/eclipse/handlers/PKG.java
@@ -29,9 +29,11 @@ import lombok.eclipse.EclipseAST;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
class PKG {
private PKG() {}
@@ -212,4 +214,17 @@ class PKG {
type.add(method, Kind.METHOD).recursiveSetHandled();
}
+
+ static Annotation findNonNullannotation(FieldDeclaration field) {
+ for (Annotation annotation : field.annotations) {
+ TypeReference typeRef = annotation.type;
+ if ( typeRef != null && typeRef.getTypeName()!= null ) {
+ char[][] typeName = typeRef.getTypeName();
+ if (new String(typeName[typeName.length - 1]).equals("NonNull")) {
+ return annotation;
+ }
+ }
+ }
+ return null;
+ }
}