aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/eclipse/handlers/PKG.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2009-08-01 01:42:52 +0200
committerRoel Spilker <r.spilker@gmail.com>2009-08-01 01:42:52 +0200
commitf2c837bb47771a7eba5ad5a885af162d8d133559 (patch)
tree23be7f4b58a82b3c573edcd0e927d55cb4c7a290 /src/lombok/eclipse/handlers/PKG.java
parent0cfa9e99d99fc353d0c486e96cc53f5214ab031c (diff)
downloadlombok-f2c837bb47771a7eba5ad5a885af162d8d133559.tar.gz
lombok-f2c837bb47771a7eba5ad5a885af162d8d133559.tar.bz2
lombok-f2c837bb47771a7eba5ad5a885af162d8d133559.zip
@Setter will copy all NotNull and NonNull (case-insensitive) annotations to the parameter
@Getter will copy them to the getter method Added @NonNull to lombok to support null-checks in the setter
Diffstat (limited to 'src/lombok/eclipse/handlers/PKG.java')
-rw-r--r--src/lombok/eclipse/handlers/PKG.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lombok/eclipse/handlers/PKG.java b/src/lombok/eclipse/handlers/PKG.java
index db38e3df..6d524e8c 100644
--- a/src/lombok/eclipse/handlers/PKG.java
+++ b/src/lombok/eclipse/handlers/PKG.java
@@ -22,6 +22,8 @@
package lombok.eclipse.handlers;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
import lombok.AccessLevel;
import lombok.core.AST.Kind;
@@ -215,16 +217,18 @@ class PKG {
type.add(method, Kind.METHOD).recursiveSetHandled();
}
- static Annotation findNonNullannotation(FieldDeclaration field) {
+ static Annotation[] findNonNullAnnotations(FieldDeclaration field) {
+ List<Annotation> result = new ArrayList<Annotation>();
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;
+ String suspect = new String(typeName[typeName.length - 1]);
+ if (suspect.equalsIgnoreCase("NonNull") || suspect.equalsIgnoreCase("NotNull")) {
+ result.add(annotation);
}
}
}
- return null;
+ return result.toArray(new Annotation[0]);
}
}