aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers
diff options
context:
space:
mode:
authorCaleb Brinkman <cbrinkman@sonatype.com>2019-09-19 13:14:43 -0500
committerCaleb Brinkman <cbrinkman@sonatype.com>2019-09-19 13:14:43 -0500
commitbae66a3450cf6118d7447a390baf333f862c7d8e (patch)
treee8f47d0a857d51c21e73cbc0f4da0689aa6140ac /src/core/lombok/javac/handlers
parente1bd41fab9d62b5478e50b5c2fe2e45a0d767334 (diff)
downloadlombok-bae66a3450cf6118d7447a390baf333f862c7d8e.tar.gz
lombok-bae66a3450cf6118d7447a390baf333f862c7d8e.tar.bz2
lombok-bae66a3450cf6118d7447a390baf333f862c7d8e.zip
Fix null pointers and incorrect tests
Diffstat (limited to 'src/core/lombok/javac/handlers')
-rw-r--r--src/core/lombok/javac/handlers/JavacSingularsRecipes.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
index f693af83..56116346 100644
--- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
+++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
@@ -126,7 +126,7 @@ public class JavacSingularsRecipes {
this.typeArgs = typeArgs;
this.targetFqn = targetFqn;
this.singularizer = singularizer;
- this.setterPrefix = null;
+ this.setterPrefix = "";
}
public SingularData(JavacNode annotation, Name singularName, Name pluralName, List<JCExpression> typeArgs, String targetFqn, JavacSingularizer singularizer, String setterPrefix) {
@@ -293,8 +293,9 @@ public class JavacSingularsRecipes {
ListBuffer<JCStatement> statements = generateSingularMethodStatements(maker, data, builderType, source);
List<JCVariableDecl> params = generateSingularMethodParameters(maker, data, builderType, source);
Name name = data.getSingularName();
- Name prefixedSingularName = data.getSetterPrefix().length() == 0 ? name :
- builderType.toName(HandlerUtil.buildAccessorName(data.getSetterPrefix(), name.toString()));
+ String setterPrefix = data.getSetterPrefix();
+ Name prefixedSingularName = setterPrefix.isEmpty() ? name :
+ builderType.toName(HandlerUtil.buildAccessorName(setterPrefix, name.toString()));
name = fluent ? prefixedSingularName : builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(),
name.toString()));