diff options
author | Caleb Brinkman <cbrinkman@sonatype.com> | 2019-10-28 13:41:13 -0500 |
---|---|---|
committer | Caleb Brinkman <cbrinkman@sonatype.com> | 2019-10-28 13:41:13 -0500 |
commit | 1b0c2f34a50531e2af4d8c88ff196a9526e00ac8 (patch) | |
tree | 0dff959c2d09de5458fe5ce8c5afb16fc9bd0e5d /src/core/lombok/eclipse/handlers | |
parent | 2a7afbc1d1f450dec98b224ffd990a7a972d770a (diff) | |
download | lombok-1b0c2f34a50531e2af4d8c88ff196a9526e00ac8.tar.gz lombok-1b0c2f34a50531e2af4d8c88ff196a9526e00ac8.tar.bz2 lombok-1b0c2f34a50531e2af4d8c88ff196a9526e00ac8.zip |
Fix eclipse map singularization
Diffstat (limited to 'src/core/lombok/eclipse/handlers')
-rwxr-xr-x | src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java index 8684987f..4ceafd1e 100755 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.logging.Handler; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.Argument; @@ -62,6 +63,7 @@ import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData; import lombok.eclipse.handlers.EclipseSingularsRecipes.StatementMaker; import lombok.eclipse.handlers.EclipseSingularsRecipes.TypeReferenceMaker; import lombok.eclipse.handlers.HandleNonNull; +import org.objectweb.asm.Handle; @ProviderFor(EclipseSingularizer.class) public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer { @@ -245,7 +247,13 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer valueParam.annotations = typeUseAnnsValue; md.arguments = new Argument[] {keyParam, valueParam}; md.returnType = returnType; - md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName("put", new String(data.getSingularName())).toCharArray(); + + String name = new String(data.getSingularName()); + String setterPrefix = new String(data.getSetterPrefix()); + String prefixedSingularName = setterPrefix.isEmpty() ? name : HandlerUtil.buildAccessorName(setterPrefix, name); + String setterName = fluent ? prefixedSingularName : HandlerUtil.buildAccessorName("put", name); + + md.selector = setterName.toCharArray(); md.annotations = generateSelfReturnAnnotations(deprecate, cfv, data.getSource()); data.setGeneratedByRecursive(md); @@ -309,7 +317,13 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer Argument param = new Argument(data.getPluralName(), 0, paramType, ClassFileConstants.AccFinal); md.arguments = new Argument[] {param}; md.returnType = returnType; - md.selector = fluent ? data.getPluralName() : HandlerUtil.buildAccessorName("putAll", new String(data.getPluralName())).toCharArray(); + + String name = new String(data.getPluralName()); + String setterPrefix = new String(data.getSetterPrefix()); + String prefixedSingularName = setterPrefix.isEmpty() ? name : HandlerUtil.buildAccessorName(setterPrefix, name); + String setterName = fluent ? prefixedSingularName : HandlerUtil.buildAccessorName("put", name); + + md.selector = setterName.toCharArray(); md.annotations = generateSelfReturnAnnotations(deprecate, cfv, data.getSource()); data.setGeneratedByRecursive(md); |