aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-01-20 15:25:08 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-01-28 16:21:39 +0100
commite95680a76733c22ee5937a586ee50c703d5ba621 (patch)
tree3eaefce07c41760468c3c2a17c86297e2304a730 /src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
parentfa70b194aa7db62bdbc4cc759a606f97fe50fc92 (diff)
downloadlombok-e95680a76733c22ee5937a586ee50c703d5ba621.tar.gz
lombok-e95680a76733c22ee5937a586ee50c703d5ba621.tar.bz2
lombok-e95680a76733c22ee5937a586ee50c703d5ba621.zip
[issue #2221] [issue #788] Lombok now adds nullity annotations.
Which 'flavour' is defined in lombok.config; applied to toString, equals, canEqual, and plural-form of `@Singular`.
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java')
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java b/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
index 5fe4b958..cbbd4cc8 100755
--- a/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
+++ b/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
@@ -35,6 +35,7 @@ import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.Block;
import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
@@ -437,7 +438,7 @@ public class EclipseSingularsRecipes {
}
}
- protected void nullBehaviorize(SingularData data, List<Statement> statements) {
+ protected void nullBehaviorize(EclipseNode typeNode, SingularData data, List<Statement> statements, Argument arg) {
NullCollectionBehavior behavior = data.getNullCollectionBehavior();
if (behavior == NullCollectionBehavior.IGNORE) {
@@ -446,9 +447,12 @@ public class EclipseSingularsRecipes {
b.statements = statements.toArray(new Statement[statements.size()]);
statements.clear();
statements.add(new IfStatement(isNotNull, b, 0, 0));
+ EclipseHandlerUtil.createRelevantNullableAnnotation(typeNode, arg);
return;
}
+ EclipseHandlerUtil.createRelevantNonNullAnnotation(typeNode, arg);
+
String exceptionTypeStr = behavior.getExceptionType();
StringLiteral message = new StringLiteral(behavior.toExceptionMessage(new String(data.getPluralName())).toCharArray(), 0, 0, 0);
if (exceptionTypeStr != null) {