diff options
author | Jan Rieke <rieke@subshell.com> | 2018-09-24 16:46:00 +0200 |
---|---|---|
committer | Jan Rieke <rieke@subshell.com> | 2018-09-24 16:46:00 +0200 |
commit | b5648976b6501bdf755814d8d8a096c33f6997ec (patch) | |
tree | aafe939cdc6fdda41719deb42f03c77934cb5209 /src/core/lombok/javac/handlers/HandleWither.java | |
parent | fd4c9d4bff6e75b30a3ee247edafaabc6888a691 (diff) | |
parent | aee4e76d864e01b5d453409e703ad54852fa57bb (diff) | |
download | lombok-b5648976b6501bdf755814d8d8a096c33f6997ec.tar.gz lombok-b5648976b6501bdf755814d8d8a096c33f6997ec.tar.bz2 lombok-b5648976b6501bdf755814d8d8a096c33f6997ec.zip |
Merge remote-tracking branch 'upstream/master' into superToBuilder
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleWither.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleWither.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/HandleWither.java b/src/core/lombok/javac/handlers/HandleWither.java index 87f3c16a..33c4dec2 100644 --- a/src/core/lombok/javac/handlers/HandleWither.java +++ b/src/core/lombok/javac/handlers/HandleWither.java @@ -222,8 +222,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> { JCVariableDecl fieldDecl = (JCVariableDecl) field.get(); - List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN); - List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN); + List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(field); Name methodName = field.toName(witherName); @@ -231,7 +230,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> { JCBlock methodBody = null; long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext()); - List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables); + List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(copyableAnnotations); JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null); @@ -264,7 +263,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> { JCConditional conditional = maker.Conditional(identityCheck, maker.Ident(field.toName("this")), newClass); JCReturn returnStatement = maker.Return(conditional); - if (nonNulls.isEmpty()) { + if (!hasNonNullAnnotations(field)) { statements.append(returnStatement); } else { JCStatement nullCheck = generateNullCheck(maker, field, source); |