aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/javac/handlers/HandleData.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-08-27 23:05:14 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-08-27 23:05:14 +0200
commitfe0da3f53f1e88b704e21463cc5fea3d998e394a (patch)
treefa97c0d94a562dd7dd862a5d8e6e2f1ac432d060 /src/lombok/javac/handlers/HandleData.java
parente6bb460e2b1ba49698e5306ddcb5ce38748e2dfc (diff)
downloadlombok-fe0da3f53f1e88b704e21463cc5fea3d998e394a.tar.gz
lombok-fe0da3f53f1e88b704e21463cc5fea3d998e394a.tar.bz2
lombok-fe0da3f53f1e88b704e21463cc5fea3d998e394a.zip
Now @Nullable is also copied over.
Diffstat (limited to 'src/lombok/javac/handlers/HandleData.java')
-rw-r--r--src/lombok/javac/handlers/HandleData.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lombok/javac/handlers/HandleData.java b/src/lombok/javac/handlers/HandleData.java
index e65462d8..648ff91e 100644
--- a/src/lombok/javac/handlers/HandleData.java
+++ b/src/lombok/javac/handlers/HandleData.java
@@ -79,7 +79,7 @@ public class HandleData implements JavacAnnotationHandler<Data> {
if ( (fieldFlags & Flags.STATIC) != 0 ) continue;
if ( (fieldFlags & Flags.TRANSIENT) == 0 ) nodesForEquality = nodesForEquality.append(child);
boolean isFinal = (fieldFlags & Flags.FINAL) != 0;
- boolean isNonNull = !findNonNullAnnotations(child).isEmpty();
+ boolean isNonNull = !findAnnotations(child, NON_NULL_PATTERN).isEmpty();
if ( (isFinal || isNonNull) && fieldDecl.init == null ) nodesForConstructor = nodesForConstructor.append(child);
new HandleGetter().generateGetterForField(child, annotationNode.get());
if ( !isFinal ) new HandleSetter().generateSetterForField(child, annotationNode.get());
@@ -114,8 +114,9 @@ public class HandleData implements JavacAnnotationHandler<Data> {
for ( Node fieldNode : fields ) {
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
- List<JCAnnotation> nonNulls = findNonNullAnnotations(fieldNode);
- JCVariableDecl param = maker.VarDef(maker.Modifiers(0, nonNulls), field.name, field.vartype, null);
+ List<JCAnnotation> nonNulls = findAnnotations(fieldNode, NON_NULL_PATTERN);
+ List<JCAnnotation> nullables = findAnnotations(fieldNode, NULLABLE_PATTERN);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(0, nonNulls.appendList(nullables)), field.name, field.vartype, null);
params = params.append(param);
JCFieldAccess thisX = maker.Select(maker.Ident(fieldNode.toName("this")), field.name);
@@ -169,7 +170,10 @@ public class HandleData implements JavacAnnotationHandler<Data> {
for ( JCExpression arg : typeApply.arguments ) tArgs = tArgs.append(arg);
pType = maker.TypeApply(typeApply.clazz, tArgs);
} else pType = field.vartype;
- JCVariableDecl param = maker.VarDef(maker.Modifiers(0, findNonNullAnnotations(fieldNode)), field.name, pType, null);
+
+ List<JCAnnotation> nonNulls = findAnnotations(fieldNode, NON_NULL_PATTERN);
+ List<JCAnnotation> nullables = findAnnotations(fieldNode, NULLABLE_PATTERN);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(0, nonNulls.appendList(nullables)), field.name, pType, null);
params = params.append(param);
args = args.append(maker.Ident(field.name));
}