diff options
author | Caleb Brinkman <cbrinkman@sonatype.com> | 2019-09-19 13:14:43 -0500 |
---|---|---|
committer | Caleb Brinkman <cbrinkman@sonatype.com> | 2019-09-19 13:14:43 -0500 |
commit | bae66a3450cf6118d7447a390baf333f862c7d8e (patch) | |
tree | e8f47d0a857d51c21e73cbc0f4da0689aa6140ac /src/core/lombok/javac/handlers | |
parent | e1bd41fab9d62b5478e50b5c2fe2e45a0d767334 (diff) | |
download | lombok-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.java | 7 |
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())); |