From 96151ade650c2038ab639a1c0f5a504747c4b1b5 Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Wed, 10 Jul 2019 15:05:06 -0500 Subject: Add tests for prefixed builder --- .../resource/after-delombok/BuilderWithPrefix.java | 34 ++++++++++++++++++++++ .../resource/after-ecj/BuilderWithPrefix.java | 27 +++++++++++++++++ .../resource/before/BuilderWithPrefix.java | 6 ++++ 3 files changed, 67 insertions(+) create mode 100644 test/transform/resource/after-delombok/BuilderWithPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithPrefix.java create mode 100644 test/transform/resource/before/BuilderWithPrefix.java (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderWithPrefix.java b/test/transform/resource/after-delombok/BuilderWithPrefix.java new file mode 100644 index 00000000..c29d2a16 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithPrefix.java @@ -0,0 +1,34 @@ +import java.util.List; +class BuilderWithPrefix { + private int unprefixed; + @java.lang.SuppressWarnings("all") + BuilderWithPrefix(final int unprefixed) { + this.unprefixed = unprefixed; + } + @java.lang.SuppressWarnings("all") + protected static class BuilderWithPrefixBuilder { + @java.lang.SuppressWarnings("all") + private int unprefixed; + @java.lang.SuppressWarnings("all") + BuilderWithPrefixBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { + this.unprefixed = unprefixed; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithPrefix build() { + return new BuilderWithPrefix(unprefixed); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected static BuilderWithPrefixBuilder builder() { + return new BuilderWithPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithPrefix.java b/test/transform/resource/after-ecj/BuilderWithPrefix.java new file mode 100644 index 00000000..21a60d0d --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithPrefix.java @@ -0,0 +1,27 @@ +import java.util.List; +@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderWithPrefix { + protected static @java.lang.SuppressWarnings("all") class BuilderWithPrefixBuilder { + private @java.lang.SuppressWarnings("all") int unprefixed; + @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { + this.unprefixed = unprefixed; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithPrefix build() { + return new BuilderWithPrefix(unprefixed); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); + } + } + private int unprefixed; + @java.lang.SuppressWarnings("all") BuilderWithPrefix(final int unprefixed) { + super(); + this.unprefixed = unprefixed; + } + protected static @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder builder() { + return new BuilderWithPrefixBuilder(); + } +} diff --git a/test/transform/resource/before/BuilderWithPrefix.java b/test/transform/resource/before/BuilderWithPrefix.java new file mode 100644 index 00000000..38f3c029 --- /dev/null +++ b/test/transform/resource/before/BuilderWithPrefix.java @@ -0,0 +1,6 @@ +import java.util.List; + +@lombok.Builder(access = lombok.AccessLevel.PROTECTED, setterPrefix = "with") +class BuilderWithPrefix { + private int unprefixed; +} -- cgit From 88bf742e3e107cc0bbfc3a72c2f456d34ef3079c Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Wed, 10 Jul 2019 17:27:01 -0500 Subject: Implement prefixed setters Related to #1805, this change adds an optional `setterPrefix` parameter to the `Builder` annotation; if this parameter is unspecified or blank the behavior of the `Builder` annotation is unchanged, but if it is present the value specified will be prefixed to the generated methods. For example, using: ``` @Builder(setterPrefix = "include") class Foo { private int someValue; } ``` will result in a generated `Builder` class containing an `includeSomeValue(int someValue)` method instead of the default `someValue(int someValue)`. --- .../lombok/eclipse/handlers/HandleBuilder.java | 44 +++++++++++++++++- src/core/lombok/javac/handlers/HandleBuilder.java | 54 ++++++++++++++++++---- .../resource/after-ecj/BuilderWithPrefix.java | 2 +- 3 files changed, 89 insertions(+), 11 deletions(-) (limited to 'test/transform/resource') diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index aa9d2147..aa43e96e 100755 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -31,6 +31,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import com.sun.tools.javac.util.Name; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; @@ -482,7 +483,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } for (BuilderFieldData bfd : builderFields) { - makeSetterMethodsForBuilder(builderType, bfd, annotationNode, fluent, chain, accessForInners, bfd.originalFieldNode); + makePrefixedSetterMethodsForBuilder(builderType, bfd, annotationNode, fluent, chain, accessForInners, bfd.originalFieldNode, builderInstance.setterPrefix()); } { @@ -840,7 +841,46 @@ public class HandleBuilder extends EclipseAnnotationHandler { sourceNode, methodAnnsList, annotations != null ? Arrays.asList(copyAnnotations(sourceNode.get(), annotations)) : Collections.emptyList()); injectMethod(builderType, setter); } - + + public void makePrefixedSetterMethodsForBuilder(EclipseNode builderType, BuilderFieldData bfd, EclipseNode sourceNode, boolean fluent, boolean chain, AccessLevel access, EclipseNode originalFieldNode, String prefix) { + boolean deprecate = isFieldDeprecated(bfd.originalFieldNode); + if (bfd.singularData == null || bfd.singularData.getSingularizer() == null) { + makePrefixedSetterMethodForBuilder(builderType, deprecate, bfd.createdFields.get(0), bfd.nameOfSetFlag, sourceNode, fluent, chain, bfd.annotations, access, originalFieldNode, prefix); + } else { + bfd.singularData.getSingularizer().generateMethods(bfd.singularData, deprecate, builderType, fluent, chain, access); + } + } + + private void makePrefixedSetterMethodForBuilder(EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] nameOfSetFlag, EclipseNode sourceNode, boolean fluent, boolean chain, Annotation[] annotations, AccessLevel access, EclipseNode originalFieldNode, String prefix) { + TypeDeclaration td = (TypeDeclaration) builderType.get(); + AbstractMethodDeclaration[] existing = td.methods; + if (existing == null) existing = EMPTY; + int len = existing.length; + FieldDeclaration fd = (FieldDeclaration) fieldNode.get(); + char[] name = fd.name; + + for (int i = 0; i < len; i++) { + if (!(existing[i] instanceof MethodDeclaration)) continue; + char[] existingName = existing[i].selector; + if (Arrays.equals(name, existingName) && !isTolerate(fieldNode, existing[i])) return; + } + + String setterPrefix = prefix.isEmpty() ? "set" : prefix; + String setterName; + if(fluent) { + setterName = prefix.isEmpty() ? fieldNode.getName() : HandlerUtil.buildAccessorName(setterPrefix, fieldNode.getName()); + } else { + setterName = HandlerUtil.buildAccessorName(setterPrefix, fieldNode.getName()); + } + + List methodAnnsList = Collections.emptyList(); + Annotation[] methodAnns = EclipseHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode); + if (methodAnns != null && methodAnns.length > 0) methodAnnsList = Arrays.asList(methodAnns); + MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, nameOfSetFlag, chain, toEclipseModifier(access), + sourceNode, methodAnnsList, annotations != null ? Arrays.asList(copyAnnotations(sourceNode.get(), annotations)) : Collections.emptyList()); + injectMethod(builderType, setter); + } + public EclipseNode makeBuilderClass(boolean isStatic, EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source, AccessLevel access) { TypeDeclaration parent = (TypeDeclaration) tdParent.get(); TypeDeclaration builder = new TypeDeclaration(parent.compilationResult); diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index b339c2ca..ab63aa5a 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -430,7 +430,7 @@ public class HandleBuilder extends JavacAnnotationHandler { } for (BuilderFieldData bfd : builderFields) { - makeSetterMethodsForBuilder(builderType, bfd, annotationNode, fluent, chain, accessForInners); + makePrefixedSetterMethodsForBuilder(builderType, bfd, annotationNode, fluent, chain, accessForInners, builderInstance.setterPrefix()); } { @@ -745,29 +745,67 @@ public class HandleBuilder extends JavacAnnotationHandler { fieldNode.singularData.getSingularizer().generateMethods(fieldNode.singularData, deprecate, builderType, source.get(), fluent, chain, access); } } - + private void makeSimpleSetterMethodForBuilder(JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name nameOfSetFlag, JavacNode source, boolean fluent, boolean chain, List annosOnParam, JavacNode originalFieldNode, AccessLevel access) { Name fieldName = ((JCVariableDecl) fieldNode.get()).name; - + for (JavacNode child : builderType.down()) { if (child.getKind() != Kind.METHOD) continue; JCMethodDecl methodDecl = (JCMethodDecl) child.get(); Name existingName = methodDecl.name; if (existingName.equals(fieldName) && !isTolerate(fieldNode, methodDecl)) return; } - + String setterName = fluent ? fieldNode.getName() : HandlerUtil.buildAccessorName("set", fieldNode.getName()); - + JavacTreeMaker maker = fieldNode.getTreeMaker(); - + List methodAnns = JavacHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode); JCMethodDecl newMethod = HandleSetter.createSetter(toJavacModifier(access), deprecate, fieldNode, maker, setterName, nameOfSetFlag, chain, source, methodAnns, annosOnParam); recursiveSetGeneratedBy(newMethod, source.get(), builderType.getContext()); copyJavadoc(originalFieldNode, newMethod, CopyJavadoc.SETTER); - + injectMethod(builderType, newMethod); } - + + public void makePrefixedSetterMethodsForBuilder(JavacNode builderType, BuilderFieldData fieldNode, JavacNode source, boolean fluent, boolean chain, AccessLevel access, String prefix) { + boolean deprecate = isFieldDeprecated(fieldNode.originalFieldNode); + if (fieldNode.singularData == null || fieldNode.singularData.getSingularizer() == null) { + makePrefixedSetterMethodForBuilder(builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.nameOfSetFlag, source, fluent, chain, fieldNode.annotations, fieldNode.originalFieldNode, access, prefix); + } else { + // TODO prefixed version + fieldNode.singularData.getSingularizer().generateMethods(fieldNode.singularData, deprecate, builderType, source.get(), fluent, chain, access); + } + } + + private void makePrefixedSetterMethodForBuilder(JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name nameOfSetFlag, JavacNode source, boolean fluent, boolean chain, List annosOnParam, JavacNode originalFieldNode, AccessLevel access, String prefix) { + Name fieldName = ((JCVariableDecl) fieldNode.get()).name; + + for (JavacNode child : builderType.down()) { + if (child.getKind() != Kind.METHOD) continue; + JCMethodDecl methodDecl = (JCMethodDecl) child.get(); + Name existingName = methodDecl.name; + if (existingName.equals(fieldName) && !isTolerate(fieldNode, methodDecl)) return; + } + + String setterPrefix = prefix.isEmpty() ? "set" : prefix; + String setterName; + if(fluent) { + setterName = prefix.isEmpty() ? fieldNode.getName() : HandlerUtil.buildAccessorName(setterPrefix, fieldNode.getName()); + } else { + setterName = HandlerUtil.buildAccessorName(setterPrefix, fieldNode.getName()); + } + + JavacTreeMaker maker = fieldNode.getTreeMaker(); + + List methodAnns = JavacHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode); + JCMethodDecl newMethod = HandleSetter.createSetter(toJavacModifier(access), deprecate, fieldNode, maker, setterName, nameOfSetFlag, chain, source, methodAnns, annosOnParam); + recursiveSetGeneratedBy(newMethod, source.get(), builderType.getContext()); + copyJavadoc(originalFieldNode, newMethod, CopyJavadoc.SETTER); + + injectMethod(builderType, newMethod); + } + public JavacNode makeBuilderClass(boolean isStatic, JavacNode source, JavacNode tdParent, String builderClassName, List typeParams, JCAnnotation ast, AccessLevel access) { JavacTreeMaker maker = tdParent.getTreeMaker(); int modifiers = toJavacModifier(access); diff --git a/test/transform/resource/after-ecj/BuilderWithPrefix.java b/test/transform/resource/after-ecj/BuilderWithPrefix.java index 21a60d0d..98c42fe9 100644 --- a/test/transform/resource/after-ecj/BuilderWithPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithPrefix.java @@ -13,7 +13,7 @@ import java.util.List; return new BuilderWithPrefix(unprefixed); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); + return (("BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); } } private int unprefixed; -- cgit From 36287f2ff9ed2f809f8c1c76155919417ad04d3c Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 12 Sep 2019 11:27:08 -0500 Subject: Duplicate builder tests with setter prefix --- .../BuilderSimpleWithSetterPrefix.java | 34 ++++ ...lderSingularAnnotatedTypesWithSetterPrefix.java | 124 ++++++++++++ ...lderSingularGuavaListsSetsWithSetterPrefix.java | 140 ++++++++++++++ .../BuilderSingularListsWithSetterPrefix.java | 123 ++++++++++++ .../BuilderSingularMapsWithSetterPrefix.java | 213 +++++++++++++++++++++ .../BuilderSingularNoAutoWithSetterPrefix.java | 121 ++++++++++++ ...derSingularRedirectToGuavaWithSetterPrefix.java | 93 +++++++++ .../BuilderSingularSetsWithPrefix.java | 153 +++++++++++++++ ...rSingularToBuilderWithNullWithSetterPrefix.java | 65 +++++++ ...WildcardListsWithToBuilderWithSetterPrefix.java | 97 ++++++++++ ...uilderSingularWithPrefixesWithSetterPrefix.java | 56 ++++++ .../BuilderTypeAnnosWithSetterPrefix.java | 45 +++++ .../BuilderValueDataWithSetterPrefix.java | 109 +++++++++++ .../BuilderWithAccessorsWithSetterPrefix.java | 60 ++++++ .../BuilderWithBadNamesWithSetterPrefix.java | 42 ++++ .../BuilderWithDeprecatedWithSetterPrefix.java | 114 +++++++++++ ...erWithExistingBuilderClassWithSetterPrefix.java | 40 ++++ ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 33 ++++ .../BuilderWithNonNullWithSetterPrefix.java | 40 ++++ .../resource/after-delombok/BuilderWithPrefix.java | 34 ---- ...ilderWithRecursiveGenericsWithSetterPrefix.java | 85 ++++++++ .../BuilderWithToBuilderWithSetterPrefix.java | 146 ++++++++++++++ .../BuilderWithTolerateWithSetterPrefix.java | 40 ++++ .../after-ecj/BuilderSimpleWithSetterPrefix.java | 27 +++ ...lderSingularAnnotatedTypesWithSetterPrefix.java | 121 ++++++++++++ ...lderSingularGuavaListsSetsWithSetterPrefix.java | 125 ++++++++++++ .../BuilderSingularGuavaMapsWithSetterPrefix.java | 83 ++++++++ .../BuilderSingularListsWithSetterPrefix.java | 116 +++++++++++ .../BuilderSingularMapsWithSetterPrefix.java | 209 ++++++++++++++++++++ .../BuilderSingularNoAutoWithSetterPrefix.java | 114 +++++++++++ ...derSingularRedirectToGuavaWithSetterPrefix.java | 83 ++++++++ .../BuilderSingularSetsWithSetterPrefix.java | 145 ++++++++++++++ ...rSingularToBuilderWithNullWithSetterPrefix.java | 60 ++++++ ...WildcardListsWithToBuilderWithSetterPrefix.java | 92 +++++++++ ...uilderSingularWithPrefixesWithSetterPrefix.java | 51 +++++ .../BuilderTypeAnnosWithSetterPrefix.java | 33 ++++ .../BuilderValueDataWithSetterPrefix.java | 90 +++++++++ .../BuilderWithAccessorsWithSetterPrefix.java | 47 +++++ .../BuilderWithBadNamesWithSetterPrefix.java | 33 ++++ .../BuilderWithDeprecatedWithSetterPrefix.java | 87 +++++++++ ...erWithExistingBuilderClassWithSetterPrefix.java | 36 ++++ ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 27 +++ .../BuilderWithNonNullWithSetterPrefix.java | 34 ++++ .../resource/after-ecj/BuilderWithPrefix.java | 27 --- ...ilderWithRecursiveGenericsWithSetterPrefix.java | 78 ++++++++ .../BuilderWithToBuilderWithSetterPrefix.java | 123 ++++++++++++ .../BuilderWithTolerateWithSetterPrefix.java | 34 ++++ .../before/BuilderSimpleWithSetterPrefix.java | 6 + ...lderSingularAnnotatedTypesWithSetterPrefix.java | 14 ++ ...lderSingularGuavaListsSetsWithSetterPrefix.java | 16 ++ .../before/BuilderSingularGuavaMapsWithPrefix.java | 12 ++ .../BuilderSingularListsWithSetterPrefix.java | 11 ++ .../BuilderSingularMapsWithSetterPrefix.java | 15 ++ .../BuilderSingularNoAutoWithSetterPrefix.java | 11 ++ ...derSingularRedirectToGuavaWithSetterPrefix.java | 13 ++ .../BuilderSingularSetsWithSetterPrefix.java | 12 ++ ...rSingularToBuilderWithNullWithSetterPrefix.java | 10 + ...WildcardListsWithToBuilderWithSetterPrefix.java | 10 + ...uilderSingularWithPrefixesWithSetterPrefix.java | 7 + .../before/BuilderTypeAnnosWithSetterPrefix.java | 14 ++ .../before/BuilderValueDataWithSetterPrefix.java | 11 ++ .../BuilderWithAccessorsWithSetterPrefix.java | 7 + .../BuilderWithBadNamesWithSetterPrefix.java | 5 + .../BuilderWithDeprecatedWithSetterPrefix.java | 11 ++ ...erWithExistingBuilderClassWithSetterPrefix.java | 15 ++ ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 5 + .../before/BuilderWithNonNullWithSetterPrefix.java | 5 + .../resource/before/BuilderWithPrefix.java | 6 - ...ilderWithRecursiveGenericsWithSetterPrefix.java | 13 ++ .../BuilderWithToBuilderWithSetterPrefix.java | 20 ++ .../BuilderWithTolerateWithSetterPrefix.java | 18 ++ 71 files changed, 4082 insertions(+), 67 deletions(-) create mode 100644 test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java delete mode 100644 test/transform/resource/after-delombok/BuilderWithPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java delete mode 100644 test/transform/resource/after-ecj/BuilderWithPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java create mode 100644 test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSimpleWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderValueDataWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java delete mode 100644 test/transform/resource/before/BuilderWithPrefix.java create mode 100644 test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java create mode 100644 test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java new file mode 100644 index 00000000..c29d2a16 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java @@ -0,0 +1,34 @@ +import java.util.List; +class BuilderWithPrefix { + private int unprefixed; + @java.lang.SuppressWarnings("all") + BuilderWithPrefix(final int unprefixed) { + this.unprefixed = unprefixed; + } + @java.lang.SuppressWarnings("all") + protected static class BuilderWithPrefixBuilder { + @java.lang.SuppressWarnings("all") + private int unprefixed; + @java.lang.SuppressWarnings("all") + BuilderWithPrefixBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { + this.unprefixed = unprefixed; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithPrefix build() { + return new BuilderWithPrefix(unprefixed); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected static BuilderWithPrefixBuilder builder() { + return new BuilderWithPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..2d535e65 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,124 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +@Target(ElementType.TYPE_USE) +@interface MyAnnotation { +} +class BuilderSingularAnnotatedTypes { + private Set<@MyAnnotation @NonNull String> foos; + private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + @java.lang.SuppressWarnings("all") + BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { + this.foos = foos; + this.bars = bars; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularAnnotatedTypesBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<@MyAnnotation @NonNull String> foos; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; + @java.lang.SuppressWarnings("all") + BuilderSingularAnnotatedTypesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withFoo(@MyAnnotation @NonNull final String foo) { + if (foo == null) { + throw new java.lang.NullPointerException("foo is marked non-null but is null"); + } + if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.add(foo); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withFoos(final java.util.Collection foos) { + if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.addAll(foos); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder clearFoos() { + if (this.foos != null) this.foos.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withBar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) { + if (barKey == null) { + throw new java.lang.NullPointerException("barKey is marked non-null but is null"); + } + if (barValue == null) { + throw new java.lang.NullPointerException("barValue is marked non-null but is null"); + } + if (this.bars$key == null) { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + this.bars$key.add(barKey); + this.bars$value.add(barValue); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withBars(final java.util.Map bars) { + if (this.bars$key == null) { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + for (final java.util.Map.Entry $lombokEntry : bars.entrySet()) { + this.bars$key.add($lombokEntry.getKey()); + this.bars$value.add($lombokEntry.getValue()); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder clearBars() { + if (this.bars$key != null) { + this.bars$key.clear(); + this.bars$value.clear(); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypes build() { + java.util.Set<@MyAnnotation @NonNull String> foos; + switch (this.foos == null ? 0 : this.foos.size()) { + case 0: + foos = java.util.Collections.emptySet(); + break; + case 1: + foos = java.util.Collections.singleton(this.foos.get(0)); + break; + default: + foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(this.foos.size() < 1073741824 ? 1 + this.foos.size() + (this.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + foos.addAll(this.foos); + foos = java.util.Collections.unmodifiableSet(foos); + } + java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + switch (this.bars$key == null ? 0 : this.bars$key.size()) { + case 0: + bars = java.util.Collections.emptyMap(); + break; + case 1: + bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0)); + break; + default: + bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(this.bars$key.size() < 1073741824 ? 1 + this.bars$key.size() + (this.bars$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < this.bars$key.size(); $i++) bars.put(this.bars$key.get($i), (@MyAnnotation @NonNull Integer) this.bars$value.get($i)); + bars = java.util.Collections.unmodifiableMap(bars); + } + return new BuilderSingularAnnotatedTypes(foos, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularAnnotatedTypesBuilder builder() { + return new BuilderSingularAnnotatedTypesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..0e9e6dfd --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,140 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +import com.google.common.collect.ImmutableTable; +class BuilderSingularGuavaListsSets { + private ImmutableList cards; + private ImmutableCollection frogs; + @SuppressWarnings("all") + private ImmutableSet rawSet; + private ImmutableSortedSet passes; + private ImmutableTable users; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaListsSets(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes, final ImmutableTable users) { + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + this.users = users; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularGuavaListsSetsBuilder { + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder cards; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder frogs; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSet.Builder rawSet; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSortedSet.Builder passes; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableTable.Builder users; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaListsSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withCard(final T card) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withCards(final java.lang.Iterable cards) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder clearCards() { + this.cards = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withFrog(final Number frog) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withFrogs(final java.lang.Iterable frogs) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder clearFrogs() { + this.frogs = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Iterable rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder clearRawSet() { + this.rawSet = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withPass(final String pass) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withPasses(final java.lang.Iterable passes) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder clearPasses() { + this.passes = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withUser(final Number rowKey, final Number columnKey, final String value) { + if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.put(rowKey, columnKey, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder withUsers(final com.google.common.collect.Table users) { + if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.putAll(users); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder clearUsers() { + this.users = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSets build() { + com.google.common.collect.ImmutableList cards = this.cards == null ? com.google.common.collect.ImmutableList.of() : this.cards.build(); + com.google.common.collect.ImmutableCollection frogs = this.frogs == null ? com.google.common.collect.ImmutableList.of() : this.frogs.build(); + com.google.common.collect.ImmutableSet rawSet = this.rawSet == null ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build(); + com.google.common.collect.ImmutableSortedSet passes = this.passes == null ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build(); + com.google.common.collect.ImmutableTable users = this.users == null ? com.google.common.collect.ImmutableTable.of() : this.users.build(); + return new BuilderSingularGuavaListsSets(cards, frogs, rawSet, passes, users); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ", users=" + this.users + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularGuavaListsSetsBuilder builder() { + return new BuilderSingularGuavaListsSetsBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..1fd58406 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,123 @@ +import java.util.List; +import java.util.Collection; +class BuilderSingularLists { + private List children; + private Collection scarves; + @SuppressWarnings("all") + private List rawList; + @java.lang.SuppressWarnings("all") + BuilderSingularLists(final List children, final Collection scarves, final List rawList) { + this.children = children; + this.scarves = scarves; + this.rawList = rawList; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularListsBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList children; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList scarves; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList rawList; + @java.lang.SuppressWarnings("all") + BuilderSingularListsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder withChild(final T child) { + if (this.children == null) this.children = new java.util.ArrayList(); + this.children.add(child); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder withChildren(final java.util.Collection children) { + if (this.children == null) this.children = new java.util.ArrayList(); + this.children.addAll(children); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder clearChildren() { + if (this.children != null) this.children.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder withScarf(final Number scarf) { + if (this.scarves == null) this.scarves = new java.util.ArrayList(); + this.scarves.add(scarf); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder withScarves(final java.util.Collection scarves) { + if (this.scarves == null) this.scarves = new java.util.ArrayList(); + this.scarves.addAll(scarves); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder clearScarves() { + if (this.scarves != null) this.scarves.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder withRawList(final java.lang.Object rawList) { + if (this.rawList == null) this.rawList = new java.util.ArrayList(); + this.rawList.add(rawList); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder withRawList(final java.util.Collection rawList) { + if (this.rawList == null) this.rawList = new java.util.ArrayList(); + this.rawList.addAll(rawList); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder clearRawList() { + if (this.rawList != null) this.rawList.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularLists build() { + java.util.List children; + switch (this.children == null ? 0 : this.children.size()) { + case 0: + children = java.util.Collections.emptyList(); + break; + case 1: + children = java.util.Collections.singletonList(this.children.get(0)); + break; + default: + children = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.children)); + } + java.util.Collection scarves; + switch (this.scarves == null ? 0 : this.scarves.size()) { + case 0: + scarves = java.util.Collections.emptyList(); + break; + case 1: + scarves = java.util.Collections.singletonList(this.scarves.get(0)); + break; + default: + scarves = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.scarves)); + } + java.util.List rawList; + switch (this.rawList == null ? 0 : this.rawList.size()) { + case 0: + rawList = java.util.Collections.emptyList(); + break; + case 1: + rawList = java.util.Collections.singletonList(this.rawList.get(0)); + break; + default: + rawList = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.rawList)); + } + return new BuilderSingularLists(children, scarves, rawList); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularListsBuilder builder() { + return new BuilderSingularListsBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..4b250994 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,213 @@ +import java.util.Map; +import java.util.SortedMap; +class BuilderSingularMaps { + private Map women; + private SortedMap men; + @SuppressWarnings("all") + private Map rawMap; + private Map stringMap; + @SuppressWarnings("all") + BuilderSingularMaps(Map women, SortedMap men, Map rawMap, Map stringMap) { + this.women = women; + this.men = men; + this.rawMap = rawMap; + this.stringMap = stringMap; + } + @SuppressWarnings("all") + public static class BuilderSingularMapsBuilder { + @SuppressWarnings("all") + private java.util.ArrayList women$key; + @SuppressWarnings("all") + private java.util.ArrayList women$value; + @SuppressWarnings("all") + private java.util.ArrayList men$key; + @SuppressWarnings("all") + private java.util.ArrayList men$value; + @SuppressWarnings("all") + private java.util.ArrayList rawMap$key; + @SuppressWarnings("all") + private java.util.ArrayList rawMap$value; + @SuppressWarnings("all") + private java.util.ArrayList stringMap$key; + @SuppressWarnings("all") + private java.util.ArrayList stringMap$value; + @SuppressWarnings("all") + BuilderSingularMapsBuilder() { + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder withWoman(K womanKey, V womanValue) { + if (this.women$key == null) { + this.women$key = new java.util.ArrayList(); + this.women$value = new java.util.ArrayList(); + } + this.women$key.add(womanKey); + this.women$value.add(womanValue); + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder withWomen(java.util.Map women) { + if (this.women$key == null) { + this.women$key = new java.util.ArrayList(); + this.women$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : women.entrySet()) { + this.women$key.add($lombokEntry.getKey()); + this.women$value.add($lombokEntry.getValue()); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder clearWomen() { + if (this.women$key != null) { + this.women$key.clear(); + this.women$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder withMan(K manKey, Number manValue) { + if (this.men$key == null) { + this.men$key = new java.util.ArrayList(); + this.men$value = new java.util.ArrayList(); + } + this.men$key.add(manKey); + this.men$value.add(manValue); + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder withMen(java.util.Map men) { + if (this.men$key == null) { + this.men$key = new java.util.ArrayList(); + this.men$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : men.entrySet()) { + this.men$key.add($lombokEntry.getKey()); + this.men$value.add($lombokEntry.getValue()); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder clearMen() { + if (this.men$key != null) { + this.men$key.clear(); + this.men$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder withRawMan(Object rawMapKey, Object rawMapValue) { + if (this.rawMap$key == null) { + this.rawMap$key = new java.util.ArrayList(); + this.rawMap$value = new java.util.ArrayList(); + } + this.rawMap$key.add(rawMapKey); + this.rawMap$value.add(rawMapValue); + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder withRawMap(java.util.Map rawMap) { + if (this.rawMap$key == null) { + this.rawMap$key = new java.util.ArrayList(); + this.rawMap$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : rawMap.entrySet()) { + this.rawMap$key.add($lombokEntry.getKey()); + this.rawMap$value.add($lombokEntry.getValue()); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder clearRawMap() { + if (this.rawMap$key != null) { + this.rawMap$key.clear(); + this.rawMap$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder stringMap(String stringMapKey, V stringMapValue) { + if (this.stringMap$key == null) { + this.stringMap$key = new java.util.ArrayList(); + this.stringMap$value = new java.util.ArrayList(); + } + this.stringMap$key.add(stringMapKey); + this.stringMap$value.add(stringMapValue); + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder stringMap(java.util.Map stringMap) { + if (this.stringMap$key == null) { + this.stringMap$key = new java.util.ArrayList(); + this.stringMap$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : stringMap.entrySet()) { + this.stringMap$key.add($lombokEntry.getKey()); + this.stringMap$value.add($lombokEntry.getValue()); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder clearStringMap() { + if (this.stringMap$key != null) { + this.stringMap$key.clear(); + this.stringMap$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMaps build() { + java.util.Map women; + switch (this.women$key == null ? 0 : this.women$key.size()) { + case 0: + women = java.util.Collections.emptyMap(); + break; + case 1: + women = java.util.Collections.singletonMap(this.women$key.get(0), this.women$value.get(0)); + break; + default: + women = new java.util.LinkedHashMap(this.women$key.size() < 1073741824 ? 1 + this.women$key.size() + (this.women$key.size() - 3) / 3 : Integer.MAX_VALUE); + for (int $i = 0; $i < this.women$key.size(); $i++) women.put(this.women$key.get($i), (V) this.women$value.get($i)); + women = java.util.Collections.unmodifiableMap(women); + } + java.util.SortedMap men = new java.util.TreeMap(); + if (this.men$key != null) for (int $i = 0; $i < (this.men$key == null ? 0 : this.men$key.size()); $i++) men.put(this.men$key.get($i), (Number) this.men$value.get($i)); + men = java.util.Collections.unmodifiableSortedMap(men); + java.util.Map rawMap; + switch (this.rawMap$key == null ? 0 : this.rawMap$key.size()) { + case 0: + rawMap = java.util.Collections.emptyMap(); + break; + case 1: + rawMap = java.util.Collections.singletonMap(this.rawMap$key.get(0), this.rawMap$value.get(0)); + break; + default: + rawMap = new java.util.LinkedHashMap(this.rawMap$key.size() < 1073741824 ? 1 + this.rawMap$key.size() + (this.rawMap$key.size() - 3) / 3 : Integer.MAX_VALUE); + for (int $i = 0; $i < this.rawMap$key.size(); $i++) rawMap.put(this.rawMap$key.get($i), (Object) this.rawMap$value.get($i)); + rawMap = java.util.Collections.unmodifiableMap(rawMap); + } + java.util.Map stringMap; + switch (this.stringMap$key == null ? 0 : this.stringMap$key.size()) { + case 0: + stringMap = java.util.Collections.emptyMap(); + break; + case 1: + stringMap = java.util.Collections.singletonMap(this.stringMap$key.get(0), this.stringMap$value.get(0)); + break; + default: + stringMap = new java.util.LinkedHashMap(this.stringMap$key.size() < 1073741824 ? 1 + this.stringMap$key.size() + (this.stringMap$key.size() - 3) / 3 : Integer.MAX_VALUE); + for (int $i = 0; $i < this.stringMap$key.size(); $i++) stringMap.put(this.stringMap$key.get($i), (V) this.stringMap$value.get($i)); + stringMap = java.util.Collections.unmodifiableMap(stringMap); + } + return new BuilderSingularMaps(women, men, rawMap, stringMap); + } + @Override + @SuppressWarnings("all") + public String toString() { + return "BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key + ", women$value=" + this.women$value + ", men$key=" + this.men$key + ", men$value=" + this.men$value + ", rawMap$key=" + this.rawMap$key + ", rawMap$value=" + this.rawMap$value + ", stringMap$key=" + this.stringMap$key + ", stringMap$value=" + this.stringMap$value + ")"; + } + } + @SuppressWarnings("all") + public static BuilderSingularMapsBuilder builder() { + return new BuilderSingularMapsBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..453b9d74 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,121 @@ +import java.util.List; +class BuilderSingularNoAuto { + private List things; + private List widgets; + private List items; + @java.lang.SuppressWarnings("all") + BuilderSingularNoAuto(final List things, final List widgets, final List items) { + this.things = things; + this.widgets = widgets; + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularNoAutoBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList things; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList widgets; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + BuilderSingularNoAutoBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withThings(final String things) { + if (this.things == null) this.things = new java.util.ArrayList(); + this.things.add(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withThings(final java.util.Collection things) { + if (this.things == null) this.things = new java.util.ArrayList(); + this.things.addAll(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder clearThings() { + if (this.things != null) this.things.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withWidget(final String widget) { + if (this.widgets == null) this.widgets = new java.util.ArrayList(); + this.widgets.add(widget); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withWidgets(final java.util.Collection widgets) { + if (this.widgets == null) this.widgets = new java.util.ArrayList(); + this.widgets.addAll(widgets); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder clearWidgets() { + if (this.widgets != null) this.widgets.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withItems(final String items) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(items); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withItems(final java.util.Collection items) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder clearItems() { + if (this.items != null) this.items.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAuto build() { + java.util.List things; + switch (this.things == null ? 0 : this.things.size()) { + case 0: + things = java.util.Collections.emptyList(); + break; + case 1: + things = java.util.Collections.singletonList(this.things.get(0)); + break; + default: + things = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.things)); + } + java.util.List widgets; + switch (this.widgets == null ? 0 : this.widgets.size()) { + case 0: + widgets = java.util.Collections.emptyList(); + break; + case 1: + widgets = java.util.Collections.singletonList(this.widgets.get(0)); + break; + default: + widgets = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.widgets)); + } + java.util.List items; + switch (this.items == null ? 0 : this.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(this.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.items)); + } + return new BuilderSingularNoAuto(things, widgets, items); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularNoAutoBuilder builder() { + return new BuilderSingularNoAutoBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..4b1b3d70 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,93 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +class BuilderSingularRedirectToGuava { + private Set dangerMice; + private NavigableMap things; + private Collection> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularRedirectToGuava(final Set dangerMice, final NavigableMap things, final Collection> doohickeys) { + this.dangerMice = dangerMice; + this.things = things; + this.doohickeys = doohickeys; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularRedirectToGuavaBuilder { + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSet.Builder dangerMice; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSortedMap.Builder things; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularRedirectToGuavaBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withDangerMouse(final String dangerMouse) { + if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.add(dangerMouse); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withDangerMice(final java.lang.Iterable dangerMice) { + if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.addAll(dangerMice); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder clearDangerMice() { + this.dangerMice = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withThing(final Integer key, final Number value) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(key, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withThings(final java.util.Map things) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.putAll(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder clearThings() { + this.things = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withDoohickey(final Class doohickey) { + if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.add(doohickey); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withDoohickeys(final java.lang.Iterable> doohickeys) { + if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.addAll(doohickeys); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder clearDoohickeys() { + this.doohickeys = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuava build() { + java.util.Set dangerMice = this.dangerMice == null ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build(); + java.util.NavigableMap things = this.things == null ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build(); + java.util.Collection> doohickeys = this.doohickeys == null ? com.google.common.collect.ImmutableList.>of() : this.doohickeys.build(); + return new BuilderSingularRedirectToGuava(dangerMice, things, doohickeys); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder(dangerMice=" + this.dangerMice + ", things=" + this.things + ", doohickeys=" + this.doohickeys + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularRedirectToGuavaBuilder builder() { + return new BuilderSingularRedirectToGuavaBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java b/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java new file mode 100644 index 00000000..e3817b59 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java @@ -0,0 +1,153 @@ +import java.util.Set; +import java.util.SortedSet; +class BuilderSingularSets { + private Set dangerMice; + private SortedSet octopodes; + @SuppressWarnings("all") + private Set rawSet; + private Set stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSets(final Set dangerMice, final SortedSet octopodes, final Set rawSet, final Set stringSet) { + this.dangerMice = dangerMice; + this.octopodes = octopodes; + this.rawSet = rawSet; + this.stringSet = stringSet; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularSetsBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList dangerMice; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList octopodes; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList rawSet; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withDangerMouse(final T dangerMouse) { + if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList(); + this.dangerMice.add(dangerMouse); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withDangerMice(final java.util.Collection dangerMice) { + if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList(); + this.dangerMice.addAll(dangerMice); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder clearDangerMice() { + if (this.dangerMice != null) this.dangerMice.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withOctopus(final Number octopus) { + if (this.octopodes == null) this.octopodes = new java.util.ArrayList(); + this.octopodes.add(octopus); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withOctopodes(final java.util.Collection octopodes) { + if (this.octopodes == null) this.octopodes = new java.util.ArrayList(); + this.octopodes.addAll(octopodes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder clearOctopodes() { + if (this.octopodes != null) this.octopodes.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withRawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = new java.util.ArrayList(); + this.rawSet.add(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withRawSet(final java.util.Collection rawSet) { + if (this.rawSet == null) this.rawSet = new java.util.ArrayList(); + this.rawSet.addAll(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder clearRawSet() { + if (this.rawSet != null) this.rawSet.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withStringSet(final String stringSet) { + if (this.stringSet == null) this.stringSet = new java.util.ArrayList(); + this.stringSet.add(stringSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder withStringSet(final java.util.Collection stringSet) { + if (this.stringSet == null) this.stringSet = new java.util.ArrayList(); + this.stringSet.addAll(stringSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder clearStringSet() { + if (this.stringSet != null) this.stringSet.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSets build() { + java.util.Set dangerMice; + switch (this.dangerMice == null ? 0 : this.dangerMice.size()) { + case 0: + dangerMice = java.util.Collections.emptySet(); + break; + case 1: + dangerMice = java.util.Collections.singleton(this.dangerMice.get(0)); + break; + default: + dangerMice = new java.util.LinkedHashSet(this.dangerMice.size() < 1073741824 ? 1 + this.dangerMice.size() + (this.dangerMice.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + dangerMice.addAll(this.dangerMice); + dangerMice = java.util.Collections.unmodifiableSet(dangerMice); + } + java.util.SortedSet octopodes = new java.util.TreeSet(); + if (this.octopodes != null) octopodes.addAll(this.octopodes); + octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); + java.util.Set rawSet; + switch (this.rawSet == null ? 0 : this.rawSet.size()) { + case 0: + rawSet = java.util.Collections.emptySet(); + break; + case 1: + rawSet = java.util.Collections.singleton(this.rawSet.get(0)); + break; + default: + rawSet = new java.util.LinkedHashSet(this.rawSet.size() < 1073741824 ? 1 + this.rawSet.size() + (this.rawSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + rawSet.addAll(this.rawSet); + rawSet = java.util.Collections.unmodifiableSet(rawSet); + } + java.util.Set stringSet; + switch (this.stringSet == null ? 0 : this.stringSet.size()) { + case 0: + stringSet = java.util.Collections.emptySet(); + break; + case 1: + stringSet = java.util.Collections.singleton(this.stringSet.get(0)); + break; + default: + stringSet = new java.util.LinkedHashSet(this.stringSet.size() < 1073741824 ? 1 + this.stringSet.size() + (this.stringSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + stringSet.addAll(this.stringSet); + stringSet = java.util.Collections.unmodifiableSet(stringSet); + } + return new BuilderSingularSets(dangerMice, octopodes, rawSet, stringSet); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularSetsBuilder builder() { + return new BuilderSingularSetsBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..83e58e1d --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,65 @@ +class BuilderSingularToBuilderWithNull { + private java.util.List elems; + public static void test() { + new BuilderSingularToBuilderWithNull(null).toBuilder(); + } + @java.lang.SuppressWarnings("all") + BuilderSingularToBuilderWithNull(final java.util.List elems) { + this.elems = elems; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularToBuilderWithNullBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList elems; + @java.lang.SuppressWarnings("all") + BuilderSingularToBuilderWithNullBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder withElem(final String elem) { + if (this.elems == null) this.elems = new java.util.ArrayList(); + this.elems.add(elem); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder withElems(final java.util.Collection elems) { + if (this.elems == null) this.elems = new java.util.ArrayList(); + this.elems.addAll(elems); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder clearElems() { + if (this.elems != null) this.elems.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNull build() { + java.util.List elems; + switch (this.elems == null ? 0 : this.elems.size()) { + case 0: + elems = java.util.Collections.emptyList(); + break; + case 1: + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default: + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); + } + return new BuilderSingularToBuilderWithNull(elems); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder(elems=" + this.elems + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularToBuilderWithNullBuilder builder() { + return new BuilderSingularToBuilderWithNullBuilder(); + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder toBuilder() { + final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder(); + if (this.elems != null) builder.elems(this.elems); + return builder; + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..583d4df0 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,97 @@ +import java.util.List; +import java.util.Collection; +class BuilderSingularWildcardListsWithToBuilder { + private List objects; + private Collection numbers; + @java.lang.SuppressWarnings("all") + BuilderSingularWildcardListsWithToBuilder(final List objects, final Collection numbers) { + this.objects = objects; + this.numbers = numbers; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularWildcardListsWithToBuilderBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList objects; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList numbers; + @java.lang.SuppressWarnings("all") + BuilderSingularWildcardListsWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withObject(final java.lang.Object object) { + if (this.objects == null) this.objects = new java.util.ArrayList(); + this.objects.add(object); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withObjects(final java.util.Collection objects) { + if (this.objects == null) this.objects = new java.util.ArrayList(); + this.objects.addAll(objects); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + if (this.objects != null) this.objects.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withNumber(final Number number) { + if (this.numbers == null) this.numbers = new java.util.ArrayList(); + this.numbers.add(number); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withNumbers(final java.util.Collection numbers) { + if (this.numbers == null) this.numbers = new java.util.ArrayList(); + this.numbers.addAll(numbers); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + if (this.numbers != null) this.numbers.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilder build() { + java.util.List objects; + switch (this.objects == null ? 0 : this.objects.size()) { + case 0: + objects = java.util.Collections.emptyList(); + break; + case 1: + objects = java.util.Collections.singletonList(this.objects.get(0)); + break; + default: + objects = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.objects)); + } + java.util.Collection numbers; + switch (this.numbers == null ? 0 : this.numbers.size()) { + case 0: + numbers = java.util.Collections.emptyList(); + break; + case 1: + numbers = java.util.Collections.singletonList(this.numbers.get(0)); + break; + default: + numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.numbers)); + } + return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects + ", numbers=" + this.numbers + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularWildcardListsWithToBuilderBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderBuilder(); + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderBuilder builder = new BuilderSingularWildcardListsWithToBuilderBuilder(); + if (this.objects != null) builder.objects(this.objects); + if (this.numbers != null) builder.numbers(this.numbers); + return builder; + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..216cd01f --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,56 @@ +class BuilderSingularWithPrefixes { + private java.util.List _elems; + @java.lang.SuppressWarnings("all") + BuilderSingularWithPrefixes(final java.util.List elems) { + this._elems = elems; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularWithPrefixesBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList elems; + @java.lang.SuppressWarnings("all") + BuilderSingularWithPrefixesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixesBuilder withElem(final String elem) { + if (this.elems == null) this.elems = new java.util.ArrayList(); + this.elems.add(elem); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixesBuilder withElems(final java.util.Collection elems) { + if (this.elems == null) this.elems = new java.util.ArrayList(); + this.elems.addAll(elems); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixesBuilder clearElems() { + if (this.elems != null) this.elems.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixes build() { + java.util.List elems; + switch (this.elems == null ? 0 : this.elems.size()) { + case 0: + elems = java.util.Collections.emptyList(); + break; + case 1: + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default: + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); + } + return new BuilderSingularWithPrefixes(elems); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder(elems=" + this.elems + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularWithPrefixesBuilder builder() { + return new BuilderSingularWithPrefixesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..b8bb81b7 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,45 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TB { +} +class BuilderTypeAnnos { + @TA + @TB + private List foo; + @java.lang.SuppressWarnings("all") + BuilderTypeAnnos(@TA final List foo) { + this.foo = foo; + } + @java.lang.SuppressWarnings("all") + public static class BuilderTypeAnnosBuilder { + @java.lang.SuppressWarnings("all") + private List foo; + @java.lang.SuppressWarnings("all") + BuilderTypeAnnosBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderTypeAnnosBuilder withFoo(@TA final List foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderTypeAnnos build() { + return new BuilderTypeAnnos(foo); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderTypeAnnosBuilder builder() { + return new BuilderTypeAnnosBuilder(); + } +} + diff --git a/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..e1c107da --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,109 @@ +import java.util.List; +final class BuilderAndValue { + private final int zero = 0; + @java.lang.SuppressWarnings("all") + BuilderAndValue() { + } + @java.lang.SuppressWarnings("all") + public static class BuilderAndValueBuilder { + @java.lang.SuppressWarnings("all") + BuilderAndValueBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderAndValue build() { + return new BuilderAndValue(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndValue.BuilderAndValueBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderAndValueBuilder builder() { + return new BuilderAndValueBuilder(); + } + @java.lang.SuppressWarnings("all") + public int getZero() { + return this.zero; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderAndValue)) return false; + final BuilderAndValue other = (BuilderAndValue) o; + if (this.getZero() != other.getZero()) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getZero(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndValue(zero=" + this.getZero() + ")"; + } +} + +class BuilderAndData { + private final int zero = 0; + @java.lang.SuppressWarnings("all") + BuilderAndData() { + } + @java.lang.SuppressWarnings("all") + public static class BuilderAndDataBuilder { + @java.lang.SuppressWarnings("all") + BuilderAndDataBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderAndData build() { + return new BuilderAndData(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndData.BuilderAndDataBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderAndDataBuilder builder() { + return new BuilderAndDataBuilder(); + } + @java.lang.SuppressWarnings("all") + public int getZero() { + return this.zero; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderAndData)) return false; + final BuilderAndData other = (BuilderAndData) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.getZero() != other.getZero()) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof BuilderAndData; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getZero(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndData(zero=" + this.getZero() + ")"; + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..d8e075b8 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,60 @@ +class BuilderWithAccessors { + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; + @java.lang.SuppressWarnings("all") + BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + this.plower = plower; + this.pUpper = upper; + this._foo = foo; + this.__bar = _bar; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithAccessorsBuilder { + @java.lang.SuppressWarnings("all") + private int plower; + @java.lang.SuppressWarnings("all") + private int upper; + @java.lang.SuppressWarnings("all") + private int foo; + @java.lang.SuppressWarnings("all") + private int _bar; + @java.lang.SuppressWarnings("all") + BuilderWithAccessorsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder withPlower(final int plower) { + this.plower = plower; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder withUpper(final int upper) { + this.upper = upper; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder withFoo(final int foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder with_Bar(final int _bar) { + this._bar = _bar; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessors build() { + return new BuilderWithAccessors(plower, upper, foo, _bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithAccessors.BuilderWithAccessorsBuilder(plower=" + this.plower + ", upper=" + this.upper + ", foo=" + this.foo + ", _bar=" + this._bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithAccessorsBuilder builder() { + return new BuilderWithAccessorsBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..d19bf947 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,42 @@ +public class BuilderWithBadNames { + String build; + String toString; + @java.lang.SuppressWarnings("all") + BuilderWithBadNames(final String build, final String toString) { + this.build = build; + this.toString = toString; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithBadNamesBuilder { + @java.lang.SuppressWarnings("all") + private String build; + @java.lang.SuppressWarnings("all") + private String toString; + @java.lang.SuppressWarnings("all") + BuilderWithBadNamesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNamesBuilder withBuild(final String build) { + this.build = build; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNamesBuilder withToString(final String toString) { + this.toString = toString; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNames build() { + return new BuilderWithBadNames(build, toString); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build + ", toString=" + this.toString + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithBadNamesBuilder builder() { + return new BuilderWithBadNamesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..2045c1a5 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,114 @@ +import com.google.common.collect.ImmutableList; +public class BuilderWithDeprecated { + /** + * @deprecated since always + */ + String dep1; + @Deprecated + int dep2; + @Deprecated + java.util.List strings; + @Deprecated + ImmutableList numbers; + @java.lang.SuppressWarnings("all") + BuilderWithDeprecated(final String dep1, final int dep2, final java.util.List strings, final ImmutableList numbers) { + this.dep1 = dep1; + this.dep2 = dep2; + this.strings = strings; + this.numbers = numbers; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithDeprecatedBuilder { + @java.lang.SuppressWarnings("all") + private String dep1; + @java.lang.SuppressWarnings("all") + private int dep2; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList strings; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder numbers; + @java.lang.SuppressWarnings("all") + BuilderWithDeprecatedBuilder() { + } + /** + * @deprecated since always + */ + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withDep1(final String dep1) { + this.dep1 = dep1; + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withDep2(final int dep2) { + this.dep2 = dep2; + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withString(final String string) { + if (this.strings == null) this.strings = new java.util.ArrayList(); + this.strings.add(string); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withStrings(final java.util.Collection strings) { + if (this.strings == null) this.strings = new java.util.ArrayList(); + this.strings.addAll(strings); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder clearStrings() { + if (this.strings != null) this.strings.clear(); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withNumber(final Integer number) { + if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.add(number); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withNumbers(final java.lang.Iterable numbers) { + if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.addAll(numbers); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder clearNumbers() { + this.numbers = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecated build() { + java.util.List strings; + switch (this.strings == null ? 0 : this.strings.size()) { + case 0: + strings = java.util.Collections.emptyList(); + break; + case 1: + strings = java.util.Collections.singletonList(this.strings.get(0)); + break; + default: + strings = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.strings)); + } + com.google.common.collect.ImmutableList numbers = this.numbers == null ? com.google.common.collect.ImmutableList.of() : this.numbers.build(); + return new BuilderWithDeprecated(dep1, dep2, strings, numbers); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithDeprecated.BuilderWithDeprecatedBuilder(dep1=" + this.dep1 + ", dep2=" + this.dep2 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithDeprecatedBuilder builder() { + return new BuilderWithDeprecatedBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..fd9504c2 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,40 @@ +class BuilderWithExistingBuilderClass { + public static BuilderWithExistingBuilderClass staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + public static class BuilderWithExistingBuilderClassBuilder { + @java.lang.SuppressWarnings("all") + private boolean arg2; + @java.lang.SuppressWarnings("all") + private String arg3; + private Z arg1; + public void withArg2(boolean arg) { + } + @java.lang.SuppressWarnings("all") + BuilderWithExistingBuilderClassBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClassBuilder withArg1(final Z arg1) { + this.arg1 = arg1; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClassBuilder withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClass build() { + return BuilderWithExistingBuilderClass.staticMethod(arg1, arg2, arg3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1 + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithExistingBuilderClassBuilder builder() { + return new BuilderWithExistingBuilderClassBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..ec0ccb28 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,33 @@ +class BuilderWithNoBuilderMethod { + private String a = ""; + @java.lang.SuppressWarnings("all") + BuilderWithNoBuilderMethod(final String a) { + this.a = a; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithNoBuilderMethodBuilder { + @java.lang.SuppressWarnings("all") + private String a; + @java.lang.SuppressWarnings("all") + BuilderWithNoBuilderMethodBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethodBuilder withA(final String a) { + this.a = a; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethod build() { + return new BuilderWithNoBuilderMethod(a); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a + ")"; + } + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethodBuilder toBuilder() { + return new BuilderWithNoBuilderMethodBuilder().withA(this.a); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..29f1b792 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,40 @@ +class BuilderWithNonNull { + @lombok.NonNull + private final String id; + @java.lang.SuppressWarnings("all") + BuilderWithNonNull(@lombok.NonNull final String id) { + if (id == null) { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithNonNullBuilder { + @java.lang.SuppressWarnings("all") + private String id; + @java.lang.SuppressWarnings("all") + BuilderWithNonNullBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithNonNullBuilder withId(@lombok.NonNull final String id) { + if (id == null) { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithNonNull build() { + return new BuilderWithNonNull(id); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithNonNull.BuilderWithNonNullBuilder(id=" + this.id + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithNonNullBuilder builder() { + return new BuilderWithNonNullBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithPrefix.java b/test/transform/resource/after-delombok/BuilderWithPrefix.java deleted file mode 100644 index c29d2a16..00000000 --- a/test/transform/resource/after-delombok/BuilderWithPrefix.java +++ /dev/null @@ -1,34 +0,0 @@ -import java.util.List; -class BuilderWithPrefix { - private int unprefixed; - @java.lang.SuppressWarnings("all") - BuilderWithPrefix(final int unprefixed) { - this.unprefixed = unprefixed; - } - @java.lang.SuppressWarnings("all") - protected static class BuilderWithPrefixBuilder { - @java.lang.SuppressWarnings("all") - private int unprefixed; - @java.lang.SuppressWarnings("all") - BuilderWithPrefixBuilder() { - } - @java.lang.SuppressWarnings("all") - public BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { - this.unprefixed = unprefixed; - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderWithPrefix build() { - return new BuilderWithPrefix(unprefixed); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed + ")"; - } - } - @java.lang.SuppressWarnings("all") - protected static BuilderWithPrefixBuilder builder() { - return new BuilderWithPrefixBuilder(); - } -} diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..d0ca7c05 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,85 @@ +import java.util.Set; +public class BuilderWithRecursiveGenerics { + interface Inter> { + } + public static final class Test, Quz extends Inter> { + private final Foo foo; + private final Bar bar; + @java.lang.SuppressWarnings("all") + Test(final Foo foo, final Bar bar) { + this.foo = foo; + this.bar = bar; + } + @java.lang.SuppressWarnings("all") + public static class TestBuilder, Quz extends Inter> { + @java.lang.SuppressWarnings("all") + private Foo foo; + @java.lang.SuppressWarnings("all") + private Bar bar; + @java.lang.SuppressWarnings("all") + TestBuilder() { + } + @java.lang.SuppressWarnings("all") + public TestBuilder withFoo(final Foo foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public TestBuilder withBar(final Bar bar) { + this.bar = bar; + return this; + } + @java.lang.SuppressWarnings("all") + public Test build() { + return new Test(foo, bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo + ", bar=" + this.bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static , Quz extends Inter> TestBuilder builder() { + return new TestBuilder(); + } + @java.lang.SuppressWarnings("all") + public Foo getFoo() { + return this.foo; + } + @java.lang.SuppressWarnings("all") + public Bar getBar() { + return this.bar; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderWithRecursiveGenerics.Test)) return false; + final BuilderWithRecursiveGenerics.Test other = (BuilderWithRecursiveGenerics.Test) o; + final java.lang.Object this$foo = this.getFoo(); + final java.lang.Object other$foo = other.getFoo(); + if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false; + final java.lang.Object this$bar = this.getBar(); + final java.lang.Object other$bar = other.getBar(); + if (this$bar == null ? other$bar != null : !this$bar.equals(other$bar)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.getFoo(); + result = result * PRIME + ($foo == null ? 43 : $foo.hashCode()); + final java.lang.Object $bar = this.getBar(); + result = result * PRIME + ($bar == null ? 43 : $bar.hashCode()); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo() + ", bar=" + this.getBar() + ")"; + } + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..ac8264d3 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,146 @@ +import java.util.List; +class BuilderWithToBuilder { + private String mOne; + private String mTwo; + private T foo; + private List bars; + public static K rrr(BuilderWithToBuilder x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") + BuilderWithToBuilder(final String one, final String two, final T foo, final List bars) { + this.mOne = one; + this.mTwo = two; + this.foo = foo; + this.bars = bars; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithToBuilderBuilder { + @java.lang.SuppressWarnings("all") + private String one; + @java.lang.SuppressWarnings("all") + private String two; + @java.lang.SuppressWarnings("all") + private T foo; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList bars; + @java.lang.SuppressWarnings("all") + BuilderWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder withOne(final String one) { + this.one = one; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder withTwo(final String two) { + this.two = two; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder withFoo(final T foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder withBar(final T bar) { + if (this.bars == null) this.bars = new java.util.ArrayList(); + this.bars.add(bar); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder withBars(final java.util.Collection bars) { + if (this.bars == null) this.bars = new java.util.ArrayList(); + this.bars.addAll(bars); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder clearBars() { + if (this.bars != null) this.bars.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilder build() { + java.util.List bars; + switch (this.bars == null ? 0 : this.bars.size()) { + case 0: + bars = java.util.Collections.emptyList(); + break; + case 1: + bars = java.util.Collections.singletonList(this.bars.get(0)); + break; + default: + bars = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.bars)); + } + return new BuilderWithToBuilder(one, two, foo, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one + ", two=" + this.two + ", foo=" + this.foo + ", bars=" + this.bars + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithToBuilderBuilder builder() { + return new BuilderWithToBuilderBuilder(); + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder toBuilder() { + final BuilderWithToBuilderBuilder builder = new BuilderWithToBuilderBuilder().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilder.rrr(this)); + if (this.bars != null) builder.withBars(this.bars); + return builder; + } +} +class ConstructorWithToBuilder { + private String mOne; + private String mTwo; + private T foo; + @lombok.Singular + private com.google.common.collect.ImmutableList bars; + public ConstructorWithToBuilder(String mOne, T baz, com.google.common.collect.ImmutableList bars) { + } + @java.lang.SuppressWarnings("all") + public static class ConstructorWithToBuilderBuilder { + @java.lang.SuppressWarnings("all") + private String mOne; + @java.lang.SuppressWarnings("all") + private T baz; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList bars; + @java.lang.SuppressWarnings("all") + ConstructorWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder withMOne(final String mOne) { + this.mOne = mOne; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder withBaz(final T baz) { + this.baz = baz; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder withBars(final com.google.common.collect.ImmutableList bars) { + this.bars = bars; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilder build() { + return new ConstructorWithToBuilder(mOne, baz, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne + ", baz=" + this.baz + ", bars=" + this.bars + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static ConstructorWithToBuilderBuilder builder() { + return new ConstructorWithToBuilderBuilder(); + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder toBuilder() { + return new ConstructorWithToBuilderBuilder().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..a3ae2c6d --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,40 @@ +import lombok.experimental.Tolerate; +public class BuilderWithTolerate { + private final int value; + public static void main(String[] args) { + BuilderWithTolerate.builder().withValue("42").build(); + } + public static class BuilderWithTolerateBuilder { + @java.lang.SuppressWarnings("all") + private int value; + @Tolerate + public BuilderWithTolerateBuilder withValue(String s) { + return this.withValue(Integer.parseInt(s)); + } + @java.lang.SuppressWarnings("all") + BuilderWithTolerateBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithTolerateBuilder withValue(final int value) { + this.value = value; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithTolerate build() { + return new BuilderWithTolerate(value); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value + ")"; + } + } + @java.lang.SuppressWarnings("all") + BuilderWithTolerate(final int value) { + this.value = value; + } + @java.lang.SuppressWarnings("all") + public static BuilderWithTolerateBuilder builder() { + return new BuilderWithTolerateBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java new file mode 100644 index 00000000..98c42fe9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -0,0 +1,27 @@ +import java.util.List; +@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderWithPrefix { + protected static @java.lang.SuppressWarnings("all") class BuilderWithPrefixBuilder { + private @java.lang.SuppressWarnings("all") int unprefixed; + @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { + this.unprefixed = unprefixed; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithPrefix build() { + return new BuilderWithPrefix(unprefixed); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); + } + } + private int unprefixed; + @java.lang.SuppressWarnings("all") BuilderWithPrefix(final int unprefixed) { + super(); + this.unprefixed = unprefixed; + } + protected static @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder builder() { + return new BuilderWithPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..02369861 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,121 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +import lombok.Singular; +@Target(ElementType.TYPE_USE) @interface MyAnnotation { +} +@lombok.Builder(setterPrefix = "with") class BuilderSingularAnnotatedTypes { + public static @java.lang.SuppressWarnings("all") class BuilderSingularAnnotatedTypesBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> foos; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> bars$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; + @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withFoo(final @MyAnnotation @NonNull String foo) { + if ((foo == null)) + { + throw new java.lang.NullPointerException("foo is marked non-null but is null"); + } + if ((this.foos == null)) + this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.add(foo); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withFoos(final java.util.Collection foos) { + if ((this.foos == null)) + this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.addAll(foos); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearFoos() { + if ((this.foos != null)) + this.foos.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withBar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull Integer barValue) { + if ((barKey == null)) + { + throw new java.lang.NullPointerException("barKey is marked non-null but is null"); + } + if ((barValue == null)) + { + throw new java.lang.NullPointerException("barValue is marked non-null but is null"); + } + if ((this.bars$key == null)) + { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + this.bars$key.add(barKey); + this.bars$value.add(barValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withBars(final java.util.Map bars) { + if ((this.bars$key == null)) + { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + for (java.util.Map.Entry $lombokEntry : bars.entrySet()) + { + this.bars$key.add($lombokEntry.getKey()); + this.bars$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearBars() { + if ((this.bars$key != null)) + { + this.bars$key.clear(); + this.bars$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes build() { + java.util.Set<@MyAnnotation @NonNull String> foos; + switch (((this.foos == null) ? 0 : this.foos.size())) { + case 0 : + foos = java.util.Collections.emptySet(); + break; + case 1 : + foos = java.util.Collections.singleton(this.foos.get(0)); + break; + default : + foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(((this.foos.size() < 0x40000000) ? ((1 + this.foos.size()) + ((this.foos.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + foos.addAll(this.foos); + foos = java.util.Collections.unmodifiableSet(foos); + } + java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + switch (((this.bars$key == null) ? 0 : this.bars$key.size())) { + case 0 : + bars = java.util.Collections.emptyMap(); + break; + case 1 : + bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0)); + break; + default : + bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(((this.bars$key.size() < 0x40000000) ? ((1 + this.bars$key.size()) + ((this.bars$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.bars$key.size()); $i ++) + bars.put(this.bars$key.get($i), this.bars$value.get($i)); + bars = java.util.Collections.unmodifiableMap(bars); + } + return new BuilderSingularAnnotatedTypes(foos, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")"); + } + } + private @Singular Set<@MyAnnotation @NonNull String> foos; + private @Singular Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { + super(); + this.foos = foos; + this.bars = bars; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder builder() { + return new BuilderSingularAnnotatedTypesBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..e9b0205d --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,125 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +import com.google.common.collect.ImmutableTable; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaListsSets { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsBuilder { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder cards; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder frogs; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder rawSet; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedSet.Builder passes; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableTable.Builder users; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withCard(final T card) { + if ((this.cards == null)) + this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withCards(final java.lang.Iterable cards) { + if ((this.cards == null)) + this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearCards() { + this.cards = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withFrog(final Number frog) { + if ((this.frogs == null)) + this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withFrogs(final java.lang.Iterable frogs) { + if ((this.frogs == null)) + this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearFrogs() { + this.frogs = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Object rawSet) { + if ((this.rawSet == null)) + this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Iterable rawSet) { + if ((this.rawSet == null)) + this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearRawSet() { + this.rawSet = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withPass(final String pass) { + if ((this.passes == null)) + this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withPasses(final java.lang.Iterable passes) { + if ((this.passes == null)) + this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearPasses() { + this.passes = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withUser(final Number rowKey, final Number columnKey, final String value) { + if ((this.users == null)) + this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.put(rowKey, columnKey, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withUsers(final com.google.common.collect.Table users) { + if ((this.users == null)) + this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.putAll(users); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearUsers() { + this.users = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets build() { + com.google.common.collect.ImmutableList cards = ((this.cards == null) ? com.google.common.collect.ImmutableList.of() : this.cards.build()); + com.google.common.collect.ImmutableCollection frogs = ((this.frogs == null) ? com.google.common.collect.ImmutableList.of() : this.frogs.build()); + com.google.common.collect.ImmutableSet rawSet = ((this.rawSet == null) ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build()); + com.google.common.collect.ImmutableSortedSet passes = ((this.passes == null) ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build()); + com.google.common.collect.ImmutableTable users = ((this.users == null) ? com.google.common.collect.ImmutableTable.of() : this.users.build()); + return new BuilderSingularGuavaListsSets(cards, frogs, rawSet, passes, users); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((("BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ", users=") + this.users) + ")"); + } + } + private @Singular ImmutableList cards; + private @Singular ImmutableCollection frogs; + private @SuppressWarnings("all") @Singular("rawSet") ImmutableSet rawSet; + private @Singular ImmutableSortedSet passes; + private @Singular ImmutableTable users; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes, final ImmutableTable users) { + super(); + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + this.users = users; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder builder() { + return new BuilderSingularGuavaListsSetsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java new file mode 100644 index 00000000..fe1f0036 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java @@ -0,0 +1,83 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaMaps { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsBuilder { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableMap.Builder battleaxes; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder vertices; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableBiMap.Builder rawMap; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withBattleaxe(final K key, final V value) { + if ((this.battleaxes == null)) + this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withBattleaxes(final java.util.Map battleaxes) { + if ((this.battleaxes == null)) + this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.putAll(battleaxes); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder clearBattleaxes() { + this.battleaxes = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withVertex(final Integer key, final V value) { + if ((this.vertices == null)) + this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withVertices(final java.util.Map vertices) { + if ((this.vertices == null)) + this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.putAll(vertices); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder clearVertices() { + this.vertices = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withRawMap(final java.lang.Object key, final java.lang.Object value) { + if ((this.rawMap == null)) + this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withRawMap(final java.util.Map rawMap) { + if ((this.rawMap == null)) + this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.putAll(rawMap); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder clearRawMap() { + this.rawMap = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps build() { + com.google.common.collect.ImmutableMap battleaxes = ((this.battleaxes == null) ? com.google.common.collect.ImmutableMap.of() : this.battleaxes.build()); + com.google.common.collect.ImmutableSortedMap vertices = ((this.vertices == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.vertices.build()); + com.google.common.collect.ImmutableBiMap rawMap = ((this.rawMap == null) ? com.google.common.collect.ImmutableBiMap.of() : this.rawMap.build()); + return new BuilderSingularGuavaMaps(battleaxes, vertices, rawMap); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder(battleaxes=" + this.battleaxes) + ", vertices=") + this.vertices) + ", rawMap=") + this.rawMap) + ")"); + } + } + private @Singular ImmutableMap battleaxes; + private @Singular ImmutableSortedMap vertices; + private @SuppressWarnings("all") @Singular("rawMap") ImmutableBiMap rawMap; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps(final ImmutableMap battleaxes, final ImmutableSortedMap vertices, final ImmutableBiMap rawMap) { + super(); + this.battleaxes = battleaxes; + this.vertices = vertices; + this.rawMap = rawMap; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder builder() { + return new BuilderSingularGuavaMapsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..110cc2c3 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,116 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularLists { + public static @java.lang.SuppressWarnings("all") class BuilderSingularListsBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList children; + private @java.lang.SuppressWarnings("all") java.util.ArrayList scarves; + private @java.lang.SuppressWarnings("all") java.util.ArrayList rawList; + @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withChild(final T child) { + if ((this.children == null)) + this.children = new java.util.ArrayList(); + this.children.add(child); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withChildren(final java.util.Collection children) { + if ((this.children == null)) + this.children = new java.util.ArrayList(); + this.children.addAll(children); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder clearChildren() { + if ((this.children != null)) + this.children.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withScarf(final Number scarf) { + if ((this.scarves == null)) + this.scarves = new java.util.ArrayList(); + this.scarves.add(scarf); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withScarves(final java.util.Collection scarves) { + if ((this.scarves == null)) + this.scarves = new java.util.ArrayList(); + this.scarves.addAll(scarves); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder clearScarves() { + if ((this.scarves != null)) + this.scarves.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withRawList(final java.lang.Object rawList) { + if ((this.rawList == null)) + this.rawList = new java.util.ArrayList(); + this.rawList.add(rawList); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withRawList(final java.util.Collection rawList) { + if ((this.rawList == null)) + this.rawList = new java.util.ArrayList(); + this.rawList.addAll(rawList); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder clearRawList() { + if ((this.rawList != null)) + this.rawList.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularLists build() { + java.util.List children; + switch (((this.children == null) ? 0 : this.children.size())) { + case 0 : + children = java.util.Collections.emptyList(); + break; + case 1 : + children = java.util.Collections.singletonList(this.children.get(0)); + break; + default : + children = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.children)); + } + java.util.Collection scarves; + switch (((this.scarves == null) ? 0 : this.scarves.size())) { + case 0 : + scarves = java.util.Collections.emptyList(); + break; + case 1 : + scarves = java.util.Collections.singletonList(this.scarves.get(0)); + break; + default : + scarves = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.scarves)); + } + java.util.List rawList; + switch (((this.rawList == null) ? 0 : this.rawList.size())) { + case 0 : + rawList = java.util.Collections.emptyList(); + break; + case 1 : + rawList = java.util.Collections.singletonList(this.rawList.get(0)); + break; + default : + rawList = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.rawList)); + } + return new BuilderSingularLists(children, scarves, rawList); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children) + ", scarves=") + this.scarves) + ", rawList=") + this.rawList) + ")"); + } + } + private @Singular List children; + private @Singular Collection scarves; + private @SuppressWarnings("all") @Singular("rawList") List rawList; + @java.lang.SuppressWarnings("all") BuilderSingularLists(final List children, final Collection scarves, final List rawList) { + super(); + this.children = children; + this.scarves = scarves; + this.rawList = rawList; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder builder() { + return new BuilderSingularListsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..9193ccf9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,209 @@ +import java.util.Map; +import java.util.SortedMap; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularMaps { + public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList women$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList women$value; + private @java.lang.SuppressWarnings("all") java.util.ArrayList men$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList men$value; + private @java.lang.SuppressWarnings("all") java.util.ArrayList rawMap$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList rawMap$value; + private @java.lang.SuppressWarnings("all") java.util.ArrayList stringMap$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList stringMap$value; + @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withWoman(final K womanKey, final V womanValue) { + if ((this.women$key == null)) + { + this.women$key = new java.util.ArrayList(); + this.women$value = new java.util.ArrayList(); + } + this.women$key.add(womanKey); + this.women$value.add(womanValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withWomen(final java.util.Map women) { + if ((this.women$key == null)) + { + this.women$key = new java.util.ArrayList(); + this.women$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : women.entrySet()) + { + this.women$key.add($lombokEntry.getKey()); + this.women$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearWomen() { + if ((this.women$key != null)) + { + this.women$key.clear(); + this.women$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withMan(final K manKey, final Number manValue) { + if ((this.men$key == null)) + { + this.men$key = new java.util.ArrayList(); + this.men$value = new java.util.ArrayList(); + } + this.men$key.add(manKey); + this.men$value.add(manValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withMen(final java.util.Map men) { + if ((this.men$key == null)) + { + this.men$key = new java.util.ArrayList(); + this.men$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : men.entrySet()) + { + this.men$key.add($lombokEntry.getKey()); + this.men$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearMen() { + if ((this.men$key != null)) + { + this.men$key.clear(); + this.men$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withRawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) { + if ((this.rawMap$key == null)) + { + this.rawMap$key = new java.util.ArrayList(); + this.rawMap$value = new java.util.ArrayList(); + } + this.rawMap$key.add(rawMapKey); + this.rawMap$value.add(rawMapValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withRawMap(final java.util.Map rawMap) { + if ((this.rawMap$key == null)) + { + this.rawMap$key = new java.util.ArrayList(); + this.rawMap$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : rawMap.entrySet()) + { + this.rawMap$key.add($lombokEntry.getKey()); + this.rawMap$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearRawMap() { + if ((this.rawMap$key != null)) + { + this.rawMap$key.clear(); + this.rawMap$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withStringMap(final String stringMapKey, final V stringMapValue) { + if ((this.stringMap$key == null)) + { + this.stringMap$key = new java.util.ArrayList(); + this.stringMap$value = new java.util.ArrayList(); + } + this.stringMap$key.add(stringMapKey); + this.stringMap$value.add(stringMapValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withStringMap(final java.util.Map stringMap) { + if ((this.stringMap$key == null)) + { + this.stringMap$key = new java.util.ArrayList(); + this.stringMap$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : stringMap.entrySet()) + { + this.stringMap$key.add($lombokEntry.getKey()); + this.stringMap$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearStringMap() { + if ((this.stringMap$key != null)) + { + this.stringMap$key.clear(); + this.stringMap$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMaps build() { + java.util.Map women; + switch (((this.women$key == null) ? 0 : this.women$key.size())) { + case 0 : + women = java.util.Collections.emptyMap(); + break; + case 1 : + women = java.util.Collections.singletonMap(this.women$key.get(0), this.women$value.get(0)); + break; + default : + women = new java.util.LinkedHashMap(((this.women$key.size() < 0x40000000) ? ((1 + this.women$key.size()) + ((this.women$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.women$key.size()); $i ++) + women.put(this.women$key.get($i), this.women$value.get($i)); + women = java.util.Collections.unmodifiableMap(women); + } + java.util.SortedMap men = new java.util.TreeMap(); + if ((this.men$key != null)) + for (int $i = 0;; ($i < ((this.men$key == null) ? 0 : this.men$key.size())); $i ++) + men.put(this.men$key.get($i), this.men$value.get($i)); + men = java.util.Collections.unmodifiableSortedMap(men); + java.util.Map rawMap; + switch (((this.rawMap$key == null) ? 0 : this.rawMap$key.size())) { + case 0 : + rawMap = java.util.Collections.emptyMap(); + break; + case 1 : + rawMap = java.util.Collections.singletonMap(this.rawMap$key.get(0), this.rawMap$value.get(0)); + break; + default : + rawMap = new java.util.LinkedHashMap(((this.rawMap$key.size() < 0x40000000) ? ((1 + this.rawMap$key.size()) + ((this.rawMap$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.rawMap$key.size()); $i ++) + rawMap.put(this.rawMap$key.get($i), this.rawMap$value.get($i)); + rawMap = java.util.Collections.unmodifiableMap(rawMap); + } + java.util.Map stringMap; + switch (((this.stringMap$key == null) ? 0 : this.stringMap$key.size())) { + case 0 : + stringMap = java.util.Collections.emptyMap(); + break; + case 1 : + stringMap = java.util.Collections.singletonMap(this.stringMap$key.get(0), this.stringMap$value.get(0)); + break; + default : + stringMap = new java.util.LinkedHashMap(((this.stringMap$key.size() < 0x40000000) ? ((1 + this.stringMap$key.size()) + ((this.stringMap$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.stringMap$key.size()); $i ++) + stringMap.put(this.stringMap$key.get($i), this.stringMap$value.get($i)); + stringMap = java.util.Collections.unmodifiableMap(stringMap); + } + return new BuilderSingularMaps(women, men, rawMap, stringMap); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((((((((("BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key) + ", women$value=") + this.women$value) + ", men$key=") + this.men$key) + ", men$value=") + this.men$value) + ", rawMap$key=") + this.rawMap$key) + ", rawMap$value=") + this.rawMap$value) + ", stringMap$key=") + this.stringMap$key) + ", stringMap$value=") + this.stringMap$value) + ")"); + } + } + private @Singular Map women; + private @Singular SortedMap men; + private @SuppressWarnings("all") @Singular("rawMap") Map rawMap; + private @Singular("stringMap") Map stringMap; + @java.lang.SuppressWarnings("all") BuilderSingularMaps(final Map women, final SortedMap men, final Map rawMap, final Map stringMap) { + super(); + this.women = women; + this.men = men; + this.rawMap = rawMap; + this.stringMap = stringMap; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder builder() { + return new BuilderSingularMapsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..a7754a99 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,114 @@ +import java.util.List; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAuto { + public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutoBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList things; + private @java.lang.SuppressWarnings("all") java.util.ArrayList widgets; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items; + @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withThings(final String things) { + if ((this.things == null)) + this.things = new java.util.ArrayList(); + this.things.add(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withThings(final java.util.Collection things) { + if ((this.things == null)) + this.things = new java.util.ArrayList(); + this.things.addAll(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder clearThings() { + if ((this.things != null)) + this.things.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withWidget(final String widget) { + if ((this.widgets == null)) + this.widgets = new java.util.ArrayList(); + this.widgets.add(widget); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withWidgets(final java.util.Collection widgets) { + if ((this.widgets == null)) + this.widgets = new java.util.ArrayList(); + this.widgets.addAll(widgets); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder clearWidgets() { + if ((this.widgets != null)) + this.widgets.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withItems(final String items) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(items); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withItems(final java.util.Collection items) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder clearItems() { + if ((this.items != null)) + this.items.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAuto build() { + java.util.List things; + switch (((this.things == null) ? 0 : this.things.size())) { + case 0 : + things = java.util.Collections.emptyList(); + break; + case 1 : + things = java.util.Collections.singletonList(this.things.get(0)); + break; + default : + things = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.things)); + } + java.util.List widgets; + switch (((this.widgets == null) ? 0 : this.widgets.size())) { + case 0 : + widgets = java.util.Collections.emptyList(); + break; + case 1 : + widgets = java.util.Collections.singletonList(this.widgets.get(0)); + break; + default : + widgets = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.widgets)); + } + java.util.List items; + switch (((this.items == null) ? 0 : this.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(this.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.items)); + } + return new BuilderSingularNoAuto(things, widgets, items); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(things=" + this.things) + ", widgets=") + this.widgets) + ", items=") + this.items) + ")"); + } + } + private @Singular List things; + private @Singular("widget") List widgets; + private @Singular List items; + @java.lang.SuppressWarnings("all") BuilderSingularNoAuto(final List things, final List widgets, final List items) { + super(); + this.things = things; + this.widgets = widgets; + this.items = items; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder builder() { + return new BuilderSingularNoAutoBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..6f12f986 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,83 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularRedirectToGuava { + public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaBuilder { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder dangerMice; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder things; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDangerMouse(final String dangerMouse) { + if ((this.dangerMice == null)) + this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.add(dangerMouse); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDangerMice(final java.lang.Iterable dangerMice) { + if ((this.dangerMice == null)) + this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.addAll(dangerMice); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearDangerMice() { + this.dangerMice = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withThing(final Integer key, final Number value) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withThings(final java.util.Map things) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.putAll(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearThings() { + this.things = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDoohickey(final Class doohickey) { + if ((this.doohickeys == null)) + this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.add(doohickey); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDoohickeys(final java.lang.Iterable> doohickeys) { + if ((this.doohickeys == null)) + this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.addAll(doohickeys); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearDoohickeys() { + this.doohickeys = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava build() { + java.util.Set dangerMice = ((this.dangerMice == null) ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build()); + java.util.NavigableMap things = ((this.things == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build()); + java.util.Collection> doohickeys = ((this.doohickeys == null) ? com.google.common.collect.ImmutableList.>of() : this.doohickeys.build()); + return new BuilderSingularRedirectToGuava(dangerMice, things, doohickeys); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder(dangerMice=" + this.dangerMice) + ", things=") + this.things) + ", doohickeys=") + this.doohickeys) + ")"); + } + } + private @Singular Set dangerMice; + private @Singular NavigableMap things; + private @Singular Collection> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava(final Set dangerMice, final NavigableMap things, final Collection> doohickeys) { + super(); + this.dangerMice = dangerMice; + this.things = things; + this.doohickeys = doohickeys; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder builder() { + return new BuilderSingularRedirectToGuavaBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..1bf552c5 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java @@ -0,0 +1,145 @@ +import java.util.Set; +import java.util.SortedSet; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularSets { + public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList dangerMice; + private @java.lang.SuppressWarnings("all") java.util.ArrayList octopodes; + private @java.lang.SuppressWarnings("all") java.util.ArrayList rawSet; + private @java.lang.SuppressWarnings("all") java.util.ArrayList stringSet; + @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder dangerMouse(final T dangerMouse) { + if ((this.dangerMice == null)) + this.dangerMice = new java.util.ArrayList(); + this.dangerMice.add(dangerMouse); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder dangerMice(final java.util.Collection dangerMice) { + if ((this.dangerMice == null)) + this.dangerMice = new java.util.ArrayList(); + this.dangerMice.addAll(dangerMice); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearDangerMice() { + if ((this.dangerMice != null)) + this.dangerMice.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder octopus(final Number octopus) { + if ((this.octopodes == null)) + this.octopodes = new java.util.ArrayList(); + this.octopodes.add(octopus); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder octopodes(final java.util.Collection octopodes) { + if ((this.octopodes == null)) + this.octopodes = new java.util.ArrayList(); + this.octopodes.addAll(octopodes); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearOctopodes() { + if ((this.octopodes != null)) + this.octopodes.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder rawSet(final java.lang.Object rawSet) { + if ((this.rawSet == null)) + this.rawSet = new java.util.ArrayList(); + this.rawSet.add(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder rawSet(final java.util.Collection rawSet) { + if ((this.rawSet == null)) + this.rawSet = new java.util.ArrayList(); + this.rawSet.addAll(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearRawSet() { + if ((this.rawSet != null)) + this.rawSet.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder stringSet(final String stringSet) { + if ((this.stringSet == null)) + this.stringSet = new java.util.ArrayList(); + this.stringSet.add(stringSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder stringSet(final java.util.Collection stringSet) { + if ((this.stringSet == null)) + this.stringSet = new java.util.ArrayList(); + this.stringSet.addAll(stringSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearStringSet() { + if ((this.stringSet != null)) + this.stringSet.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSets build() { + java.util.Set dangerMice; + switch (((this.dangerMice == null) ? 0 : this.dangerMice.size())) { + case 0 : + dangerMice = java.util.Collections.emptySet(); + break; + case 1 : + dangerMice = java.util.Collections.singleton(this.dangerMice.get(0)); + break; + default : + dangerMice = new java.util.LinkedHashSet(((this.dangerMice.size() < 0x40000000) ? ((1 + this.dangerMice.size()) + ((this.dangerMice.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + dangerMice.addAll(this.dangerMice); + dangerMice = java.util.Collections.unmodifiableSet(dangerMice); + } + java.util.SortedSet octopodes = new java.util.TreeSet(); + if ((this.octopodes != null)) + octopodes.addAll(this.octopodes); + octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); + java.util.Set rawSet; + switch (((this.rawSet == null) ? 0 : this.rawSet.size())) { + case 0 : + rawSet = java.util.Collections.emptySet(); + break; + case 1 : + rawSet = java.util.Collections.singleton(this.rawSet.get(0)); + break; + default : + rawSet = new java.util.LinkedHashSet(((this.rawSet.size() < 0x40000000) ? ((1 + this.rawSet.size()) + ((this.rawSet.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + rawSet.addAll(this.rawSet); + rawSet = java.util.Collections.unmodifiableSet(rawSet); + } + java.util.Set stringSet; + switch (((this.stringSet == null) ? 0 : this.stringSet.size())) { + case 0 : + stringSet = java.util.Collections.emptySet(); + break; + case 1 : + stringSet = java.util.Collections.singleton(this.stringSet.get(0)); + break; + default : + stringSet = new java.util.LinkedHashSet(((this.stringSet.size() < 0x40000000) ? ((1 + this.stringSet.size()) + ((this.stringSet.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + stringSet.addAll(this.stringSet); + stringSet = java.util.Collections.unmodifiableSet(stringSet); + } + return new BuilderSingularSets(dangerMice, octopodes, rawSet, stringSet); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice) + ", octopodes=") + this.octopodes) + ", rawSet=") + this.rawSet) + ", stringSet=") + this.stringSet) + ")"); + } + } + private @Singular Set dangerMice; + private @Singular SortedSet octopodes; + private @SuppressWarnings("all") @Singular("rawSet") Set rawSet; + private @Singular("stringSet") Set stringSet; + @java.lang.SuppressWarnings("all") BuilderSingularSets(final Set dangerMice, final SortedSet octopodes, final Set rawSet, final Set stringSet) { + super(); + this.dangerMice = dangerMice; + this.octopodes = octopodes; + this.rawSet = rawSet; + this.stringSet = stringSet; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder builder() { + return new BuilderSingularSetsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..086e0701 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,60 @@ +import lombok.Singular; +@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularToBuilderWithNull { + public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList elems; + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder withElem(final String elem) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList(); + this.elems.add(elem); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder withElems(final java.util.Collection elems) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList(); + this.elems.addAll(elems); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder clearElems() { + if ((this.elems != null)) + this.elems.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull build() { + java.util.List elems; + switch (((this.elems == null) ? 0 : this.elems.size())) { + case 0 : + elems = java.util.Collections.emptyList(); + break; + case 1 : + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default : + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); + } + return new BuilderSingularToBuilderWithNull(elems); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder(elems=" + this.elems) + ")"); + } + } + private @Singular java.util.List elems; + public static void test() { + new BuilderSingularToBuilderWithNull(null).toBuilder(); + } + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull(final java.util.List elems) { + super(); + this.elems = elems; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder builder() { + return new BuilderSingularToBuilderWithNullBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder toBuilder() { + final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder(); + if ((this.elems != null)) + builder.elems(this.elems); + return builder; + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..635b6a79 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,92 @@ +import java.util.List; +import java.util.Collection; +import lombok.Singular; +@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilder { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList objects; + private @java.lang.SuppressWarnings("all") java.util.ArrayList numbers; + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withObject(final java.lang.Object object) { + if ((this.objects == null)) + this.objects = new java.util.ArrayList(); + this.objects.add(object); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withObjects(final java.util.Collection objects) { + if ((this.objects == null)) + this.objects = new java.util.ArrayList(); + this.objects.addAll(objects); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + if ((this.objects != null)) + this.objects.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withNumber(final Number number) { + if ((this.numbers == null)) + this.numbers = new java.util.ArrayList(); + this.numbers.add(number); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withNumbers(final java.util.Collection numbers) { + if ((this.numbers == null)) + this.numbers = new java.util.ArrayList(); + this.numbers.addAll(numbers); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + if ((this.numbers != null)) + this.numbers.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder build() { + java.util.List objects; + switch (((this.objects == null) ? 0 : this.objects.size())) { + case 0 : + objects = java.util.Collections.emptyList(); + break; + case 1 : + objects = java.util.Collections.singletonList(this.objects.get(0)); + break; + default : + objects = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.objects)); + } + java.util.Collection numbers; + switch (((this.numbers == null) ? 0 : this.numbers.size())) { + case 0 : + numbers = java.util.Collections.emptyList(); + break; + case 1 : + numbers = java.util.Collections.singletonList(this.numbers.get(0)); + break; + default : + numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.numbers)); + } + return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects) + ", numbers=") + this.numbers) + ")"); + } + } + private @Singular List objects; + private @Singular Collection numbers; + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder(final List objects, final Collection numbers) { + super(); + this.objects = objects; + this.numbers = numbers; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderBuilder builder = new BuilderSingularWildcardListsWithToBuilderBuilder(); + if ((this.objects != null)) + builder.objects(this.objects); + if ((this.numbers != null)) + builder.numbers(this.numbers); + return builder; + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..d9cea692 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,51 @@ +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") class BuilderSingularWithPrefixes { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList elems; + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder withElem(final String elem) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList(); + this.elems.add(elem); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder withElems(final java.util.Collection elems) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList(); + this.elems.addAll(elems); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder clearElems() { + if ((this.elems != null)) + this.elems.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes build() { + java.util.List elems; + switch (((this.elems == null) ? 0 : this.elems.size())) { + case 0 : + elems = java.util.Collections.emptyList(); + break; + case 1 : + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default : + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); + } + return new BuilderSingularWithPrefixes(elems); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder(elems=" + this.elems) + ")"); + } + } + private @Singular java.util.List _elems; + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes(final java.util.List elems) { + super(); + this._elems = elems; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder builder() { + return new BuilderSingularWithPrefixesBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..ed62dc85 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,33 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB { +} +@lombok.Builder(setterPrefix = "with") class BuilderTypeAnnos { + public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosBuilder { + private @java.lang.SuppressWarnings("all") List foo; + @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder withFoo(final @TA List foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderTypeAnnos build() { + return new BuilderTypeAnnos(foo); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo) + ")"); + } + } + private @TA @TB List foo; + @java.lang.SuppressWarnings("all") BuilderTypeAnnos(final @TA List foo) { + super(); + this.foo = foo; + } + public static @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder builder() { + return new BuilderTypeAnnosBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..ffecad46 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,90 @@ +import java.util.List; +final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue { + public static @java.lang.SuppressWarnings("all") class BuilderAndValueBuilder { + @java.lang.SuppressWarnings("all") BuilderAndValueBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderAndValue build() { + return new BuilderAndValue(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "BuilderAndValue.BuilderAndValueBuilder()"; + } + } + private final int zero = 0; + @java.lang.SuppressWarnings("all") BuilderAndValue() { + super(); + } + public static @java.lang.SuppressWarnings("all") BuilderAndValueBuilder builder() { + return new BuilderAndValueBuilder(); + } + public @java.lang.SuppressWarnings("all") int getZero() { + return this.zero; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderAndValue))) + return false; + final BuilderAndValue other = (BuilderAndValue) o; + if ((this.getZero() != other.getZero())) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.getZero()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderAndValue(zero=" + this.getZero()) + ")"); + } +} +@lombok.Builder @lombok.Data class BuilderAndData { + public static @java.lang.SuppressWarnings("all") class BuilderAndDataBuilder { + @java.lang.SuppressWarnings("all") BuilderAndDataBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderAndData build() { + return new BuilderAndData(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "BuilderAndData.BuilderAndDataBuilder()"; + } + } + private final int zero = 0; + @java.lang.SuppressWarnings("all") BuilderAndData() { + super(); + } + public static @java.lang.SuppressWarnings("all") BuilderAndDataBuilder builder() { + return new BuilderAndDataBuilder(); + } + public @java.lang.SuppressWarnings("all") int getZero() { + return this.zero; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderAndData))) + return false; + final BuilderAndData other = (BuilderAndData) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getZero() != other.getZero())) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof BuilderAndData); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.getZero()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderAndData(zero=" + this.getZero()) + ")"); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..388e813d --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,47 @@ +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = {"p", "_"}) class BuilderWithAccessors { + public static @java.lang.SuppressWarnings("all") class BuilderWithAccessorsBuilder { + private @java.lang.SuppressWarnings("all") int plower; + private @java.lang.SuppressWarnings("all") int upper; + private @java.lang.SuppressWarnings("all") int foo; + private @java.lang.SuppressWarnings("all") int _bar; + @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withPlower(final int plower) { + this.plower = plower; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withUpper(final int upper) { + this.upper = upper; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withFoo(final int foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder with_Bar(final int _bar) { + this._bar = _bar; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessors build() { + return new BuilderWithAccessors(plower, upper, foo, _bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithAccessors.BuilderWithAccessorsBuilder(plower=" + this.plower) + ", upper=") + this.upper) + ", foo=") + this.foo) + ", _bar=") + this._bar) + ")"); + } + } + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; + @java.lang.SuppressWarnings("all") BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + super(); + this.plower = plower; + this.pUpper = upper; + this._foo = foo; + this.__bar = _bar; + } + public static @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder builder() { + return new BuilderWithAccessorsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..465517f7 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,33 @@ +public @lombok.Builder(setterPrefix = "with") class BuilderWithBadNames { + public static @java.lang.SuppressWarnings("all") class BuilderWithBadNamesBuilder { + private @java.lang.SuppressWarnings("all") String build; + private @java.lang.SuppressWarnings("all") String toString; + @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder withBuild(final String build) { + this.build = build; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder withToString(final String toString) { + this.toString = toString; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNames build() { + return new BuilderWithBadNames(build, toString); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build) + ", toString=") + this.toString) + ")"); + } + } + String build; + String toString; + @java.lang.SuppressWarnings("all") BuilderWithBadNames(final String build, final String toString) { + super(); + this.build = build; + this.toString = toString; + } + public static @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder builder() { + return new BuilderWithBadNamesBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..0d8e023f --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,87 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; +public @Builder(setterPrefix = "with") class BuilderWithDeprecated { + public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedBuilder { + private @java.lang.SuppressWarnings("all") String dep1; + private @java.lang.SuppressWarnings("all") int dep2; + private @java.lang.SuppressWarnings("all") java.util.ArrayList strings; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder numbers; + @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() { + super(); + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withDep1(final String dep1) { + this.dep1 = dep1; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withDep2(final int dep2) { + this.dep2 = dep2; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withString(final String string) { + if ((this.strings == null)) + this.strings = new java.util.ArrayList(); + this.strings.add(string); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withStrings(final java.util.Collection strings) { + if ((this.strings == null)) + this.strings = new java.util.ArrayList(); + this.strings.addAll(strings); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder clearStrings() { + if ((this.strings != null)) + this.strings.clear(); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withNumber(final Integer number) { + if ((this.numbers == null)) + this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.add(number); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withNumbers(final java.lang.Iterable numbers) { + if ((this.numbers == null)) + this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.addAll(numbers); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder clearNumbers() { + this.numbers = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithDeprecated build() { + java.util.List strings; + switch (((this.strings == null) ? 0 : this.strings.size())) { + case 0 : + strings = java.util.Collections.emptyList(); + break; + case 1 : + strings = java.util.Collections.singletonList(this.strings.get(0)); + break; + default : + strings = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.strings)); + } + com.google.common.collect.ImmutableList numbers = ((this.numbers == null) ? com.google.common.collect.ImmutableList.of() : this.numbers.build()); + return new BuilderWithDeprecated(dep1, dep2, strings, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithDeprecated.BuilderWithDeprecatedBuilder(dep1=" + this.dep1) + ", dep2=") + this.dep2) + ", strings=") + this.strings) + ", numbers=") + this.numbers) + ")"); + } + } + String dep1; + @Deprecated int dep2; + @Singular @Deprecated java.util.List strings; + @Singular @Deprecated ImmutableList numbers; + @java.lang.SuppressWarnings("all") BuilderWithDeprecated(final String dep1, final int dep2, final java.util.List strings, final ImmutableList numbers) { + super(); + this.dep1 = dep1; + this.dep2 = dep2; + this.strings = strings; + this.numbers = numbers; + } + public static @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder builder() { + return new BuilderWithDeprecatedBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..220a8a63 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,36 @@ +import lombok.Builder; +class BuilderWithExistingBuilderClass { + public static class BuilderWithExistingBuilderClassBuilder { + private @java.lang.SuppressWarnings("all") boolean arg2; + private @java.lang.SuppressWarnings("all") String arg3; + private Z arg1; + public void withArg2(boolean arg) { + } + @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder withArg1(final Z arg1) { + this.arg1 = arg1; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClass build() { + return BuilderWithExistingBuilderClass.staticMethod(arg1, arg2, arg3); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ")"); + } + } + BuilderWithExistingBuilderClass() { + super(); + } + public static @Builder(setterPrefix = "with") BuilderWithExistingBuilderClass staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + public static @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder builder() { + return new BuilderWithExistingBuilderClassBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..0b934767 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,27 @@ +import lombok.Builder; +@Builder(toBuilder = true,builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethod { + public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodBuilder { + private @java.lang.SuppressWarnings("all") String a; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder withA(final String a) { + this.a = a; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod build() { + return new BuilderWithNoBuilderMethod(a); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a) + ")"); + } + } + private String a = ""; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod(final String a) { + super(); + this.a = a; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder toBuilder() { + return new BuilderWithNoBuilderMethodBuilder().withA(this.a); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..6379e25f --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,34 @@ +@lombok.Builder(setterPrefix = "with") class BuilderWithNonNull { + public static @java.lang.SuppressWarnings("all") class BuilderWithNonNullBuilder { + private @java.lang.SuppressWarnings("all") String id; + @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder withId(final @lombok.NonNull String id) { + if ((id == null)) + { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithNonNull build() { + return new BuilderWithNonNull(id); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNonNull.BuilderWithNonNullBuilder(id=" + this.id) + ")"); + } + } + private final @lombok.NonNull String id; + @java.lang.SuppressWarnings("all") BuilderWithNonNull(final @lombok.NonNull String id) { + super(); + if ((id == null)) + { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + } + public static @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder builder() { + return new BuilderWithNonNullBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithPrefix.java b/test/transform/resource/after-ecj/BuilderWithPrefix.java deleted file mode 100644 index 98c42fe9..00000000 --- a/test/transform/resource/after-ecj/BuilderWithPrefix.java +++ /dev/null @@ -1,27 +0,0 @@ -import java.util.List; -@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderWithPrefix { - protected static @java.lang.SuppressWarnings("all") class BuilderWithPrefixBuilder { - private @java.lang.SuppressWarnings("all") int unprefixed; - @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() { - super(); - } - public @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { - this.unprefixed = unprefixed; - return this; - } - public @java.lang.SuppressWarnings("all") BuilderWithPrefix build() { - return new BuilderWithPrefix(unprefixed); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); - } - } - private int unprefixed; - @java.lang.SuppressWarnings("all") BuilderWithPrefix(final int unprefixed) { - super(); - this.unprefixed = unprefixed; - } - protected static @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder builder() { - return new BuilderWithPrefixBuilder(); - } -} diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..32b9c20e --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,78 @@ +import java.util.Set; +import lombok.Builder; +import lombok.Value; +public class BuilderWithRecursiveGenerics { + interface Inter> { + } + public static final @Builder(setterPrefix = "with(setterPrefix = "with")") @Value class Test, Quz extends Inter> { + public static @java.lang.SuppressWarnings("all") class TestBuilder, Quz extends Inter> { + private @java.lang.SuppressWarnings("all") Foo foo; + private @java.lang.SuppressWarnings("all") Bar bar; + @java.lang.SuppressWarnings("all") TestBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") TestBuilder withFoo(final Foo foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") TestBuilder withBar(final Bar bar) { + this.bar = bar; + return this; + } + public @java.lang.SuppressWarnings("all") Test build() { + return new Test(foo, bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo) + ", bar=") + this.bar) + ")"); + } + } + private final Foo foo; + private final Bar bar; + @java.lang.SuppressWarnings("all") Test(final Foo foo, final Bar bar) { + super(); + this.foo = foo; + this.bar = bar; + } + public static @java.lang.SuppressWarnings("all") , Quz extends Inter>TestBuilder builder() { + return new TestBuilder(); + } + public @java.lang.SuppressWarnings("all") Foo getFoo() { + return this.foo; + } + public @java.lang.SuppressWarnings("all") Bar getBar() { + return this.bar; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderWithRecursiveGenerics.Test))) + return false; + final BuilderWithRecursiveGenerics.Test other = (BuilderWithRecursiveGenerics.Test) o; + final java.lang.Object this$foo = this.getFoo(); + final java.lang.Object other$foo = other.getFoo(); + if (((this$foo == null) ? (other$foo != null) : (! this$foo.equals(other$foo)))) + return false; + final java.lang.Object this$bar = this.getBar(); + final java.lang.Object other$bar = other.getBar(); + if (((this$bar == null) ? (other$bar != null) : (! this$bar.equals(other$bar)))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.getFoo(); + result = ((result * PRIME) + (($foo == null) ? 43 : $foo.hashCode())); + final java.lang.Object $bar = this.getBar(); + result = ((result * PRIME) + (($bar == null) ? 43 : $bar.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); + } + } + public BuilderWithRecursiveGenerics() { + super(); + } +} + diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..85378cab --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,123 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true,setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilder { + public static @java.lang.SuppressWarnings("all") class BuilderWithToBuilderBuilder { + private @java.lang.SuppressWarnings("all") String one; + private @java.lang.SuppressWarnings("all") String two; + private @java.lang.SuppressWarnings("all") T foo; + private @java.lang.SuppressWarnings("all") java.util.ArrayList bars; + @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withOne(final String one) { + this.one = one; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withTwo(final String two) { + this.two = two; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withFoo(final T foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withBar(final T bar) { + if ((this.bars == null)) + this.bars = new java.util.ArrayList(); + this.bars.add(bar); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withBars(final java.util.Collection bars) { + if ((this.bars == null)) + this.bars = new java.util.ArrayList(); + this.bars.addAll(bars); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder clearBars() { + if ((this.bars != null)) + this.bars.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilder build() { + java.util.List bars; + switch (((this.bars == null) ? 0 : this.bars.size())) { + case 0 : + bars = java.util.Collections.emptyList(); + break; + case 1 : + bars = java.util.Collections.singletonList(this.bars.get(0)); + break; + default : + bars = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.bars)); + } + return new BuilderWithToBuilder(one, two, foo, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one) + ", two=") + this.two) + ", foo=") + this.foo) + ", bars=") + this.bars) + ")"); + } + } + private String mOne; + private String mTwo; + private @Builder.ObtainVia(method = "rrr",isStatic = true) T foo; + private @lombok.Singular List bars; + public static K rrr(BuilderWithToBuilder x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") BuilderWithToBuilder(final String one, final String two, final T foo, final List bars) { + super(); + this.mOne = one; + this.mTwo = two; + this.foo = foo; + this.bars = bars; + } + public static @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder builder() { + return new BuilderWithToBuilderBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder toBuilder() { + final BuilderWithToBuilderBuilder builder = new BuilderWithToBuilderBuilder().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilder.rrr(this)); + if ((this.bars != null)) + builder.withBars(this.bars); + return builder; + } +} +@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder { + public static @java.lang.SuppressWarnings("all") class ConstructorWithToBuilderBuilder { + private @java.lang.SuppressWarnings("all") String mOne; + private @java.lang.SuppressWarnings("all") T baz; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList bars; + @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder withMOne(final String mOne) { + this.mOne = mOne; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder withBaz(final T baz) { + this.baz = baz; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder withBars(final com.google.common.collect.ImmutableList bars) { + this.bars = bars; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilder build() { + return new ConstructorWithToBuilder(mOne, baz, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne) + ", baz=") + this.baz) + ", bars=") + this.bars) + ")"); + } + } + private String mOne; + private String mTwo; + private T foo; + private @lombok.Singular com.google.common.collect.ImmutableList bars; + public @Builder(toBuilder = true) ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { + super(); + } + public static @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder builder() { + return new ConstructorWithToBuilderBuilder(); + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder toBuilder() { + return new ConstructorWithToBuilderBuilder().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..a795bafc --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,34 @@ +import lombok.Builder; +import lombok.experimental.Tolerate; +public @Builder(setterPrefix = "with") class BuilderWithTolerate { + public static class BuilderWithTolerateBuilder { + private @java.lang.SuppressWarnings("all") int value; + public @Tolerate BuilderWithTolerateBuilder withValue(String s) { + return this.withValue(Integer.parseInt(s)); + } + @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder withValue(final int value) { + this.value = value; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithTolerate build() { + return new BuilderWithTolerate(value); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value) + ")"); + } + } + private final int value; + public static void main(String[] args) { + BuilderWithTolerate.builder().withValue("42").build(); + } + @java.lang.SuppressWarnings("all") BuilderWithTolerate(final int value) { + super(); + this.value = value; + } + public static @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder builder() { + return new BuilderWithTolerateBuilder(); + } +} diff --git a/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java new file mode 100644 index 00000000..38f3c029 --- /dev/null +++ b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java @@ -0,0 +1,6 @@ +import java.util.List; + +@lombok.Builder(access = lombok.AccessLevel.PROTECTED, setterPrefix = "with") +class BuilderWithPrefix { + private int unprefixed; +} diff --git a/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..2ef83429 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,14 @@ +//VERSION 8: +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +import lombok.Singular; +@Target(ElementType.TYPE_USE) +@interface MyAnnotation {} +@lombok.Builder(setterPrefix = "with") +class BuilderSingularAnnotatedTypes { + @Singular private Set<@MyAnnotation @NonNull String> foos; + @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..678b2e9f --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,16 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +import com.google.common.collect.ImmutableTable; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularGuavaListsSets { + @Singular private ImmutableList cards; + @Singular private ImmutableCollection frogs; + @SuppressWarnings("all") @Singular("rawSet") private ImmutableSet rawSet; + @Singular private ImmutableSortedSet passes; + @Singular private ImmutableTable users; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java new file mode 100644 index 00000000..89de9a9c --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java @@ -0,0 +1,12 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularGuavaMaps { + @Singular private ImmutableMap battleaxes; + @Singular private ImmutableSortedMap vertices; + @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap; +} diff --git a/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..101e7972 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,11 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularLists { + @Singular private List children; + @Singular private Collection scarves; + @SuppressWarnings("all") @Singular("rawList") private List rawList; +} diff --git a/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..e77bcf6e --- /dev/null +++ b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,15 @@ +//FORMAT: javaLangAsFQN = skip +//FORMAT: generated = skip +//FORMAT: finalParams = skip +import java.util.Map; +import java.util.SortedMap; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularMaps { + @Singular private Map women; + @Singular private SortedMap men; + @SuppressWarnings("all") @Singular("rawMap") private Map rawMap; + @Singular("stringMap") private Map stringMap; +} diff --git a/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..0474c764 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,11 @@ +//CONF: lombok.singular.auto = false +import java.util.List; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularNoAuto { + @Singular private List things; + @Singular("widget") private List widgets; + @Singular private List items; +} diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..c3fdc7c6 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,13 @@ +//CONF: lombok.singular.useGuava = true +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularRedirectToGuava { + @Singular private Set dangerMice; + @Singular private NavigableMap things; + @Singular private Collection> doohickeys; +} diff --git a/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..16026f2d --- /dev/null +++ b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java @@ -0,0 +1,12 @@ +import java.util.Set; +import java.util.SortedSet; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularSets { + @Singular private Set dangerMice; + @Singular private SortedSet octopodes; + @SuppressWarnings("all") @Singular("rawSet") private Set rawSet; + @Singular("stringSet") private Set stringSet; +} diff --git a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..f7a411f0 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,10 @@ +import lombok.Singular; + +@lombok.Builder(toBuilder = true, setterPrefix = "with") +class BuilderSingularToBuilderWithNull { + @Singular private java.util.List elems; + + public static void test() { + new BuilderSingularToBuilderWithNull(null).toBuilder(); + } +} diff --git a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..817f4be5 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,10 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(toBuilder = true, setterPrefix = "with") +class BuilderSingularWildcardListsWithToBuilder { + @Singular private List objects; + @Singular private Collection numbers; +} diff --git a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..63df4a71 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,7 @@ +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +@lombok.experimental.Accessors(prefix = "_") +class BuilderSingularWithPrefixes { + @Singular private java.util.List _elems; +} diff --git a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..65faf01d --- /dev/null +++ b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,14 @@ +//CONF: lombok.copyableAnnotations += TA +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TB { +} +@lombok.Builder(setterPrefix = "with") +class BuilderTypeAnnos { + private @TA @TB List foo; +} diff --git a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..e5d9dc92 --- /dev/null +++ b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,11 @@ +import java.util.List; + +@lombok.Builder @lombok.Value +class BuilderAndValue { + private final int zero = 0; +} + +@lombok.Builder(setterPrefix = "with") @lombok.Data +class BuilderAndData { + private final int zero = 0; +} diff --git a/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..b14527a1 --- /dev/null +++ b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,7 @@ +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix={"p", "_"}) +class BuilderWithAccessors { + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; +} diff --git a/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..da344f76 --- /dev/null +++ b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,5 @@ +@lombok.Builder(setterPrefix = "with") +public class BuilderWithBadNames { + String build; + String toString; +} diff --git a/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..5047de45 --- /dev/null +++ b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,11 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; + +@Builder(setterPrefix = "with") +public class BuilderWithDeprecated { + /** @deprecated since always */ String dep1; + @Deprecated int dep2; + @Singular @Deprecated java.util.List strings; + @Singular @Deprecated ImmutableList numbers; +} diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..f931d507 --- /dev/null +++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,15 @@ +import lombok.Builder; + +class BuilderWithExistingBuilderClass { + @Builder(setterPrefix = "with") + public static BuilderWithExistingBuilderClass staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + + public static class BuilderWithExistingBuilderClassBuilder { + private Z arg1; + + public void withArg2(boolean arg) { + } + } +} diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..fa8b8f09 --- /dev/null +++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,5 @@ +import lombok.Builder(setterPrefix = "with"); +@Builder(toBuilder = true, builderMethodName = "", setterPrefix = "with") +class BuilderWithNoBuilderMethod { + private String a = ""; +} diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..1a18fbc7 --- /dev/null +++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,5 @@ +@lombok.Builder(setterPrefix = "with") +class BuilderWithNonNull { + @lombok.NonNull + private final String id; +} diff --git a/test/transform/resource/before/BuilderWithPrefix.java b/test/transform/resource/before/BuilderWithPrefix.java deleted file mode 100644 index 38f3c029..00000000 --- a/test/transform/resource/before/BuilderWithPrefix.java +++ /dev/null @@ -1,6 +0,0 @@ -import java.util.List; - -@lombok.Builder(access = lombok.AccessLevel.PROTECTED, setterPrefix = "with") -class BuilderWithPrefix { - private int unprefixed; -} diff --git a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..85129223 --- /dev/null +++ b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,13 @@ +//issue #1298 +import java.util.Set; +import lombok.Builder; +import lombok.Value; + +public class BuilderWithRecursiveGenerics { + interface Inter> {} + + @Builder(setterPrefix = "with") @Value public static class Test, Quz extends Inter> { + Foo foo; + Bar bar; + } +} diff --git a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..8be20f58 --- /dev/null +++ b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,20 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true, setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") +class BuilderWithToBuilder { + private String mOne, mTwo; + @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; + @lombok.Singular private List bars; + public static K rrr(BuilderWithToBuilder x) { + return x.foo; + } +} +@lombok.experimental.Accessors(prefix = "m") +class ConstructorWithToBuilder { + private String mOne, mTwo; + private T foo; + @lombok.Singular private com.google.common.collect.ImmutableList bars; + @Builder(toBuilder = true) + public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { + } +} diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..2f4db558 --- /dev/null +++ b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,18 @@ +import lombok.Builder; +import lombok.experimental.Tolerate; + +@Builder(setterPrefix = "with") +public class BuilderWithTolerate { + private final int value; + + public static void main(String[] args) { + BuilderWithTolerate.builder().value("42").build(); + } + + public static class BuilderWithTolerateBuilder { + @Tolerate + public BuilderWithTolerateBuilder value(String s) { + return this.value(Integer.parseInt(s)); + } + } +} -- cgit From 5b16b48bbffdd579b26e2a7dc18684efdc32e219 Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 12 Sep 2019 11:58:10 -0500 Subject: Fix class names in after-ecj --- .../eclipse/handlers/EclipseSingularsRecipes.java | 21 +- .../lombok/eclipse/handlers/HandleBuilder.java | 217 +++++++++++---------- .../EclipseJavaUtilListSetSingularizer.java | 6 +- ...lderSingularAnnotatedTypesWithSetterPrefix.java | 30 +-- ...lderSingularGuavaListsSetsWithSetterPrefix.java | 48 ++--- .../BuilderSingularGuavaMapsWithSetterPrefix.java | 36 ++-- .../BuilderSingularListsWithSetterPrefix.java | 36 ++-- .../BuilderSingularMapsWithSetterPrefix.java | 42 ++-- .../BuilderSingularNoAutoWithSetterPrefix.java | 36 ++-- ...derSingularRedirectToGuavaWithSetterPrefix.java | 36 ++-- .../BuilderSingularSetsWithSetterPrefix.java | 42 ++-- ...rSingularToBuilderWithNullWithSetterPrefix.java | 30 +-- ...WildcardListsWithToBuilderWithSetterPrefix.java | 34 ++-- ...uilderSingularWithPrefixesWithSetterPrefix.java | 24 +-- .../BuilderTypeAnnosWithSetterPrefix.java | 20 +- .../BuilderValueDataWithSetterPrefix.java | 50 ++--- .../BuilderWithAccessorsWithSetterPrefix.java | 26 +-- .../BuilderWithBadNamesWithSetterPrefix.java | 22 +-- .../BuilderWithDeprecatedWithSetterPrefix.java | 34 ++-- ...erWithExistingBuilderClassWithSetterPrefix.java | 24 +-- ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 20 +- .../BuilderWithNonNullWithSetterPrefix.java | 20 +- ...ilderWithRecursiveGenericsWithSetterPrefix.java | 12 +- .../BuilderWithToBuilderWithSetterPrefix.java | 36 ++-- .../BuilderWithTolerateWithSetterPrefix.java | 24 +-- .../before/BuilderSimpleWithSetterPrefix.java | 2 +- 26 files changed, 474 insertions(+), 454 deletions(-) (limited to 'test/transform/resource') diff --git a/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java b/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java index da0bf471..0f463ae2 100755 --- a/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java +++ b/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java @@ -120,6 +120,7 @@ public class EclipseSingularsRecipes { private final EclipseNode annotation; private final char[] singularName; private final char[] pluralName; + private final char[] setterPrefix; private final List typeArgs; private final String targetFqn; private final EclipseSingularizer singularizer; @@ -133,8 +134,20 @@ public class EclipseSingularsRecipes { this.targetFqn = targetFqn; this.singularizer = singularizer; this.source = source; + this.setterPrefix = new char[0]; } - + + public SingularData(EclipseNode annotation, char[] singularName, char[] pluralName, List typeArgs, String targetFqn, EclipseSingularizer singularizer, ASTNode source, char[] setterPrefix) { + this.annotation = annotation; + this.singularName = singularName; + this.pluralName = pluralName; + this.typeArgs = typeArgs; + this.targetFqn = targetFqn; + this.singularizer = singularizer; + this.source = source; + this.setterPrefix = setterPrefix; + } + public void setGeneratedByRecursive(ASTNode target) { SetGeneratedByVisitor visitor = new SetGeneratedByVisitor(source); @@ -162,7 +175,11 @@ public class EclipseSingularsRecipes { public char[] getPluralName() { return pluralName; } - + + public char[] getSetterPrefix() { + return setterPrefix; + } + public List getTypeArgs() { return typeArgs; } diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index 05686429..ec2be523 100755 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2013-2019 The Project Lombok Authors. - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -101,17 +101,17 @@ import lombok.experimental.NonFinal; @HandlerPriority(-1024) //-2^10; to ensure we've picked up @FieldDefault's changes (-2048) but @Value hasn't removed itself yet (-512), so that we can error on presence of it on the builder classes. public class HandleBuilder extends EclipseAnnotationHandler { private HandleConstructor handleConstructor = new HandleConstructor(); - + private static final char[] CLEAN_FIELD_NAME = "$lombokUnclean".toCharArray(); private static final char[] CLEAN_METHOD_NAME = "$lombokClean".toCharArray(); - + private static final boolean toBoolean(Object expr, boolean defaultValue) { if (expr == null) return defaultValue; if (expr instanceof FalseLiteral) return false; if (expr instanceof TrueLiteral) return true; return ((Boolean) expr).booleanValue(); } - + static class BuilderFieldData { Annotation[] annotations; TypeReference type; @@ -124,10 +124,10 @@ public class HandleBuilder extends EclipseAnnotationHandler { ObtainVia obtainVia; EclipseNode obtainViaNode; EclipseNode originalFieldNode; - + List createdFields = new ArrayList(); } - + private static boolean equals(String a, char[] b) { if (a.length() != b.length) return false; for (int i = 0; i < b.length; i++) { @@ -135,7 +135,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } return true; } - + private static boolean equals(String a, char[][] b) { if (a == null || a.isEmpty()) return b.length == 0; String[] aParts = a.split("\\."); @@ -145,24 +145,24 @@ public class HandleBuilder extends EclipseAnnotationHandler { } return true; } - + private static final char[] DEFAULT_PREFIX = {'$', 'd', 'e', 'f', 'a', 'u', 'l', 't', '$'}; private static final char[] SET_PREFIX = {'$', 's', 'e', 't'}; private static final char[] VALUE_PREFIX = {'$', 'v', 'a', 'l', 'u', 'e'}; - + private static final char[] prefixWith(char[] prefix, char[] name) { char[] out = new char[prefix.length + name.length]; System.arraycopy(prefix, 0, out, 0, prefix.length); System.arraycopy(name, 0, out, prefix.length, name.length); return out; } - + @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.BUILDER_FLAG_USAGE, "@Builder"); CheckerFrameworkVersion cfv = getCheckerFrameworkVersion(annotationNode); long p = (long) ast.sourceStart << 32 | ast.sourceEnd; - + Builder builderInstance = annotation.getInstance(); AccessLevel accessForOuters = builderInstance.access(); if (accessForOuters == null) accessForOuters = AccessLevel.PUBLIC; @@ -171,22 +171,22 @@ public class HandleBuilder extends EclipseAnnotationHandler { accessForOuters = AccessLevel.PUBLIC; } AccessLevel accessForInners = accessForOuters == AccessLevel.PROTECTED ? AccessLevel.PUBLIC : accessForOuters; - + // These exist just to support the 'old' lombok.experimental.Builder, which had these properties. lombok.Builder no longer has them. boolean fluent = toBoolean(annotation.getActualExpression("fluent"), true); boolean chain = toBoolean(annotation.getActualExpression("chain"), true); - + String builderMethodName = builderInstance.builderMethodName(); String buildMethodName = builderInstance.buildMethodName(); String builderClassName = builderInstance.builderClassName(); String toBuilderMethodName = "toBuilder"; boolean toBuilder = builderInstance.toBuilder(); List typeArgsForToBuilder = null; - + if (builderMethodName == null) builderMethodName = "builder"; if (buildMethodName == null) buildMethodName = "build"; if (builderClassName == null) builderClassName = ""; - + boolean generateBuilderMethod; if (builderMethodName.isEmpty()) { generateBuilderMethod = false; @@ -195,74 +195,74 @@ public class HandleBuilder extends EclipseAnnotationHandler { } else { generateBuilderMethod = true; } - + if (!checkName("buildMethodName", buildMethodName, annotationNode)) return; if (!builderClassName.isEmpty()) { if (!checkName("builderClassName", builderClassName, annotationNode)) return; } - + EclipseNode parent = annotationNode.up(); - + List builderFields = new ArrayList(); TypeReference returnType; TypeParameter[] typeParams; TypeReference[] thrownExceptions; char[] nameOfStaticBuilderMethod; EclipseNode tdParent; - + EclipseNode fillParametersFrom = parent.get() instanceof AbstractMethodDeclaration ? parent : null; boolean addCleaning = false; boolean isStatic = true; - + List nonFinalNonDefaultedFields = null; - + if (builderClassName.isEmpty()) builderClassName = annotationNode.getAst().readConfiguration(ConfigurationKeys.BUILDER_CLASS_NAME); if (builderClassName == null || builderClassName.isEmpty()) builderClassName = "*Builder"; boolean replaceNameInBuilderClassName = builderClassName.contains("*"); - + if (parent.get() instanceof TypeDeclaration) { tdParent = parent; TypeDeclaration td = (TypeDeclaration) tdParent.get(); - + List allFields = new ArrayList(); boolean valuePresent = (hasAnnotation(lombok.Value.class, parent) || hasAnnotation("lombok.experimental.Value", parent)); for (EclipseNode fieldNode : HandleConstructor.findAllFields(tdParent, true)) { FieldDeclaration fd = (FieldDeclaration) fieldNode.get(); EclipseNode isDefault = findAnnotation(Builder.Default.class, fieldNode); boolean isFinal = ((fd.modifiers & ClassFileConstants.AccFinal) != 0) || (valuePresent && !hasAnnotation(NonFinal.class, fieldNode)); - + Annotation[] copyableAnnotations = findCopyableAnnotations(fieldNode); - + BuilderFieldData bfd = new BuilderFieldData(); bfd.rawName = fieldNode.getName().toCharArray(); bfd.name = removePrefixFromField(fieldNode); bfd.builderFieldName = bfd.name; bfd.annotations = copyAnnotations(fd, copyableAnnotations); bfd.type = fd.type; - bfd.singularData = getSingularData(fieldNode, ast); + bfd.singularData = getSingularData(fieldNode, ast, builderInstance.setterPrefix()); bfd.originalFieldNode = fieldNode; - + if (bfd.singularData != null && isDefault != null) { isDefault.addError("@Builder.Default and @Singular cannot be mixed."); isDefault = null; } - + if (fd.initialization == null && isDefault != null) { isDefault.addWarning("@Builder.Default requires an initializing expression (' = something;')."); isDefault = null; } - + if (fd.initialization != null && isDefault == null) { if (isFinal) continue; if (nonFinalNonDefaultedFields == null) nonFinalNonDefaultedFields = new ArrayList(); nonFinalNonDefaultedFields.add(fieldNode); } - + if (isDefault != null) { bfd.nameOfDefaultProvider = prefixWith(DEFAULT_PREFIX, bfd.name); bfd.nameOfSetFlag = prefixWith(bfd.name, SET_PREFIX); bfd.builderFieldName = prefixWith(bfd.name, VALUE_PREFIX); - + MethodDeclaration md = generateDefaultProvider(bfd.nameOfDefaultProvider, td.typeParameters, fieldNode, ast); if (md != null) injectMethod(tdParent, md); } @@ -270,10 +270,10 @@ public class HandleBuilder extends EclipseAnnotationHandler { builderFields.add(bfd); allFields.add(fieldNode); } - + handleConstructor.generateConstructor(tdParent, AccessLevel.PACKAGE, allFields, false, null, SkipIfConstructorExists.I_AM_BUILDER, Collections.emptyList(), annotationNode); - + returnType = namePlusTypeParamsToTypeReference(td.name, td.typeParameters, p); typeParams = td.typeParameters; thrownExceptions = null; @@ -286,7 +286,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { annotationNode.addError("@Builder is not supported on constructors with constructor type parameters."); return; } - + tdParent = parent.up(); TypeDeclaration td = (TypeDeclaration) tdParent.get(); returnType = namePlusTypeParamsToTypeReference(td.name, td.typeParameters, p); @@ -299,7 +299,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { MethodDeclaration md = (MethodDeclaration) parent.get(); tdParent = parent.up(); isStatic = md.isStatic(); - + if (toBuilder) { final String TO_BUILDER_NOT_SUPPORTED = "@Builder(toBuilder=true) is only supported if you return your own type."; char[] token; @@ -308,7 +308,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { annotationNode.addError(TO_BUILDER_NOT_SUPPORTED); return; } - + if (md.returnType instanceof SingleTypeReference) { token = ((SingleTypeReference) md.returnType).token; } else if (md.returnType instanceof QualifiedTypeReference) { @@ -321,17 +321,17 @@ public class HandleBuilder extends EclipseAnnotationHandler { annotationNode.addError(TO_BUILDER_NOT_SUPPORTED); return; } - + if (pkg != null && !equals(parent.getPackageDeclaration(), pkg)) { annotationNode.addError(TO_BUILDER_NOT_SUPPORTED); return; } - + if (tdParent == null || !equals(tdParent.getName(), token)) { annotationNode.addError(TO_BUILDER_NOT_SUPPORTED); return; } - + TypeParameter[] tpOnType = ((TypeDeclaration) tdParent.get()).typeParameters; TypeParameter[] tpOnMethod = md.typeParameters; TypeReference[][] tpOnRet_ = null; @@ -341,7 +341,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } else if (md.returnType instanceof ParameterizedQualifiedTypeReference) { tpOnRet_ = ((ParameterizedQualifiedTypeReference) md.returnType).typeArguments; } - + if (tpOnRet_ != null) for (int i = 0; i < tpOnRet_.length - 1; i++) { if (tpOnRet_[i] != null && tpOnRet_[i].length > 0) { annotationNode.addError("@Builder(toBuilder=true) is not supported if returning a type with generics applied to an intermediate."); @@ -350,11 +350,11 @@ public class HandleBuilder extends EclipseAnnotationHandler { } TypeReference[] tpOnRet = tpOnRet_ == null ? null : tpOnRet_[tpOnRet_.length - 1]; typeArgsForToBuilder = new ArrayList(); - + // Every typearg on this method needs to be found in the return type, but the reverse is not true. // We also need to 'map' them. - - + + if (tpOnMethod != null) for (TypeParameter onMethod : tpOnMethod) { int pos = -1; if (tpOnRet != null) for (int i = 0; i < tpOnRet.length; i++) { @@ -366,11 +366,11 @@ public class HandleBuilder extends EclipseAnnotationHandler { annotationNode.addError("@Builder(toBuilder=true) requires that each type parameter on the static method is part of the typeargs of the return value. Type parameter " + new String(onMethod.name) + " is not part of the return type."); return; } - + typeArgsForToBuilder.add(tpOnType[pos].name); } } - + returnType = copyType(md.returnType, ast); typeParams = md.typeParameters; thrownExceptions = md.thrownExceptions; @@ -394,41 +394,41 @@ public class HandleBuilder extends EclipseAnnotationHandler { annotationNode.addError("Unexpected kind of return type on annotated method. Specify 'builderClassName' to solve this problem."); return; } - + if (Character.isLowerCase(token[0])) { char[] newToken = new char[token.length]; System.arraycopy(token, 1, newToken, 1, token.length - 1); newToken[0] = Character.toTitleCase(token[0]); token = newToken; } - + builderClassName = builderClassName.replace("*", new String(token)); } } else { annotationNode.addError("@Builder is only supported on types, constructors, and methods."); return; } - + if (fillParametersFrom != null) { for (EclipseNode param : fillParametersFrom.down()) { if (param.getKind() != Kind.ARGUMENT) continue; BuilderFieldData bfd = new BuilderFieldData(); Argument arg = (Argument) param.get(); - + Annotation[] copyableAnnotations = findCopyableAnnotations(param); - + bfd.rawName = arg.name; bfd.name = arg.name; bfd.builderFieldName = bfd.name; bfd.annotations = copyAnnotations(arg, copyableAnnotations); bfd.type = arg.type; - bfd.singularData = getSingularData(param, ast); + bfd.singularData = getSingularData(param, ast, builderInstance.setterPrefix()); bfd.originalFieldNode = param; addObtainVia(bfd, param); builderFields.add(bfd); } } - + EclipseNode builderType = findInnerClass(tdParent, builderClassName); if (builderType == null) { builderType = makeBuilderClass(isStatic, tdParent, builderClassName, typeParams, ast, accessForOuters); @@ -454,7 +454,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } } - + for (BuilderFieldData bfd : builderFields) { if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) { if (bfd.singularData.getSingularizer().requiresCleaning()) { @@ -473,7 +473,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } } - + generateBuilderFields(builderType, builderFields, ast); if (addCleaning) { FieldDeclaration cleanDecl = new FieldDeclaration(CLEAN_FIELD_NAME, 0, -1); @@ -483,18 +483,18 @@ public class HandleBuilder extends EclipseAnnotationHandler { cleanDecl.traverse(new SetGeneratedByVisitor(ast), (MethodScope) null); injectFieldAndMarkGenerated(builderType, cleanDecl); } - + if (constructorExists(builderType) == MemberExistsResult.NOT_EXISTS) { ConstructorDeclaration cd = HandleConstructor.createConstructor( AccessLevel.PACKAGE, builderType, Collections.emptyList(), false, annotationNode, Collections.emptyList()); if (cd != null) injectMethod(builderType, cd); } - + for (BuilderFieldData bfd : builderFields) { makePrefixedSetterMethodsForBuilder(cfv, builderType, bfd, annotationNode, fluent, chain, accessForInners, bfd.originalFieldNode, builderInstance.setterPrefix()); } - + { MemberExistsResult methodExists = methodExists(buildMethodName, builderType, -1); if (methodExists == MemberExistsResult.EXISTS_BY_LOMBOK) methodExists = methodExists(buildMethodName, builderType, 0); @@ -503,7 +503,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { if (md != null) injectMethod(builderType, md); } } - + if (methodExists("toString", builderType, 0) == MemberExistsResult.NOT_EXISTS) { List> fieldNodes = new ArrayList>(); for (BuilderFieldData bfd : builderFields) { @@ -514,18 +514,18 @@ public class HandleBuilder extends EclipseAnnotationHandler { MethodDeclaration md = HandleToString.createToString(builderType, fieldNodes, true, false, ast, FieldAccess.ALWAYS_FIELD); if (md != null) injectMethod(builderType, md); } - + if (addCleaning) { MethodDeclaration cleanMethod = generateCleanMethod(builderFields, builderType, ast); if (cleanMethod != null) injectMethod(builderType, cleanMethod); } - + if (generateBuilderMethod && methodExists(builderMethodName, tdParent, -1) != MemberExistsResult.NOT_EXISTS) generateBuilderMethod = false; if (generateBuilderMethod) { MethodDeclaration md = generateBuilderMethod(cfv, isStatic, builderMethodName, builderClassName, tdParent, typeParams, ast, accessForOuters); if (md != null) injectMethod(tdParent, md); } - + if (toBuilder) switch (methodExists(toBuilderMethodName, tdParent, 0)) { case EXISTS_BY_USER: annotationNode.addWarning("Not generating toBuilder() as it already exists."); @@ -540,22 +540,22 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } MethodDeclaration md = generateToBuilderMethod(cfv, toBuilderMethodName, builderClassName, tdParent, tps, builderFields, fluent, ast, accessForOuters); - + if (md != null) injectMethod(tdParent, md); } - + if (nonFinalNonDefaultedFields != null && generateBuilderMethod) { for (EclipseNode fieldNode : nonFinalNonDefaultedFields) { fieldNode.addWarning("@Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final."); } } } - + private static final char[] BUILDER_TEMP_VAR = {'b', 'u', 'i', 'l', 'd', 'e', 'r'}; private MethodDeclaration generateToBuilderMethod(CheckerFrameworkVersion cfv, String methodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, List builderFields, boolean fluent, ASTNode source, AccessLevel access) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long) pS << 32 | pE; - + MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult); out.selector = methodName.toCharArray(); out.modifiers = toEclipseModifier(access); @@ -563,14 +563,14 @@ public class HandleBuilder extends EclipseAnnotationHandler { out.returnType = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p); AllocationExpression invoke = new AllocationExpression(); invoke.type = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p); - + Expression receiver = invoke; List statements = null; for (BuilderFieldData bfd : builderFields) { char[] setterName = fluent ? bfd.name : HandlerUtil.buildAccessorName("set", new String(bfd.name)).toCharArray(); MessageSend ms = new MessageSend(); Expression[] tgt = new Expression[bfd.singularData == null ? 1 : 2]; - + if (bfd.obtainVia == null || !bfd.obtainVia.field().isEmpty()) { char[] fieldName = bfd.obtainVia == null ? bfd.rawName : bfd.obtainVia.field().toCharArray(); for (int i = 0; i < tgt.length; i++) { @@ -599,7 +599,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { tgt[i] = obtainExpr; } } - + ms.selector = setterName; if (bfd.singularData == null) { ms.arguments = tgt; @@ -613,7 +613,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { statements.add(new IfStatement(isNotNull, ms, pS, pE)); } } - + if (statements != null) { out.statements = new Statement[statements.size() + 2]; for (int i = 0; i < statements.size(); i++) out.statements[i + 1] = statements.get(i); @@ -627,7 +627,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } else { out.statements = new Statement[] {new ReturnStatement(receiver, pS, pE)}; } - + if (cfv.generateUnique()) { out.annotations = new Annotation[] {generateNamedAnnotation(source, CheckerFrameworkVersion.NAME__UNIQUE)}; } @@ -636,16 +636,16 @@ public class HandleBuilder extends EclipseAnnotationHandler { return out; } - + private MethodDeclaration generateCleanMethod(List builderFields, EclipseNode builderType, ASTNode source) { List statements = new ArrayList(); - + for (BuilderFieldData bfd : builderFields) { if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) { bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, builderType, statements); } } - + FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0); thisUnclean.receiver = new ThisReference(0, 0); statements.add(new Assignment(thisUnclean, new FalseLiteral(0, 0), 0)); @@ -658,7 +658,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { decl.traverse(new SetGeneratedByVisitor(source), (ClassScope) null); return decl; } - + static Argument[] generateBuildArgs(CheckerFrameworkVersion cfv, EclipseNode type, List builderFields, ASTNode source) { if (!cfv.generateCalledMethods()) return null; @@ -691,7 +691,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult); out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; List statements = new ArrayList(); - + if (addCleaning) { FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0); thisUnclean.receiver = new ThisReference(0, 0); @@ -700,13 +700,13 @@ public class HandleBuilder extends EclipseAnnotationHandler { invokeClean.selector = CLEAN_METHOD_NAME; statements.add(new IfStatement(notClean, invokeClean, 0, 0)); } - + for (BuilderFieldData bfd : builderFields) { if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) { bfd.singularData.getSingularizer().appendBuildCode(bfd.singularData, type, statements, bfd.builderFieldName, "this"); } } - + List args = new ArrayList(); for (BuilderFieldData bfd : builderFields) { if (bfd.nameOfSetFlag != null) { @@ -716,7 +716,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { inv.receiver = new SingleNameReference(((TypeDeclaration) tdParent.get()).name, 0L); inv.selector = bfd.nameOfDefaultProvider; inv.typeArguments = typeParameterNames(((TypeDeclaration) type.get()).typeParameters); - + args.add(new ConditionalExpression( new SingleNameReference(bfd.nameOfSetFlag, 0L), new SingleNameReference(bfd.builderFieldName, 0L), @@ -725,19 +725,19 @@ public class HandleBuilder extends EclipseAnnotationHandler { args.add(new SingleNameReference(bfd.builderFieldName, 0L)); } } - + if (addCleaning) { FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0); thisUnclean.receiver = new ThisReference(0, 0); statements.add(new Assignment(thisUnclean, new TrueLiteral(0, 0), 0)); } - + out.modifiers = toEclipseModifier(access); out.selector = name.toCharArray(); out.thrownExceptions = copyTypes(thrownExceptions); out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; out.returnType = returnType; - + if (staticName == null) { AllocationExpression allocationStatement = new AllocationExpression(); allocationStatement.type = copyType(out.returnType); @@ -750,7 +750,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { invoke.receiver = new SingleNameReference(type.up().getName().toCharArray(), 0); else invoke.receiver = new QualifiedThisReference(new SingleTypeReference(type.up().getName().toCharArray(), 0) , 0, 0); - + invoke.typeArguments = typeParameterNames(((TypeDeclaration) type.get()).typeParameters); invoke.arguments = args.isEmpty() ? null : args.toArray(new Expression[0]); if (returnType instanceof SingleTypeReference && Arrays.equals(TypeConstants.VOID, ((SingleTypeReference) returnType).token)) { @@ -767,20 +767,20 @@ public class HandleBuilder extends EclipseAnnotationHandler { out.traverse(new SetGeneratedByVisitor(source), (ClassScope) null); return out; } - + private TypeReference[] typeParameterNames(TypeParameter[] typeParameters) { if (typeParameters == null) return null; - + TypeReference[] trs = new TypeReference[typeParameters.length]; for (int i = 0; i < trs.length; i++) { trs[i] = new SingleTypeReference(typeParameters[i].name, 0); } return trs; } - + public static MethodDeclaration generateDefaultProvider(char[] methodName, TypeParameter[] typeParameters, EclipseNode fieldNode, ASTNode source) { int pS = source.sourceStart, pE = source.sourceEnd; - + MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) fieldNode.top().get()).compilationResult); out.typeParameters = copyTypeParams(typeParameters, source); out.selector = methodName; @@ -790,15 +790,15 @@ public class HandleBuilder extends EclipseAnnotationHandler { out.returnType = copyType(fd.type, source); out.statements = new Statement[] {new ReturnStatement(fd.initialization, pS, pE)}; fd.initialization = null; - + out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) fieldNode.up().get()).scope); return out; } - + public MethodDeclaration generateBuilderMethod(CheckerFrameworkVersion cfv, boolean isStatic, String builderMethodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source, AccessLevel access) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long) pS << 32 | pE; - + MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult); out.selector = builderMethodName.toCharArray(); out.modifiers = toEclipseModifier(access); @@ -821,13 +821,13 @@ public class HandleBuilder extends EclipseAnnotationHandler { out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope); return out; } - + public void generateBuilderFields(EclipseNode builderType, List builderFields, ASTNode source) { List existing = new ArrayList(); for (EclipseNode child : builderType.down()) { if (child.getKind() == Kind.FIELD) existing.add(child); } - + for (BuilderFieldData bfd : builderFields) { if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) { bfd.createdFields.addAll(bfd.singularData.getSingularizer().generateFields(bfd.singularData, builderType)); @@ -838,7 +838,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { if (Arrays.equals(n, bfd.builderFieldName)) field = exists; if (bfd.nameOfSetFlag != null && Arrays.equals(n, bfd.nameOfSetFlag)) setFlag = exists; } - + if (field == null) { FieldDeclaration fd = new FieldDeclaration(bfd.builderFieldName, 0, 0); fd.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG; @@ -859,9 +859,9 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } } - + private static final AbstractMethodDeclaration[] EMPTY = {}; - + public void makeSetterMethodsForBuilder(CheckerFrameworkVersion cfv, EclipseNode builderType, BuilderFieldData bfd, EclipseNode sourceNode, boolean fluent, boolean chain, AccessLevel access, EclipseNode originalFieldNode) { boolean deprecate = isFieldDeprecated(bfd.originalFieldNode); if (bfd.singularData == null || bfd.singularData.getSingularizer() == null) { @@ -870,7 +870,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { bfd.singularData.getSingularizer().generateMethods(cfv, bfd.singularData, deprecate, builderType, fluent, chain, access); } } - + private void makeSimpleSetterMethodForBuilder(CheckerFrameworkVersion cfv, EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] paramName, char[] nameOfSetFlag, EclipseNode sourceNode, boolean fluent, boolean chain, Annotation[] annotations, AccessLevel access, EclipseNode originalFieldNode) { TypeDeclaration td = (TypeDeclaration) builderType.get(); AbstractMethodDeclaration[] existing = td.methods; @@ -879,15 +879,15 @@ public class HandleBuilder extends EclipseAnnotationHandler { int len = existing.length; FieldDeclaration fd = (FieldDeclaration) fieldNode.get(); char[] name = fd.name; - + for (int i = 0; i < len; i++) { if (!(existing[i] instanceof MethodDeclaration)) continue; char[] existingName = existing[i].selector; if (Arrays.equals(name, existingName) && !isTolerate(fieldNode, existing[i])) return; } - + String setterName = fluent ? new String(paramName) : HandlerUtil.buildAccessorName("set", new String(paramName)); - + List methodAnnsList = Arrays.asList(EclipseHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode)); Annotation[] methodAnns = EclipseHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode); if (methodAnns != null && methodAnns.length > 0) methodAnnsList = Arrays.asList(methodAnns); @@ -970,7 +970,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null); return injectType(tdParent, builder); } - + private void addObtainVia(BuilderFieldData bfd, EclipseNode node) { for (EclipseNode child : node.down()) { if (!annotationTypeMatches(ObtainVia.class, child)) continue; @@ -980,14 +980,15 @@ public class HandleBuilder extends EclipseAnnotationHandler { return; } } - + /** * Returns the explicitly requested singular annotation on this node (field * or parameter), or null if there's no {@code @Singular} annotation on it. - * + * * @param node The node (field or method param) to inspect for its name and potential {@code @Singular} annotation. + * @param setterPrefix */ - private SingularData getSingularData(EclipseNode node, ASTNode source) { + private SingularData getSingularData(EclipseNode node, ASTNode source, final String setterPrefix) { for (EclipseNode child : node.down()) { if (!annotationTypeMatches(Singular.class, child)) continue; char[] pluralName = node.getKind() == Kind.FIELD ? removePrefixFromField(node) : ((AbstractVariableDeclaration) node.get()).name; @@ -1006,7 +1007,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } char[] singularName = explicitSingular.toCharArray(); - + TypeReference type = ((AbstractVariableDeclaration) node.get()).type; TypeReference[] typeArgs = null; String typeName; @@ -1026,7 +1027,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } else { typeName = type.toString(); } - + String targetFqn = EclipseSingularsRecipes.get().toQualified(typeName); EclipseSingularizer singularizer = EclipseSingularsRecipes.get().getSingularizer(targetFqn); if (singularizer == null) { @@ -1034,9 +1035,9 @@ public class HandleBuilder extends EclipseAnnotationHandler { return null; } - return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source); + return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source, setterPrefix.toCharArray()); } - + return null; } } diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java index 53ea15a6..e3a99008 100755 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java @@ -150,7 +150,8 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula param.annotations = typeUseAnns; md.arguments = new Argument[] {param}; md.returnType = returnType; - md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName("add", new String(data.getSingularName())).toCharArray(); + char[] prefixedSingularName = data.getSetterPrefix().length == 0 ? data.getSingularName() : HandlerUtil.buildAccessorName(new String(data.getSetterPrefix()), new String(data.getSingularName())).toCharArray(); + md.selector = fluent ? prefixedSingularName : HandlerUtil.buildAccessorName("add", new String(data.getSingularName())).toCharArray(); md.annotations = generateSelfReturnAnnotations(deprecate, cfv, data.getSource()); data.setGeneratedByRecursive(md); @@ -181,7 +182,8 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula 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("addAll", new String(data.getPluralName())).toCharArray(); + char[] prefixedSelector = data.getSetterPrefix().length == 0 ? data.getPluralName() : HandlerUtil.buildAccessorName(new String(data.getSetterPrefix()), new String(data.getPluralName())).toCharArray(); + md.selector = fluent ? prefixedSelector : HandlerUtil.buildAccessorName("addAll", new String(data.getPluralName())).toCharArray(); md.annotations = generateSelfReturnAnnotations(deprecate, cfv, data.getSource()); data.setGeneratedByRecursive(md); diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java index 02369861..c978ff40 100644 --- a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -6,15 +6,15 @@ import lombok.NonNull; import lombok.Singular; @Target(ElementType.TYPE_USE) @interface MyAnnotation { } -@lombok.Builder(setterPrefix = "with") class BuilderSingularAnnotatedTypes { - public static @java.lang.SuppressWarnings("all") class BuilderSingularAnnotatedTypesBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularAnnotatedTypesWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularAnnotatedTypesWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> foos; private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> bars$key; private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; - @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withFoo(final @MyAnnotation @NonNull String foo) { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoo(final @MyAnnotation @NonNull String foo) { if ((foo == null)) { throw new java.lang.NullPointerException("foo is marked non-null but is null"); @@ -24,18 +24,18 @@ import lombok.Singular; this.foos.add(foo); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withFoos(final java.util.Collection foos) { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection foos) { if ((this.foos == null)) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); this.foos.addAll(foos); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearFoos() { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearFoos() { if ((this.foos != null)) this.foos.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withBar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull Integer barValue) { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull Integer barValue) { if ((barKey == null)) { throw new java.lang.NullPointerException("barKey is marked non-null but is null"); @@ -53,7 +53,7 @@ import lombok.Singular; this.bars$value.add(barValue); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withBars(final java.util.Map bars) { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map bars) { if ((this.bars$key == null)) { this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); @@ -66,7 +66,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearBars() { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearBars() { if ((this.bars$key != null)) { this.bars$key.clear(); @@ -74,7 +74,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes build() { + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefix build() { java.util.Set<@MyAnnotation @NonNull String> foos; switch (((this.foos == null) ? 0 : this.foos.size())) { case 0 : @@ -102,20 +102,20 @@ import lombok.Singular; bars.put(this.bars$key.get($i), this.bars$value.get($i)); bars = java.util.Collections.unmodifiableMap(bars); } - return new BuilderSingularAnnotatedTypes(foos, bars); + return new BuilderSingularAnnotatedTypesWithSetterPrefix(foos, bars); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")"); + return (((((("BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")"); } } private @Singular Set<@MyAnnotation @NonNull String> foos; private @Singular Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; - @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { + @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefix(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { super(); this.foos = foos; this.bars = bars; } - public static @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder builder() { - return new BuilderSingularAnnotatedTypesBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() { + return new BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java index e9b0205d..ec700874 100644 --- a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -4,106 +4,106 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.ImmutableTable; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaListsSets { - public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaListsSetsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder cards; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder frogs; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder rawSet; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedSet.Builder passes; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableTable.Builder users; - @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withCard(final T card) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withCard(final T card) { if ((this.cards == null)) this.cards = com.google.common.collect.ImmutableList.builder(); this.cards.add(card); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withCards(final java.lang.Iterable cards) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withCards(final java.lang.Iterable cards) { if ((this.cards == null)) this.cards = com.google.common.collect.ImmutableList.builder(); this.cards.addAll(cards); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearCards() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearCards() { this.cards = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withFrog(final Number frog) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withFrog(final Number frog) { if ((this.frogs == null)) this.frogs = com.google.common.collect.ImmutableList.builder(); this.frogs.add(frog); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withFrogs(final java.lang.Iterable frogs) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withFrogs(final java.lang.Iterable frogs) { if ((this.frogs == null)) this.frogs = com.google.common.collect.ImmutableList.builder(); this.frogs.addAll(frogs); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearFrogs() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearFrogs() { this.frogs = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Object rawSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withRawSet(final java.lang.Object rawSet) { if ((this.rawSet == null)) this.rawSet = com.google.common.collect.ImmutableSet.builder(); this.rawSet.add(rawSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Iterable rawSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withRawSet(final java.lang.Iterable rawSet) { if ((this.rawSet == null)) this.rawSet = com.google.common.collect.ImmutableSet.builder(); this.rawSet.addAll(rawSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearRawSet() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearRawSet() { this.rawSet = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withPass(final String pass) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withPass(final String pass) { if ((this.passes == null)) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); this.passes.add(pass); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withPasses(final java.lang.Iterable passes) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withPasses(final java.lang.Iterable passes) { if ((this.passes == null)) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); this.passes.addAll(passes); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearPasses() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearPasses() { this.passes = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withUser(final Number rowKey, final Number columnKey, final String value) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withUser(final Number rowKey, final Number columnKey, final String value) { if ((this.users == null)) this.users = com.google.common.collect.ImmutableTable.builder(); this.users.put(rowKey, columnKey, value); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder withUsers(final com.google.common.collect.Table users) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withUsers(final com.google.common.collect.Table users) { if ((this.users == null)) this.users = com.google.common.collect.ImmutableTable.builder(); this.users.putAll(users); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder clearUsers() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearUsers() { this.users = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets build() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefix build() { com.google.common.collect.ImmutableList cards = ((this.cards == null) ? com.google.common.collect.ImmutableList.of() : this.cards.build()); com.google.common.collect.ImmutableCollection frogs = ((this.frogs == null) ? com.google.common.collect.ImmutableList.of() : this.frogs.build()); com.google.common.collect.ImmutableSet rawSet = ((this.rawSet == null) ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build()); com.google.common.collect.ImmutableSortedSet passes = ((this.passes == null) ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build()); com.google.common.collect.ImmutableTable users = ((this.users == null) ? com.google.common.collect.ImmutableTable.of() : this.users.build()); - return new BuilderSingularGuavaListsSets(cards, frogs, rawSet, passes, users); + return new BuilderSingularGuavaListsSetsWithSetterPrefix(cards, frogs, rawSet, passes, users); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((((("BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ", users=") + this.users) + ")"); + return (((((((((("BuilderSingularGuavaListsSetsWithSetterPrefix.BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ", users=") + this.users) + ")"); } } private @Singular ImmutableList cards; @@ -111,7 +111,7 @@ import lombok.Singular; private @SuppressWarnings("all") @Singular("rawSet") ImmutableSet rawSet; private @Singular ImmutableSortedSet passes; private @Singular ImmutableTable users; - @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes, final ImmutableTable users) { + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefix(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes, final ImmutableTable users) { super(); this.cards = cards; this.frogs = frogs; @@ -119,7 +119,7 @@ import lombok.Singular; this.passes = passes; this.users = users; } - public static @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder builder() { - return new BuilderSingularGuavaListsSetsBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder builder() { + return new BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java index fe1f0036..0f58f7a4 100644 --- a/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java @@ -2,82 +2,82 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableSortedMap; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaMaps { - public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaMapsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableMap.Builder battleaxes; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder vertices; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableBiMap.Builder rawMap; - @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withBattleaxe(final K key, final V value) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder withBattleaxe(final K key, final V value) { if ((this.battleaxes == null)) this.battleaxes = com.google.common.collect.ImmutableMap.builder(); this.battleaxes.put(key, value); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withBattleaxes(final java.util.Map battleaxes) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder withBattleaxes(final java.util.Map battleaxes) { if ((this.battleaxes == null)) this.battleaxes = com.google.common.collect.ImmutableMap.builder(); this.battleaxes.putAll(battleaxes); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder clearBattleaxes() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder clearBattleaxes() { this.battleaxes = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withVertex(final Integer key, final V value) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder withVertex(final Integer key, final V value) { if ((this.vertices == null)) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); this.vertices.put(key, value); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withVertices(final java.util.Map vertices) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder withVertices(final java.util.Map vertices) { if ((this.vertices == null)) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); this.vertices.putAll(vertices); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder clearVertices() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder clearVertices() { this.vertices = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withRawMap(final java.lang.Object key, final java.lang.Object value) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder withRawMap(final java.lang.Object key, final java.lang.Object value) { if ((this.rawMap == null)) this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); this.rawMap.put(key, value); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder withRawMap(final java.util.Map rawMap) { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder withRawMap(final java.util.Map rawMap) { if ((this.rawMap == null)) this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); this.rawMap.putAll(rawMap); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder clearRawMap() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder clearRawMap() { this.rawMap = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps build() { + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefix build() { com.google.common.collect.ImmutableMap battleaxes = ((this.battleaxes == null) ? com.google.common.collect.ImmutableMap.of() : this.battleaxes.build()); com.google.common.collect.ImmutableSortedMap vertices = ((this.vertices == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.vertices.build()); com.google.common.collect.ImmutableBiMap rawMap = ((this.rawMap == null) ? com.google.common.collect.ImmutableBiMap.of() : this.rawMap.build()); - return new BuilderSingularGuavaMaps(battleaxes, vertices, rawMap); + return new BuilderSingularGuavaMapsWithSetterPrefix(battleaxes, vertices, rawMap); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder(battleaxes=" + this.battleaxes) + ", vertices=") + this.vertices) + ", rawMap=") + this.rawMap) + ")"); + return (((((("BuilderSingularGuavaMapsWithSetterPrefix.BuilderSingularGuavaMapsWithSetterPrefixBuilder(battleaxes=" + this.battleaxes) + ", vertices=") + this.vertices) + ", rawMap=") + this.rawMap) + ")"); } } private @Singular ImmutableMap battleaxes; private @Singular ImmutableSortedMap vertices; private @SuppressWarnings("all") @Singular("rawMap") ImmutableBiMap rawMap; - @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps(final ImmutableMap battleaxes, final ImmutableSortedMap vertices, final ImmutableBiMap rawMap) { + @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefix(final ImmutableMap battleaxes, final ImmutableSortedMap vertices, final ImmutableBiMap rawMap) { super(); this.battleaxes = battleaxes; this.vertices = vertices; this.rawMap = rawMap; } - public static @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder builder() { - return new BuilderSingularGuavaMapsBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder builder() { + return new BuilderSingularGuavaMapsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java index 110cc2c3..ab90cb48 100644 --- a/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java @@ -2,66 +2,66 @@ import java.util.List; import java.util.Collection; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularLists { - public static @java.lang.SuppressWarnings("all") class BuilderSingularListsBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularListsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularListsWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList children; private @java.lang.SuppressWarnings("all") java.util.ArrayList scarves; private @java.lang.SuppressWarnings("all") java.util.ArrayList rawList; - @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withChild(final T child) { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder withChild(final T child) { if ((this.children == null)) this.children = new java.util.ArrayList(); this.children.add(child); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withChildren(final java.util.Collection children) { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder withChildren(final java.util.Collection children) { if ((this.children == null)) this.children = new java.util.ArrayList(); this.children.addAll(children); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder clearChildren() { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder clearChildren() { if ((this.children != null)) this.children.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withScarf(final Number scarf) { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder withScarf(final Number scarf) { if ((this.scarves == null)) this.scarves = new java.util.ArrayList(); this.scarves.add(scarf); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withScarves(final java.util.Collection scarves) { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder withScarves(final java.util.Collection scarves) { if ((this.scarves == null)) this.scarves = new java.util.ArrayList(); this.scarves.addAll(scarves); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder clearScarves() { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder clearScarves() { if ((this.scarves != null)) this.scarves.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withRawList(final java.lang.Object rawList) { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder withRawList(final java.lang.Object rawList) { if ((this.rawList == null)) this.rawList = new java.util.ArrayList(); this.rawList.add(rawList); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder withRawList(final java.util.Collection rawList) { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder withRawList(final java.util.Collection rawList) { if ((this.rawList == null)) this.rawList = new java.util.ArrayList(); this.rawList.addAll(rawList); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder clearRawList() { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder clearRawList() { if ((this.rawList != null)) this.rawList.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularLists build() { + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefix build() { java.util.List children; switch (((this.children == null) ? 0 : this.children.size())) { case 0 : @@ -95,22 +95,22 @@ import lombok.Singular; default : rawList = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.rawList)); } - return new BuilderSingularLists(children, scarves, rawList); + return new BuilderSingularListsWithSetterPrefix(children, scarves, rawList); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children) + ", scarves=") + this.scarves) + ", rawList=") + this.rawList) + ")"); + return (((((("BuilderSingularListsWithSetterPrefix.BuilderSingularListsWithSetterPrefixBuilder(children=" + this.children) + ", scarves=") + this.scarves) + ", rawList=") + this.rawList) + ")"); } } private @Singular List children; private @Singular Collection scarves; private @SuppressWarnings("all") @Singular("rawList") List rawList; - @java.lang.SuppressWarnings("all") BuilderSingularLists(final List children, final Collection scarves, final List rawList) { + @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefix(final List children, final Collection scarves, final List rawList) { super(); this.children = children; this.scarves = scarves; this.rawList = rawList; } - public static @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder builder() { - return new BuilderSingularListsBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder builder() { + return new BuilderSingularListsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java index 9193ccf9..7848b154 100644 --- a/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java @@ -1,8 +1,8 @@ import java.util.Map; import java.util.SortedMap; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularMaps { - public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularMapsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList women$key; private @java.lang.SuppressWarnings("all") java.util.ArrayList women$value; private @java.lang.SuppressWarnings("all") java.util.ArrayList men$key; @@ -11,10 +11,10 @@ import lombok.Singular; private @java.lang.SuppressWarnings("all") java.util.ArrayList rawMap$value; private @java.lang.SuppressWarnings("all") java.util.ArrayList stringMap$key; private @java.lang.SuppressWarnings("all") java.util.ArrayList stringMap$value; - @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withWoman(final K womanKey, final V womanValue) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withWoman(final K womanKey, final V womanValue) { if ((this.women$key == null)) { this.women$key = new java.util.ArrayList(); @@ -24,7 +24,7 @@ import lombok.Singular; this.women$value.add(womanValue); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withWomen(final java.util.Map women) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withWomen(final java.util.Map women) { if ((this.women$key == null)) { this.women$key = new java.util.ArrayList(); @@ -37,7 +37,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearWomen() { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder clearWomen() { if ((this.women$key != null)) { this.women$key.clear(); @@ -45,7 +45,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withMan(final K manKey, final Number manValue) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withMan(final K manKey, final Number manValue) { if ((this.men$key == null)) { this.men$key = new java.util.ArrayList(); @@ -55,7 +55,7 @@ import lombok.Singular; this.men$value.add(manValue); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withMen(final java.util.Map men) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withMen(final java.util.Map men) { if ((this.men$key == null)) { this.men$key = new java.util.ArrayList(); @@ -68,7 +68,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearMen() { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder clearMen() { if ((this.men$key != null)) { this.men$key.clear(); @@ -76,7 +76,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withRawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withRawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) { if ((this.rawMap$key == null)) { this.rawMap$key = new java.util.ArrayList(); @@ -86,7 +86,7 @@ import lombok.Singular; this.rawMap$value.add(rawMapValue); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withRawMap(final java.util.Map rawMap) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withRawMap(final java.util.Map rawMap) { if ((this.rawMap$key == null)) { this.rawMap$key = new java.util.ArrayList(); @@ -99,7 +99,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearRawMap() { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder clearRawMap() { if ((this.rawMap$key != null)) { this.rawMap$key.clear(); @@ -107,7 +107,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withStringMap(final String stringMapKey, final V stringMapValue) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withStringMap(final String stringMapKey, final V stringMapValue) { if ((this.stringMap$key == null)) { this.stringMap$key = new java.util.ArrayList(); @@ -117,7 +117,7 @@ import lombok.Singular; this.stringMap$value.add(stringMapValue); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder withStringMap(final java.util.Map stringMap) { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder withStringMap(final java.util.Map stringMap) { if ((this.stringMap$key == null)) { this.stringMap$key = new java.util.ArrayList(); @@ -130,7 +130,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder clearStringMap() { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder clearStringMap() { if ((this.stringMap$key != null)) { this.stringMap$key.clear(); @@ -138,7 +138,7 @@ import lombok.Singular; } return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularMaps build() { + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix build() { java.util.Map women; switch (((this.women$key == null) ? 0 : this.women$key.size())) { case 0 : @@ -186,24 +186,24 @@ import lombok.Singular; stringMap.put(this.stringMap$key.get($i), this.stringMap$value.get($i)); stringMap = java.util.Collections.unmodifiableMap(stringMap); } - return new BuilderSingularMaps(women, men, rawMap, stringMap); + return new BuilderSingularMapsWithSetterPrefix(women, men, rawMap, stringMap); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((((((((((("BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key) + ", women$value=") + this.women$value) + ", men$key=") + this.men$key) + ", men$value=") + this.men$value) + ", rawMap$key=") + this.rawMap$key) + ", rawMap$value=") + this.rawMap$value) + ", stringMap$key=") + this.stringMap$key) + ", stringMap$value=") + this.stringMap$value) + ")"); + return (((((((((((((((("BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder(women$key=" + this.women$key) + ", women$value=") + this.women$value) + ", men$key=") + this.men$key) + ", men$value=") + this.men$value) + ", rawMap$key=") + this.rawMap$key) + ", rawMap$value=") + this.rawMap$value) + ", stringMap$key=") + this.stringMap$key) + ", stringMap$value=") + this.stringMap$value) + ")"); } } private @Singular Map women; private @Singular SortedMap men; private @SuppressWarnings("all") @Singular("rawMap") Map rawMap; private @Singular("stringMap") Map stringMap; - @java.lang.SuppressWarnings("all") BuilderSingularMaps(final Map women, final SortedMap men, final Map rawMap, final Map stringMap) { + @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix(final Map women, final SortedMap men, final Map rawMap, final Map stringMap) { super(); this.women = women; this.men = men; this.rawMap = rawMap; this.stringMap = stringMap; } - public static @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder builder() { - return new BuilderSingularMapsBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder builder() { + return new BuilderSingularMapsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java index a7754a99..f24b1640 100644 --- a/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java @@ -1,65 +1,65 @@ import java.util.List; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAuto { - public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutoBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAutoWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutoWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList things; private @java.lang.SuppressWarnings("all") java.util.ArrayList widgets; private @java.lang.SuppressWarnings("all") java.util.ArrayList items; - @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withThings(final String things) { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final String things) { if ((this.things == null)) this.things = new java.util.ArrayList(); this.things.add(things); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withThings(final java.util.Collection things) { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection things) { if ((this.things == null)) this.things = new java.util.ArrayList(); this.things.addAll(things); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder clearThings() { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder clearThings() { if ((this.things != null)) this.things.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withWidget(final String widget) { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withWidget(final String widget) { if ((this.widgets == null)) this.widgets = new java.util.ArrayList(); this.widgets.add(widget); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withWidgets(final java.util.Collection widgets) { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection widgets) { if ((this.widgets == null)) this.widgets = new java.util.ArrayList(); this.widgets.addAll(widgets); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder clearWidgets() { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder clearWidgets() { if ((this.widgets != null)) this.widgets.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withItems(final String items) { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final String items) { if ((this.items == null)) this.items = new java.util.ArrayList(); this.items.add(items); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withItems(final java.util.Collection items) { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection items) { if ((this.items == null)) this.items = new java.util.ArrayList(); this.items.addAll(items); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder clearItems() { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder clearItems() { if ((this.items != null)) this.items.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNoAuto build() { + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix build() { java.util.List things; switch (((this.things == null) ? 0 : this.things.size())) { case 0 : @@ -93,22 +93,22 @@ import lombok.Singular; default : items = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.items)); } - return new BuilderSingularNoAuto(things, widgets, items); + return new BuilderSingularNoAutoWithSetterPrefix(things, widgets, items); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(things=" + this.things) + ", widgets=") + this.widgets) + ", items=") + this.items) + ")"); + return (((((("BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder(things=" + this.things) + ", widgets=") + this.widgets) + ", items=") + this.items) + ")"); } } private @Singular List things; private @Singular("widget") List widgets; private @Singular List items; - @java.lang.SuppressWarnings("all") BuilderSingularNoAuto(final List things, final List widgets, final List items) { + @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix(final List things, final List widgets, final List items) { super(); this.things = things; this.widgets = widgets; this.items = items; } - public static @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder builder() { - return new BuilderSingularNoAutoBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder builder() { + return new BuilderSingularNoAutoWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java index 6f12f986..c6e163cb 100644 --- a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -2,82 +2,82 @@ import java.util.Set; import java.util.NavigableMap; import java.util.Collection; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularRedirectToGuava { - public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularRedirectToGuavaWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder dangerMice; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder things; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder> doohickeys; - @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDangerMouse(final String dangerMouse) { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDangerMouse(final String dangerMouse) { if ((this.dangerMice == null)) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); this.dangerMice.add(dangerMouse); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDangerMice(final java.lang.Iterable dangerMice) { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDangerMice(final java.lang.Iterable dangerMice) { if ((this.dangerMice == null)) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); this.dangerMice.addAll(dangerMice); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearDangerMice() { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDangerMice() { this.dangerMice = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withThing(final Integer key, final Number value) { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withThing(final Integer key, final Number value) { if ((this.things == null)) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); this.things.put(key, value); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withThings(final java.util.Map things) { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withThings(final java.util.Map things) { if ((this.things == null)) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); this.things.putAll(things); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearThings() { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearThings() { this.things = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDoohickey(final Class doohickey) { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDoohickey(final Class doohickey) { if ((this.doohickeys == null)) this.doohickeys = com.google.common.collect.ImmutableList.builder(); this.doohickeys.add(doohickey); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDoohickeys(final java.lang.Iterable> doohickeys) { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDoohickeys(final java.lang.Iterable> doohickeys) { if ((this.doohickeys == null)) this.doohickeys = com.google.common.collect.ImmutableList.builder(); this.doohickeys.addAll(doohickeys); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearDoohickeys() { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDoohickeys() { this.doohickeys = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava build() { + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefix build() { java.util.Set dangerMice = ((this.dangerMice == null) ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build()); java.util.NavigableMap things = ((this.things == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build()); java.util.Collection> doohickeys = ((this.doohickeys == null) ? com.google.common.collect.ImmutableList.>of() : this.doohickeys.build()); - return new BuilderSingularRedirectToGuava(dangerMice, things, doohickeys); + return new BuilderSingularRedirectToGuavaWithSetterPrefix(dangerMice, things, doohickeys); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder(dangerMice=" + this.dangerMice) + ", things=") + this.things) + ", doohickeys=") + this.doohickeys) + ")"); + return (((((("BuilderSingularRedirectToGuavaWithSetterPrefix.BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(dangerMice=" + this.dangerMice) + ", things=") + this.things) + ", doohickeys=") + this.doohickeys) + ")"); } } private @Singular Set dangerMice; private @Singular NavigableMap things; private @Singular Collection> doohickeys; - @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava(final Set dangerMice, final NavigableMap things, final Collection> doohickeys) { + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefix(final Set dangerMice, final NavigableMap things, final Collection> doohickeys) { super(); this.dangerMice = dangerMice; this.things = things; this.doohickeys = doohickeys; } - public static @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder builder() { - return new BuilderSingularRedirectToGuavaBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder builder() { + return new BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java index 1bf552c5..cb5041a7 100644 --- a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java @@ -1,84 +1,84 @@ import java.util.Set; import java.util.SortedSet; import lombok.Singular; -@lombok.Builder(setterPrefix = "with") class BuilderSingularSets { - public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderSingularSetsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList dangerMice; private @java.lang.SuppressWarnings("all") java.util.ArrayList octopodes; private @java.lang.SuppressWarnings("all") java.util.ArrayList rawSet; private @java.lang.SuppressWarnings("all") java.util.ArrayList stringSet; - @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder dangerMouse(final T dangerMouse) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder dangerMouse(final T dangerMouse) { if ((this.dangerMice == null)) this.dangerMice = new java.util.ArrayList(); this.dangerMice.add(dangerMouse); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder dangerMice(final java.util.Collection dangerMice) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder dangerMice(final java.util.Collection dangerMice) { if ((this.dangerMice == null)) this.dangerMice = new java.util.ArrayList(); this.dangerMice.addAll(dangerMice); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearDangerMice() { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder clearDangerMice() { if ((this.dangerMice != null)) this.dangerMice.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder octopus(final Number octopus) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder octopus(final Number octopus) { if ((this.octopodes == null)) this.octopodes = new java.util.ArrayList(); this.octopodes.add(octopus); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder octopodes(final java.util.Collection octopodes) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder octopodes(final java.util.Collection octopodes) { if ((this.octopodes == null)) this.octopodes = new java.util.ArrayList(); this.octopodes.addAll(octopodes); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearOctopodes() { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder clearOctopodes() { if ((this.octopodes != null)) this.octopodes.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder rawSet(final java.lang.Object rawSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder rawSet(final java.lang.Object rawSet) { if ((this.rawSet == null)) this.rawSet = new java.util.ArrayList(); this.rawSet.add(rawSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder rawSet(final java.util.Collection rawSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder rawSet(final java.util.Collection rawSet) { if ((this.rawSet == null)) this.rawSet = new java.util.ArrayList(); this.rawSet.addAll(rawSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearRawSet() { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder clearRawSet() { if ((this.rawSet != null)) this.rawSet.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder stringSet(final String stringSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder stringSet(final String stringSet) { if ((this.stringSet == null)) this.stringSet = new java.util.ArrayList(); this.stringSet.add(stringSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder stringSet(final java.util.Collection stringSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder stringSet(final java.util.Collection stringSet) { if ((this.stringSet == null)) this.stringSet = new java.util.ArrayList(); this.stringSet.addAll(stringSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder clearStringSet() { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder clearStringSet() { if ((this.stringSet != null)) this.stringSet.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSets build() { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix build() { java.util.Set dangerMice; switch (((this.dangerMice == null) ? 0 : this.dangerMice.size())) { case 0 : @@ -122,24 +122,24 @@ import lombok.Singular; stringSet.addAll(this.stringSet); stringSet = java.util.Collections.unmodifiableSet(stringSet); } - return new BuilderSingularSets(dangerMice, octopodes, rawSet, stringSet); + return new BuilderSingularSetsWithSetterPrefix(dangerMice, octopodes, rawSet, stringSet); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((("BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice) + ", octopodes=") + this.octopodes) + ", rawSet=") + this.rawSet) + ", stringSet=") + this.stringSet) + ")"); + return (((((((("BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder(dangerMice=" + this.dangerMice) + ", octopodes=") + this.octopodes) + ", rawSet=") + this.rawSet) + ", stringSet=") + this.stringSet) + ")"); } } private @Singular Set dangerMice; private @Singular SortedSet octopodes; private @SuppressWarnings("all") @Singular("rawSet") Set rawSet; private @Singular("stringSet") Set stringSet; - @java.lang.SuppressWarnings("all") BuilderSingularSets(final Set dangerMice, final SortedSet octopodes, final Set rawSet, final Set stringSet) { + @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix(final Set dangerMice, final SortedSet octopodes, final Set rawSet, final Set stringSet) { super(); this.dangerMice = dangerMice; this.octopodes = octopodes; this.rawSet = rawSet; this.stringSet = stringSet; } - public static @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder builder() { - return new BuilderSingularSetsBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder builder() { + return new BuilderSingularSetsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java index 086e0701..03f8adf9 100644 --- a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -1,28 +1,28 @@ import lombok.Singular; -@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularToBuilderWithNull { - public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullBuilder { +@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularToBuilderWithNullWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList elems; - @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder withElem(final String elem) { + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElem(final String elem) { if ((this.elems == null)) this.elems = new java.util.ArrayList(); this.elems.add(elem); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder withElems(final java.util.Collection elems) { + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElems(final java.util.Collection elems) { if ((this.elems == null)) this.elems = new java.util.ArrayList(); this.elems.addAll(elems); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder clearElems() { + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder clearElems() { if ((this.elems != null)) this.elems.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull build() { + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix build() { java.util.List elems; switch (((this.elems == null) ? 0 : this.elems.size())) { case 0 : @@ -34,25 +34,25 @@ import lombok.Singular; default : elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); } - return new BuilderSingularToBuilderWithNull(elems); + return new BuilderSingularToBuilderWithNullWithSetterPrefix(elems); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder(elems=" + this.elems) + ")"); + return (("BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(elems=" + this.elems) + ")"); } } private @Singular java.util.List elems; public static void test() { - new BuilderSingularToBuilderWithNull(null).toBuilder(); + new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder(); } - @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull(final java.util.List elems) { + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix(final java.util.List elems) { super(); this.elems = elems; } - public static @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder builder() { - return new BuilderSingularToBuilderWithNullBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder() { + return new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); } - public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder toBuilder() { - final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder(); + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() { + final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); if ((this.elems != null)) builder.elems(this.elems); return builder; diff --git a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index 635b6a79..358e6910 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -1,48 +1,48 @@ import java.util.List; import java.util.Collection; import lombok.Singular; -@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilder { - public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderBuilder { +@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList objects; private @java.lang.SuppressWarnings("all") java.util.ArrayList numbers; - @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withObject(final java.lang.Object object) { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObject(final java.lang.Object object) { if ((this.objects == null)) this.objects = new java.util.ArrayList(); this.objects.add(object); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withObjects(final java.util.Collection objects) { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObjects(final java.util.Collection objects) { if ((this.objects == null)) this.objects = new java.util.ArrayList(); this.objects.addAll(objects); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearObjects() { if ((this.objects != null)) this.objects.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withNumber(final Number number) { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumber(final Number number) { if ((this.numbers == null)) this.numbers = new java.util.ArrayList(); this.numbers.add(number); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withNumbers(final java.util.Collection numbers) { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumbers(final java.util.Collection numbers) { if ((this.numbers == null)) this.numbers = new java.util.ArrayList(); this.numbers.addAll(numbers); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearNumbers() { if ((this.numbers != null)) this.numbers.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder build() { + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefix build() { java.util.List objects; switch (((this.objects == null) ? 0 : this.objects.size())) { case 0 : @@ -65,24 +65,24 @@ import lombok.Singular; default : numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.numbers)); } - return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(objects, numbers); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects) + ", numbers=") + this.numbers) + ")"); + return (((("BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(objects=" + this.objects) + ", numbers=") + this.numbers) + ")"); } } private @Singular List objects; private @Singular Collection numbers; - @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder(final List objects, final Collection numbers) { + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(final List objects, final Collection numbers) { super(); this.objects = objects; this.numbers = numbers; } - public static @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder builder() { - return new BuilderSingularWildcardListsWithToBuilderBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); } - public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { - final BuilderSingularWildcardListsWithToBuilderBuilder builder = new BuilderSingularWildcardListsWithToBuilderBuilder(); + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); if ((this.objects != null)) builder.objects(this.objects); if ((this.numbers != null)) diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java index d9cea692..88f64f34 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -1,28 +1,28 @@ import lombok.Singular; -@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") class BuilderSingularWithPrefixes { - public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesBuilder { +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") class BuilderSingularWithPrefixesWithSetterPrefixes { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesWithSetterPrefixesBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList elems; - @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder withElem(final String elem) { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder withElem(final String elem) { if ((this.elems == null)) this.elems = new java.util.ArrayList(); this.elems.add(elem); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder withElems(final java.util.Collection elems) { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder withElems(final java.util.Collection elems) { if ((this.elems == null)) this.elems = new java.util.ArrayList(); this.elems.addAll(elems); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder clearElems() { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder clearElems() { if ((this.elems != null)) this.elems.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes build() { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixes build() { java.util.List elems; switch (((this.elems == null) ? 0 : this.elems.size())) { case 0 : @@ -34,18 +34,18 @@ import lombok.Singular; default : elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); } - return new BuilderSingularWithPrefixes(elems); + return new BuilderSingularWithPrefixesWithSetterPrefixes(elems); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder(elems=" + this.elems) + ")"); + return (("BuilderSingularWithPrefixesWithSetterPrefixes.BuilderSingularWithPrefixesWithSetterPrefixesBuilder(elems=" + this.elems) + ")"); } } private @Singular java.util.List _elems; - @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes(final java.util.List elems) { + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixes(final java.util.List elems) { super(); this._elems = elems; } - public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder builder() { - return new BuilderSingularWithPrefixesBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder builder() { + return new BuilderSingularWithPrefixesWithSetterPrefixesBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java index ed62dc85..db44aa12 100644 --- a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java @@ -5,29 +5,29 @@ import java.util.List; } @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB { } -@lombok.Builder(setterPrefix = "with") class BuilderTypeAnnos { - public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderTypeAnnosWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") List foo; - @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder() { + @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder withFoo(final @TA List foo) { + public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder withFoo(final @TA List foo) { this.foo = foo; return this; } - public @java.lang.SuppressWarnings("all") BuilderTypeAnnos build() { - return new BuilderTypeAnnos(foo); + public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix build() { + return new BuilderTypeAnnosWithSetterPrefix(foo); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo) + ")"); + return (("BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder(foo=" + this.foo) + ")"); } } private @TA @TB List foo; - @java.lang.SuppressWarnings("all") BuilderTypeAnnos(final @TA List foo) { + @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix(final @TA List foo) { super(); this.foo = foo; } - public static @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder builder() { - return new BuilderTypeAnnosBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder builder() { + return new BuilderTypeAnnosWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java index ffecad46..679591a4 100644 --- a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java @@ -1,22 +1,22 @@ import java.util.List; -final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue { - public static @java.lang.SuppressWarnings("all") class BuilderAndValueBuilder { - @java.lang.SuppressWarnings("all") BuilderAndValueBuilder() { +final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValueWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderAndValueWithSetterPrefixBuilder { + @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderAndValue build() { - return new BuilderAndValue(); + public @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefix build() { + return new BuilderAndValueWithSetterPrefix(); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return "BuilderAndValue.BuilderAndValueBuilder()"; + return "BuilderAndValueWithSetterPrefix.BuilderAndValueWithSetterPrefixBuilder()"; } } private final int zero = 0; - @java.lang.SuppressWarnings("all") BuilderAndValue() { + @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefix() { super(); } - public static @java.lang.SuppressWarnings("all") BuilderAndValueBuilder builder() { - return new BuilderAndValueBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefixBuilder builder() { + return new BuilderAndValueWithSetterPrefixBuilder(); } public @java.lang.SuppressWarnings("all") int getZero() { return this.zero; @@ -24,9 +24,9 @@ final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((! (o instanceof BuilderAndValue))) + if ((! (o instanceof BuilderAndValueWithSetterPrefix))) return false; - final BuilderAndValue other = (BuilderAndValue) o; + final BuilderAndValueWithSetterPrefix other = (BuilderAndValueWithSetterPrefix) o; if ((this.getZero() != other.getZero())) return false; return true; @@ -38,27 +38,27 @@ final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderAndValue(zero=" + this.getZero()) + ")"); + return (("BuilderAndValueWithSetterPrefix(zero=" + this.getZero()) + ")"); } } -@lombok.Builder @lombok.Data class BuilderAndData { - public static @java.lang.SuppressWarnings("all") class BuilderAndDataBuilder { - @java.lang.SuppressWarnings("all") BuilderAndDataBuilder() { +@lombok.Builder @lombok.Data class BuilderAndDataWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderAndDataWithSetterPrefixBuilder { + @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderAndData build() { - return new BuilderAndData(); + public @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefix build() { + return new BuilderAndDataWithSetterPrefix(); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return "BuilderAndData.BuilderAndDataBuilder()"; + return "BuilderAndDataWithSetterPrefix.BuilderAndDataWithSetterPrefixBuilder()"; } } private final int zero = 0; - @java.lang.SuppressWarnings("all") BuilderAndData() { + @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefix() { super(); } - public static @java.lang.SuppressWarnings("all") BuilderAndDataBuilder builder() { - return new BuilderAndDataBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder builder() { + return new BuilderAndDataWithSetterPrefixBuilder(); } public @java.lang.SuppressWarnings("all") int getZero() { return this.zero; @@ -66,9 +66,9 @@ final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((! (o instanceof BuilderAndData))) + if ((! (o instanceof BuilderAndDataWithSetterPrefix))) return false; - final BuilderAndData other = (BuilderAndData) o; + final BuilderAndDataWithSetterPrefix other = (BuilderAndDataWithSetterPrefix) o; if ((! other.canEqual((java.lang.Object) this))) return false; if ((this.getZero() != other.getZero())) @@ -76,7 +76,7 @@ final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue return true; } protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { - return (other instanceof BuilderAndData); + return (other instanceof BuilderAndDataWithSetterPrefix); } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 59; @@ -85,6 +85,6 @@ final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderAndData(zero=" + this.getZero()) + ")"); + return (("BuilderAndDataWithSetterPrefix(zero=" + this.getZero()) + ")"); } } diff --git a/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java index 388e813d..5894a4a2 100644 --- a/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java @@ -1,47 +1,47 @@ -@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = {"p", "_"}) class BuilderWithAccessors { - public static @java.lang.SuppressWarnings("all") class BuilderWithAccessorsBuilder { +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = {"p", "_"}) class BuilderWithAccessorsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithAccessorsWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") int plower; private @java.lang.SuppressWarnings("all") int upper; private @java.lang.SuppressWarnings("all") int foo; private @java.lang.SuppressWarnings("all") int _bar; - @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withPlower(final int plower) { + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withPlower(final int plower) { this.plower = plower; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withUpper(final int upper) { + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withUpper(final int upper) { this.upper = upper; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withFoo(final int foo) { + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withFoo(final int foo) { this.foo = foo; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder with_Bar(final int _bar) { + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder with_Bar(final int _bar) { this._bar = _bar; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithAccessors build() { - return new BuilderWithAccessors(plower, upper, foo, _bar); + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefix build() { + return new BuilderWithAccessorsWithSetterPrefix(plower, upper, foo, _bar); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((("BuilderWithAccessors.BuilderWithAccessorsBuilder(plower=" + this.plower) + ", upper=") + this.upper) + ", foo=") + this.foo) + ", _bar=") + this._bar) + ")"); + return (((((((("BuilderWithAccessorsWithSetterPrefix.BuilderWithAccessorsWithSetterPrefixBuilder(plower=" + this.plower) + ", upper=") + this.upper) + ", foo=") + this.foo) + ", _bar=") + this._bar) + ")"); } } private final int plower; private final int pUpper; private int _foo; private int __bar; - @java.lang.SuppressWarnings("all") BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefix(final int plower, final int upper, final int foo, final int _bar) { super(); this.plower = plower; this.pUpper = upper; this._foo = foo; this.__bar = _bar; } - public static @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder builder() { - return new BuilderWithAccessorsBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder builder() { + return new BuilderWithAccessorsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java index 465517f7..248c77ad 100644 --- a/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java @@ -1,33 +1,33 @@ -public @lombok.Builder(setterPrefix = "with") class BuilderWithBadNames { - public static @java.lang.SuppressWarnings("all") class BuilderWithBadNamesBuilder { +public @lombok.Builder(setterPrefix = "with") class BuilderWithBadNamesWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithBadNamesWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") String build; private @java.lang.SuppressWarnings("all") String toString; - @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder withBuild(final String build) { + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder withBuild(final String build) { this.build = build; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder withToString(final String toString) { + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder withToString(final String toString) { this.toString = toString; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithBadNames build() { - return new BuilderWithBadNames(build, toString); + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefix build() { + return new BuilderWithBadNamesWithSetterPrefix(build, toString); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build) + ", toString=") + this.toString) + ")"); + return (((("BuilderWithBadNamesWithSetterPrefix.BuilderWithBadNamesWithSetterPrefixBuilder(build=" + this.build) + ", toString=") + this.toString) + ")"); } } String build; String toString; - @java.lang.SuppressWarnings("all") BuilderWithBadNames(final String build, final String toString) { + @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefix(final String build, final String toString) { super(); this.build = build; this.toString = toString; } - public static @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder builder() { - return new BuilderWithBadNamesBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder builder() { + return new BuilderWithBadNamesWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java index 0d8e023f..83fa2e4e 100644 --- a/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java @@ -1,57 +1,57 @@ import com.google.common.collect.ImmutableList; import lombok.Builder; import lombok.Singular; -public @Builder(setterPrefix = "with") class BuilderWithDeprecated { - public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedBuilder { +public @Builder(setterPrefix = "with") class BuilderWithDeprecatedWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") String dep1; private @java.lang.SuppressWarnings("all") int dep2; private @java.lang.SuppressWarnings("all") java.util.ArrayList strings; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder numbers; - @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder() { super(); } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withDep1(final String dep1) { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withDep1(final String dep1) { this.dep1 = dep1; return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withDep2(final int dep2) { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withDep2(final int dep2) { this.dep2 = dep2; return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withString(final String string) { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withString(final String string) { if ((this.strings == null)) this.strings = new java.util.ArrayList(); this.strings.add(string); return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withStrings(final java.util.Collection strings) { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withStrings(final java.util.Collection strings) { if ((this.strings == null)) this.strings = new java.util.ArrayList(); this.strings.addAll(strings); return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder clearStrings() { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder clearStrings() { if ((this.strings != null)) this.strings.clear(); return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withNumber(final Integer number) { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withNumber(final Integer number) { if ((this.numbers == null)) this.numbers = com.google.common.collect.ImmutableList.builder(); this.numbers.add(number); return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withNumbers(final java.lang.Iterable numbers) { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withNumbers(final java.lang.Iterable numbers) { if ((this.numbers == null)) this.numbers = com.google.common.collect.ImmutableList.builder(); this.numbers.addAll(numbers); return this; } - public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder clearNumbers() { + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder clearNumbers() { this.numbers = null; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithDeprecated build() { + public @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefix build() { java.util.List strings; switch (((this.strings == null) ? 0 : this.strings.size())) { case 0 : @@ -64,24 +64,24 @@ public @Builder(setterPrefix = "with") class BuilderWithDeprecated { strings = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.strings)); } com.google.common.collect.ImmutableList numbers = ((this.numbers == null) ? com.google.common.collect.ImmutableList.of() : this.numbers.build()); - return new BuilderWithDeprecated(dep1, dep2, strings, numbers); + return new BuilderWithDeprecatedWithSetterPrefix(dep1, dep2, strings, numbers); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((("BuilderWithDeprecated.BuilderWithDeprecatedBuilder(dep1=" + this.dep1) + ", dep2=") + this.dep2) + ", strings=") + this.strings) + ", numbers=") + this.numbers) + ")"); + return (((((((("BuilderWithDeprecatedWithSetterPrefix.BuilderWithDeprecatedWithSetterPrefixBuilder(dep1=" + this.dep1) + ", dep2=") + this.dep2) + ", strings=") + this.strings) + ", numbers=") + this.numbers) + ")"); } } String dep1; @Deprecated int dep2; @Singular @Deprecated java.util.List strings; @Singular @Deprecated ImmutableList numbers; - @java.lang.SuppressWarnings("all") BuilderWithDeprecated(final String dep1, final int dep2, final java.util.List strings, final ImmutableList numbers) { + @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefix(final String dep1, final int dep2, final java.util.List strings, final ImmutableList numbers) { super(); this.dep1 = dep1; this.dep2 = dep2; this.strings = strings; this.numbers = numbers; } - public static @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder builder() { - return new BuilderWithDeprecatedBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder builder() { + return new BuilderWithDeprecatedWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java index 220a8a63..8da2f012 100644 --- a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -1,36 +1,36 @@ import lombok.Builder; -class BuilderWithExistingBuilderClass { - public static class BuilderWithExistingBuilderClassBuilder { +class BuilderWithExistingBuilderClassWithSetterPrefix { + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") boolean arg2; private @java.lang.SuppressWarnings("all") String arg3; private Z arg1; public void withArg2(boolean arg) { } - @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder withArg1(final Z arg1) { + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder withArg1(final Z arg1) { this.arg1 = arg1; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder withArg3(final String arg3) { + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder withArg3(final String arg3) { this.arg3 = arg3; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClass build() { - return BuilderWithExistingBuilderClass.staticMethod(arg1, arg2, arg3); + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefix build() { + return BuilderWithExistingBuilderClassWithSetterPrefix.staticMethod(arg1, arg2, arg3); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ")"); + return (((((("BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder(arg1=" + this.arg1) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ")"); } } - BuilderWithExistingBuilderClass() { + BuilderWithExistingBuilderClassWithSetterPrefix() { super(); } - public static @Builder(setterPrefix = "with") BuilderWithExistingBuilderClass staticMethod(Z arg1, boolean arg2, String arg3) { + public static @Builder(setterPrefix = "with") BuilderWithExistingBuilderClassWithSetterPrefix staticMethod(Z arg1, boolean arg2, String arg3) { return null; } - public static @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder builder() { - return new BuilderWithExistingBuilderClassBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder builder() { + return new BuilderWithExistingBuilderClassWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java index 0b934767..30043dd9 100644 --- a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,27 +1,27 @@ import lombok.Builder; -@Builder(toBuilder = true,builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethod { - public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodBuilder { +@Builder(toBuilder = true,builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethodWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") String a; - @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder withA(final String a) { + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder withA(final String a) { this.a = a; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod build() { - return new BuilderWithNoBuilderMethod(a); + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefix build() { + return new BuilderWithNoBuilderMethodWithSetterPrefix(a); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a) + ")"); + return (("BuilderWithNoBuilderMethodWithSetterPrefix.BuilderWithNoBuilderMethodWithSetterPrefixBuilder(a=" + this.a) + ")"); } } private String a = ""; - @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod(final String a) { + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefix(final String a) { super(); this.a = a; } - public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder toBuilder() { - return new BuilderWithNoBuilderMethodBuilder().withA(this.a); + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder toBuilder() { + return new BuilderWithNoBuilderMethodWithSetterPrefixBuilder().withA(this.a); } } diff --git a/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java index 6379e25f..7f8cb80b 100644 --- a/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java @@ -1,10 +1,10 @@ -@lombok.Builder(setterPrefix = "with") class BuilderWithNonNull { - public static @java.lang.SuppressWarnings("all") class BuilderWithNonNullBuilder { +@lombok.Builder(setterPrefix = "with") class BuilderWithNonNullWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithNonNullWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") String id; - @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder withId(final @lombok.NonNull String id) { + public @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder withId(final @lombok.NonNull String id) { if ((id == null)) { throw new java.lang.NullPointerException("id is marked non-null but is null"); @@ -12,15 +12,15 @@ this.id = id; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithNonNull build() { - return new BuilderWithNonNull(id); + public @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefix build() { + return new BuilderWithNonNullWithSetterPrefix(id); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderWithNonNull.BuilderWithNonNullBuilder(id=" + this.id) + ")"); + return (("BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder(id=" + this.id) + ")"); } } private final @lombok.NonNull String id; - @java.lang.SuppressWarnings("all") BuilderWithNonNull(final @lombok.NonNull String id) { + @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefix(final @lombok.NonNull String id) { super(); if ((id == null)) { @@ -28,7 +28,7 @@ } this.id = id; } - public static @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder builder() { - return new BuilderWithNonNullBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder builder() { + return new BuilderWithNonNullWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java index 32b9c20e..2ce25b0a 100644 --- a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -1,7 +1,7 @@ import java.util.Set; import lombok.Builder; import lombok.Value; -public class BuilderWithRecursiveGenerics { +public class BuilderWithRecursiveGenericsWithSetterPrefix { interface Inter> { } public static final @Builder(setterPrefix = "with(setterPrefix = "with")") @Value class Test, Quz extends Inter> { @@ -23,7 +23,7 @@ public class BuilderWithRecursiveGenerics { return new Test(foo, bar); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo) + ", bar=") + this.bar) + ")"); + return (((("BuilderWithRecursiveGenericsWithSetterPrefix.Test.TestBuilder(foo=" + this.foo) + ", bar=") + this.bar) + ")"); } } private final Foo foo; @@ -45,9 +45,9 @@ public class BuilderWithRecursiveGenerics { public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((! (o instanceof BuilderWithRecursiveGenerics.Test))) + if ((! (o instanceof BuilderWithRecursiveGenericsWithSetterPrefix.Test))) return false; - final BuilderWithRecursiveGenerics.Test other = (BuilderWithRecursiveGenerics.Test) o; + final BuilderWithRecursiveGenericsWithSetterPrefix.Test other = (BuilderWithRecursiveGenericsWithSetterPrefix.Test) o; final java.lang.Object this$foo = this.getFoo(); final java.lang.Object other$foo = other.getFoo(); if (((this$foo == null) ? (other$foo != null) : (! this$foo.equals(other$foo)))) @@ -68,10 +68,10 @@ public class BuilderWithRecursiveGenerics { return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); + return (((("BuilderWithRecursiveGenericsWithSetterPrefix.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); } } - public BuilderWithRecursiveGenerics() { + public BuilderWithRecursiveGenericsWithSetterPrefix() { super(); } } diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java index 85378cab..c33315a4 100644 --- a/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java @@ -1,44 +1,44 @@ import java.util.List; import lombok.Builder; -@Builder(toBuilder = true,setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilder { - public static @java.lang.SuppressWarnings("all") class BuilderWithToBuilderBuilder { +@Builder(toBuilder = true,setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilderWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithToBuilderWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") String one; private @java.lang.SuppressWarnings("all") String two; private @java.lang.SuppressWarnings("all") T foo; private @java.lang.SuppressWarnings("all") java.util.ArrayList bars; - @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withOne(final String one) { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder withOne(final String one) { this.one = one; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withTwo(final String two) { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder withTwo(final String two) { this.two = two; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withFoo(final T foo) { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder withFoo(final T foo) { this.foo = foo; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withBar(final T bar) { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder withBar(final T bar) { if ((this.bars == null)) this.bars = new java.util.ArrayList(); this.bars.add(bar); return this; } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder withBars(final java.util.Collection bars) { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder withBars(final java.util.Collection bars) { if ((this.bars == null)) this.bars = new java.util.ArrayList(); this.bars.addAll(bars); return this; } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder clearBars() { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder clearBars() { if ((this.bars != null)) this.bars.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilder build() { + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefix build() { java.util.List bars; switch (((this.bars == null) ? 0 : this.bars.size())) { case 0 : @@ -50,31 +50,31 @@ import lombok.Builder; default : bars = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.bars)); } - return new BuilderWithToBuilder(one, two, foo, bars); + return new BuilderWithToBuilderWithSetterPrefix(one, two, foo, bars); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((("BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one) + ", two=") + this.two) + ", foo=") + this.foo) + ", bars=") + this.bars) + ")"); + return (((((((("BuilderWithToBuilderWithSetterPrefix.BuilderWithToBuilderWithSetterPrefixBuilder(one=" + this.one) + ", two=") + this.two) + ", foo=") + this.foo) + ", bars=") + this.bars) + ")"); } } private String mOne; private String mTwo; private @Builder.ObtainVia(method = "rrr",isStatic = true) T foo; private @lombok.Singular List bars; - public static K rrr(BuilderWithToBuilder x) { + public static K rrr(BuilderWithToBuilderWithSetterPrefix x) { return x.foo; } - @java.lang.SuppressWarnings("all") BuilderWithToBuilder(final String one, final String two, final T foo, final List bars) { + @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefix(final String one, final String two, final T foo, final List bars) { super(); this.mOne = one; this.mTwo = two; this.foo = foo; this.bars = bars; } - public static @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder builder() { - return new BuilderWithToBuilderBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder builder() { + return new BuilderWithToBuilderWithSetterPrefixBuilder(); } - public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder toBuilder() { - final BuilderWithToBuilderBuilder builder = new BuilderWithToBuilderBuilder().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilder.rrr(this)); + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder toBuilder() { + final BuilderWithToBuilderWithSetterPrefixBuilder builder = new BuilderWithToBuilderWithSetterPrefixBuilder().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilderWithSetterPrefix.rrr(this)); if ((this.bars != null)) builder.withBars(this.bars); return builder; diff --git a/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java index a795bafc..6fa302e5 100644 --- a/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java @@ -1,34 +1,34 @@ import lombok.Builder; import lombok.experimental.Tolerate; -public @Builder(setterPrefix = "with") class BuilderWithTolerate { - public static class BuilderWithTolerateBuilder { +public @Builder(setterPrefix = "with") class BuilderWithTolerateWithSetterPrefix { + public static class BuilderWithTolerateWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") int value; - public @Tolerate BuilderWithTolerateBuilder withValue(String s) { + public @Tolerate BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) { return this.withValue(Integer.parseInt(s)); } - @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder() { + @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder withValue(final int value) { + public @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder withValue(final int value) { this.value = value; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithTolerate build() { - return new BuilderWithTolerate(value); + public @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefix build() { + return new BuilderWithTolerateWithSetterPrefix(value); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value) + ")"); + return (("BuilderWithTolerateWithSetterPrefix.BuilderWithTolerateWithSetterPrefixBuilder(value=" + this.value) + ")"); } } private final int value; public static void main(String[] args) { - BuilderWithTolerate.builder().withValue("42").build(); + BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build(); } - @java.lang.SuppressWarnings("all") BuilderWithTolerate(final int value) { + @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefix(final int value) { super(); this.value = value; } - public static @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder builder() { - return new BuilderWithTolerateBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder builder() { + return new BuilderWithTolerateWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java index 38f3c029..19ab7af1 100644 --- a/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java @@ -1,6 +1,6 @@ import java.util.List; @lombok.Builder(access = lombok.AccessLevel.PROTECTED, setterPrefix = "with") -class BuilderWithPrefix { +class BuilderSimpleWithSetterPrefix { private int unprefixed; } -- cgit From f222050d13364565692cd585ff5d9a055498c52e Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 12 Sep 2019 12:02:04 -0500 Subject: Fix class names in before --- .../before/BuilderSingularAnnotatedTypesWithSetterPrefix.java | 2 +- .../before/BuilderSingularGuavaListsSetsWithSetterPrefix.java | 2 +- .../resource/before/BuilderSingularGuavaMapsWithPrefix.java | 2 +- .../resource/before/BuilderSingularListsWithSetterPrefix.java | 2 +- .../resource/before/BuilderSingularMapsWithSetterPrefix.java | 2 +- .../resource/before/BuilderSingularNoAutoWithSetterPrefix.java | 2 +- .../before/BuilderSingularRedirectToGuavaWithSetterPrefix.java | 2 +- .../resource/before/BuilderSingularSetsWithSetterPrefix.java | 2 +- .../before/BuilderSingularToBuilderWithNullWithSetterPrefix.java | 2 +- ...BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java | 2 +- .../before/BuilderSingularWithPrefixesWithSetterPrefix.java | 2 +- .../resource/before/BuilderTypeAnnosWithSetterPrefix.java | 2 +- .../resource/before/BuilderValueDataWithSetterPrefix.java | 6 +++--- .../resource/before/BuilderWithAccessorsWithSetterPrefix.java | 2 +- .../resource/before/BuilderWithBadNamesWithSetterPrefix.java | 2 +- .../resource/before/BuilderWithDeprecatedWithSetterPrefix.java | 2 +- .../before/BuilderWithExistingBuilderClassWithSetterPrefix.java | 6 +++--- .../before/BuilderWithNoBuilderMethodWithSetterPrefix.java | 2 +- .../resource/before/BuilderWithNonNullWithSetterPrefix.java | 2 +- .../before/BuilderWithRecursiveGenericsWithSetterPrefix.java | 2 +- .../resource/before/BuilderWithToBuilderWithSetterPrefix.java | 6 +++--- .../resource/before/BuilderWithTolerateWithSetterPrefix.java | 8 ++++---- 22 files changed, 31 insertions(+), 31 deletions(-) (limited to 'test/transform/resource') diff --git a/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java index 2ef83429..ef8cb2e3 100644 --- a/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -8,7 +8,7 @@ import lombok.Singular; @Target(ElementType.TYPE_USE) @interface MyAnnotation {} @lombok.Builder(setterPrefix = "with") -class BuilderSingularAnnotatedTypes { +class BuilderSingularAnnotatedTypesWithSetterPrefix { @Singular private Set<@MyAnnotation @NonNull String> foos; @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; } diff --git a/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java index 678b2e9f..af02adb6 100644 --- a/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -7,7 +7,7 @@ import com.google.common.collect.ImmutableTable; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularGuavaListsSets { +class BuilderSingularGuavaListsSetsWithSetterPrefix { @Singular private ImmutableList cards; @Singular private ImmutableCollection frogs; @SuppressWarnings("all") @Singular("rawSet") private ImmutableSet rawSet; diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java index 89de9a9c..a2b48cb3 100644 --- a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java +++ b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java @@ -5,7 +5,7 @@ import com.google.common.collect.ImmutableSortedMap; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularGuavaMaps { +class BuilderSingularGuavaMapsWithSetterPrefix { @Singular private ImmutableMap battleaxes; @Singular private ImmutableSortedMap vertices; @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap; diff --git a/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java index 101e7972..fd53d97f 100644 --- a/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java @@ -4,7 +4,7 @@ import java.util.Collection; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularLists { +class BuilderSingularListsWithSetterPrefix { @Singular private List children; @Singular private Collection scarves; @SuppressWarnings("all") @Singular("rawList") private List rawList; diff --git a/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java index e77bcf6e..728ad59a 100644 --- a/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java @@ -7,7 +7,7 @@ import java.util.SortedMap; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularMaps { +class BuilderSingularMapsWithSetterPrefix { @Singular private Map women; @Singular private SortedMap men; @SuppressWarnings("all") @Singular("rawMap") private Map rawMap; diff --git a/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java index 0474c764..fa55c553 100644 --- a/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java @@ -4,7 +4,7 @@ import java.util.List; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularNoAuto { +class BuilderSingularNoAutoWithSetterPrefix { @Singular private List things; @Singular("widget") private List widgets; @Singular private List items; diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java index c3fdc7c6..7281141d 100644 --- a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -6,7 +6,7 @@ import java.util.Collection; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularRedirectToGuava { +class BuilderSingularRedirectToGuavaWithSetterPrefix { @Singular private Set dangerMice; @Singular private NavigableMap things; @Singular private Collection> doohickeys; diff --git a/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java index 16026f2d..d2824109 100644 --- a/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java @@ -4,7 +4,7 @@ import java.util.SortedSet; import lombok.Singular; @lombok.Builder(setterPrefix = "with") -class BuilderSingularSets { +class BuilderSingularSetsWithSetterPrefix { @Singular private Set dangerMice; @Singular private SortedSet octopodes; @SuppressWarnings("all") @Singular("rawSet") private Set rawSet; diff --git a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java index f7a411f0..845b38df 100644 --- a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -1,7 +1,7 @@ import lombok.Singular; @lombok.Builder(toBuilder = true, setterPrefix = "with") -class BuilderSingularToBuilderWithNull { +class BuilderSingularToBuilderWithNullWithSetterPrefix { @Singular private java.util.List elems; public static void test() { diff --git a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index 817f4be5..cea10bab 100644 --- a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -4,7 +4,7 @@ import java.util.Collection; import lombok.Singular; @lombok.Builder(toBuilder = true, setterPrefix = "with") -class BuilderSingularWildcardListsWithToBuilder { +class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { @Singular private List objects; @Singular private Collection numbers; } diff --git a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java index 63df4a71..1b953668 100644 --- a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -2,6 +2,6 @@ import lombok.Singular; @lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") -class BuilderSingularWithPrefixes { +class BuilderSingularWithPrefixesWithSetterPrefix { @Singular private java.util.List _elems; } diff --git a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java index 65faf01d..4adde2a0 100644 --- a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java @@ -9,6 +9,6 @@ import java.util.List; @interface TB { } @lombok.Builder(setterPrefix = "with") -class BuilderTypeAnnos { +class BuilderTypeAnnosWithSetterPrefix { private @TA @TB List foo; } diff --git a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java index e5d9dc92..530c24d2 100644 --- a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java @@ -1,11 +1,11 @@ import java.util.List; -@lombok.Builder @lombok.Value -class BuilderAndValue { +@lombok.Builder(setterPrefix = "with") @lombok.Value +class BuilderAndValueWithSetterPrefix { private final int zero = 0; } @lombok.Builder(setterPrefix = "with") @lombok.Data -class BuilderAndData { +class BuilderAndDataWithSetterPrefix { private final int zero = 0; } diff --git a/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java index b14527a1..4f4ebb18 100644 --- a/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java @@ -1,5 +1,5 @@ @lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix={"p", "_"}) -class BuilderWithAccessors { +class BuilderWithAccessorsWithSetterPrefix { private final int plower; private final int pUpper; private int _foo; diff --git a/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java index da344f76..69322ee3 100644 --- a/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java @@ -1,5 +1,5 @@ @lombok.Builder(setterPrefix = "with") -public class BuilderWithBadNames { +public class BuilderWithBadNamesWithSetterPrefix { String build; String toString; } diff --git a/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java index 5047de45..77baccd3 100644 --- a/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java @@ -3,7 +3,7 @@ import lombok.Builder; import lombok.Singular; @Builder(setterPrefix = "with") -public class BuilderWithDeprecated { +public class BuilderWithDeprecatedWithSetterPrefix { /** @deprecated since always */ String dep1; @Deprecated int dep2; @Singular @Deprecated java.util.List strings; diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java index f931d507..cb699295 100644 --- a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -1,12 +1,12 @@ import lombok.Builder; -class BuilderWithExistingBuilderClass { +class BuilderWithExistingBuilderClassWithSetterPrefix { @Builder(setterPrefix = "with") - public static BuilderWithExistingBuilderClass staticMethod(Z arg1, boolean arg2, String arg3) { + public static BuilderWithExistingBuilderClassWithSetterPrefix staticMethod(Z arg1, boolean arg2, String arg3) { return null; } - public static class BuilderWithExistingBuilderClassBuilder { + public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefix { private Z arg1; public void withArg2(boolean arg) { diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java index fa8b8f09..b787e303 100644 --- a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,5 +1,5 @@ import lombok.Builder(setterPrefix = "with"); @Builder(toBuilder = true, builderMethodName = "", setterPrefix = "with") -class BuilderWithNoBuilderMethod { +class BuilderWithNoBuilderMethodWithSetterPrefix { private String a = ""; } diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java index 1a18fbc7..8ef1f70e 100644 --- a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java @@ -1,5 +1,5 @@ @lombok.Builder(setterPrefix = "with") -class BuilderWithNonNull { +class BuilderWithNonNullWithSetterPrefix { @lombok.NonNull private final String id; } diff --git a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java index 85129223..ce8803c0 100644 --- a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -3,7 +3,7 @@ import java.util.Set; import lombok.Builder; import lombok.Value; -public class BuilderWithRecursiveGenerics { +public class BuilderWithRecursiveGenericsWithSetterPrefix { interface Inter> {} @Builder(setterPrefix = "with") @Value public static class Test, Quz extends Inter> { diff --git a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java index 8be20f58..b33211e9 100644 --- a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java @@ -1,7 +1,7 @@ import java.util.List; import lombok.Builder; @Builder(toBuilder = true, setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") -class BuilderWithToBuilder { +class BuilderWithToBuilderWithSetterPrefix { private String mOne, mTwo; @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; @lombok.Singular private List bars; @@ -10,11 +10,11 @@ class BuilderWithToBuilder { } } @lombok.experimental.Accessors(prefix = "m") -class ConstructorWithToBuilder { +class ConstructorWithToBuilderWithSetterPrefix { private String mOne, mTwo; private T foo; @lombok.Singular private com.google.common.collect.ImmutableList bars; - @Builder(toBuilder = true) + @Builder(toBuilder = true, setterPrefix = "with") public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { } } diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java index 2f4db558..fa7c0298 100644 --- a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java @@ -2,16 +2,16 @@ import lombok.Builder; import lombok.experimental.Tolerate; @Builder(setterPrefix = "with") -public class BuilderWithTolerate { +public class BuilderWithTolerateWithSetterPrefix { private final int value; public static void main(String[] args) { - BuilderWithTolerate.builder().value("42").build(); + BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build(); } - public static class BuilderWithTolerateBuilder { + public static class BuilderWithTolerateWithSetterPrefixBuilder { @Tolerate - public BuilderWithTolerateBuilder value(String s) { + public BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) { return this.value(Integer.parseInt(s)); } } -- cgit From 8b30eee6042c40ad0c815f5c67c86c9bf15f0dbb Mon Sep 17 00:00:00 2001 From: abrinkman94 Date: Thu, 12 Sep 2019 12:32:12 -0500 Subject: Adjusted test classes to include WithSetterPrefix. --- .../BuilderSimpleWithSetterPrefix.java | 20 +++---- ...lderSingularAnnotatedTypesWithSetterPrefix.java | 28 +++++----- ...lderSingularGuavaListsSetsWithSetterPrefix.java | 46 ++++++++-------- .../BuilderSingularListsWithSetterPrefix.java | 34 ++++++------ .../BuilderSingularMapsWithSetterPrefix.java | 38 ++++++------- .../BuilderSingularNoAutoWithSetterPrefix.java | 34 ++++++------ ...derSingularRedirectToGuavaWithSetterPrefix.java | 36 ++++++------ ...rSingularToBuilderWithNullWithSetterPrefix.java | 30 +++++----- ...WildcardListsWithToBuilderWithSetterPrefix.java | 34 ++++++------ ...uilderSingularWithPrefixesWithSetterPrefix.java | 24 ++++---- .../BuilderTypeAnnosWithSetterPrefix.java | 20 +++---- .../BuilderValueDataWithSetterPrefix.java | 50 ++++++++--------- .../BuilderWithAccessorsWithSetterPrefix.java | 26 ++++----- .../BuilderWithBadNamesWithSetterPrefix.java | 22 ++++---- .../BuilderWithDeprecatedWithSetterPrefix.java | 34 ++++++------ ...erWithExistingBuilderClassWithSetterPrefix.java | 22 ++++---- ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 20 +++---- .../BuilderWithNonNullWithSetterPrefix.java | 20 +++---- ...ilderWithRecursiveGenericsWithSetterPrefix.java | 10 ++-- .../BuilderWithToBuilderWithSetterPrefix.java | 64 +++++++++++----------- .../BuilderWithTolerateWithSetterPrefix.java | 24 ++++---- 21 files changed, 318 insertions(+), 318 deletions(-) (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java index c29d2a16..b10ad619 100644 --- a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java @@ -1,34 +1,34 @@ import java.util.List; -class BuilderWithPrefix { +class BuilderSimpleWithSetterPrefix { private int unprefixed; @java.lang.SuppressWarnings("all") - BuilderWithPrefix(final int unprefixed) { + BuilderSimpleWithSetterPrefix(final int unprefixed) { this.unprefixed = unprefixed; } @java.lang.SuppressWarnings("all") - protected static class BuilderWithPrefixBuilder { + protected static class BuilderSimpleWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private int unprefixed; @java.lang.SuppressWarnings("all") - BuilderWithPrefixBuilder() { + BuilderSimpelWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { + public BuilderSimpleWithSetterPrefixBuilder withUnprefixed(final int unprefixed) { this.unprefixed = unprefixed; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithPrefix build() { - return new BuilderWithPrefix(unprefixed); + public BuilderSimpleWithSetterPrefix build() { + return new BuilderSimpleWithSetterPrefix(unprefixed); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed + ")"; + return "BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder(unprefixed=" + this.unprefixed + ")"; } } @java.lang.SuppressWarnings("all") - protected static BuilderWithPrefixBuilder builder() { - return new BuilderWithPrefixBuilder(); + protected static BuilderSimpleWithSetterPrefixBuilder builder() { + return new BuilderSimpleWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java index 2d535e65..c90e3233 100644 --- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -6,16 +6,16 @@ import lombok.NonNull; @Target(ElementType.TYPE_USE) @interface MyAnnotation { } -class BuilderSingularAnnotatedTypes { +class BuilderSingularAnnotatedTypesWithSetterPrefix { private Set<@MyAnnotation @NonNull String> foos; private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; @java.lang.SuppressWarnings("all") - BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { + BuilderSingularAnnotatedTypesWithSetterPrefix(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { this.foos = foos; this.bars = bars; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularAnnotatedTypesBuilder { + public static class BuilderSingularAnnotatedTypesWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList<@MyAnnotation @NonNull String> foos; @java.lang.SuppressWarnings("all") @@ -23,10 +23,10 @@ class BuilderSingularAnnotatedTypes { @java.lang.SuppressWarnings("all") private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; @java.lang.SuppressWarnings("all") - BuilderSingularAnnotatedTypesBuilder() { + BuilderSingularAnnotatedTypesWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypesBuilder withFoo(@MyAnnotation @NonNull final String foo) { + public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoo(@MyAnnotation @NonNull final String foo) { if (foo == null) { throw new java.lang.NullPointerException("foo is marked non-null but is null"); } @@ -35,18 +35,18 @@ class BuilderSingularAnnotatedTypes { return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypesBuilder withFoos(final java.util.Collection foos) { + public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection foos) { if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); this.foos.addAll(foos); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypesBuilder clearFoos() { + public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearFoos() { if (this.foos != null) this.foos.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypesBuilder withBar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) { + public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) { if (barKey == null) { throw new java.lang.NullPointerException("barKey is marked non-null but is null"); } @@ -62,7 +62,7 @@ class BuilderSingularAnnotatedTypes { return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypesBuilder withBars(final java.util.Map bars) { + public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map bars) { if (this.bars$key == null) { this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); @@ -74,7 +74,7 @@ class BuilderSingularAnnotatedTypes { return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypesBuilder clearBars() { + public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearBars() { if (this.bars$key != null) { this.bars$key.clear(); this.bars$value.clear(); @@ -82,7 +82,7 @@ class BuilderSingularAnnotatedTypes { return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularAnnotatedTypes build() { + public BuilderSingularAnnotatedTypesWithSetterPrefix build() { java.util.Set<@MyAnnotation @NonNull String> foos; switch (this.foos == null ? 0 : this.foos.size()) { case 0: @@ -109,16 +109,16 @@ class BuilderSingularAnnotatedTypes { for (int $i = 0; $i < this.bars$key.size(); $i++) bars.put(this.bars$key.get($i), (@MyAnnotation @NonNull Integer) this.bars$value.get($i)); bars = java.util.Collections.unmodifiableMap(bars); } - return new BuilderSingularAnnotatedTypes(foos, bars); + return new BuilderSingularAnnotatedTypesWithSetterPrefix(foos, bars); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")"; + return "BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularAnnotatedTypesBuilder builder() { + public static BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() { return new BuilderSingularAnnotatedTypesBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java index 0e9e6dfd..792a873e 100644 --- a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.ImmutableTable; -class BuilderSingularGuavaListsSets { +class BuilderSingularGuavaListsSetsWithSetterPrefix { private ImmutableList cards; private ImmutableCollection frogs; @SuppressWarnings("all") @@ -11,7 +11,7 @@ class BuilderSingularGuavaListsSets { private ImmutableSortedSet passes; private ImmutableTable users; @java.lang.SuppressWarnings("all") - BuilderSingularGuavaListsSets(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes, final ImmutableTable users) { + BuilderSingularGuavaListsSetsWithSetterPrefix(final ImmutableList cards, final ImmutableCollection frogs, final ImmutableSet rawSet, final ImmutableSortedSet passes, final ImmutableTable users) { this.cards = cards; this.frogs = frogs; this.rawSet = rawSet; @@ -19,7 +19,7 @@ class BuilderSingularGuavaListsSets { this.users = users; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularGuavaListsSetsBuilder { + public static class BuilderSingularGuavaListsSetsWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private com.google.common.collect.ImmutableList.Builder cards; @java.lang.SuppressWarnings("all") @@ -34,107 +34,107 @@ class BuilderSingularGuavaListsSets { BuilderSingularGuavaListsSetsBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withCard(final T card) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withCard(final T card) { if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); this.cards.add(card); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withCards(final java.lang.Iterable cards) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withCards(final java.lang.Iterable cards) { if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); this.cards.addAll(cards); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder clearCards() { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearCards() { this.cards = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withFrog(final Number frog) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withFrog(final Number frog) { if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); this.frogs.add(frog); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withFrogs(final java.lang.Iterable frogs) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withFrogs(final java.lang.Iterable frogs) { if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); this.frogs.addAll(frogs); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder clearFrogs() { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearFrogs() { this.frogs = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Object rawSet) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withRawSet(final java.lang.Object rawSet) { if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); this.rawSet.add(rawSet); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withRawSet(final java.lang.Iterable rawSet) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withRawSet(final java.lang.Iterable rawSet) { if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); this.rawSet.addAll(rawSet); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder clearRawSet() { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearRawSet() { this.rawSet = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withPass(final String pass) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withPass(final String pass) { if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); this.passes.add(pass); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withPasses(final java.lang.Iterable passes) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withPasses(final java.lang.Iterable passes) { if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); this.passes.addAll(passes); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder clearPasses() { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearPasses() { this.passes = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withUser(final Number rowKey, final Number columnKey, final String value) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withUser(final Number rowKey, final Number columnKey, final String value) { if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); this.users.put(rowKey, columnKey, value); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder withUsers(final com.google.common.collect.Table users) { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withUsers(final com.google.common.collect.Table users) { if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); this.users.putAll(users); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSetsBuilder clearUsers() { + public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder clearUsers() { this.users = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularGuavaListsSets build() { + public BuilderSingularGuavaListsSetsWithSetterPrefix build() { com.google.common.collect.ImmutableList cards = this.cards == null ? com.google.common.collect.ImmutableList.of() : this.cards.build(); com.google.common.collect.ImmutableCollection frogs = this.frogs == null ? com.google.common.collect.ImmutableList.of() : this.frogs.build(); com.google.common.collect.ImmutableSet rawSet = this.rawSet == null ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build(); com.google.common.collect.ImmutableSortedSet passes = this.passes == null ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build(); com.google.common.collect.ImmutableTable users = this.users == null ? com.google.common.collect.ImmutableTable.of() : this.users.build(); - return new BuilderSingularGuavaListsSets(cards, frogs, rawSet, passes, users); + return new BuilderSingularGuavaListsSetsWithSetterPrefix(cards, frogs, rawSet, passes, users); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ", users=" + this.users + ")"; + return "BuilderSingularGuavaListsSetsWithSetterPrefix.BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ", users=" + this.users + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularGuavaListsSetsBuilder builder() { - return new BuilderSingularGuavaListsSetsBuilder(); + public static BuilderSingularGuavaListsSetsWithSetterPrefixBuilder builder() { + return new BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java index 1fd58406..029ecda7 100644 --- a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java @@ -1,18 +1,18 @@ import java.util.List; import java.util.Collection; -class BuilderSingularLists { +class BuilderSingularListsWithSetterPrefix { private List children; private Collection scarves; @SuppressWarnings("all") private List rawList; @java.lang.SuppressWarnings("all") - BuilderSingularLists(final List children, final Collection scarves, final List rawList) { + BuilderSingularListsWithSetterPrefix(final List children, final Collection scarves, final List rawList) { this.children = children; this.scarves = scarves; this.rawList = rawList; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularListsBuilder { + public static class BuilderSingularListsWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList children; @java.lang.SuppressWarnings("all") @@ -23,58 +23,58 @@ class BuilderSingularLists { BuilderSingularListsBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder withChild(final T child) { + public BuilderSingularListsWithSetterPrefixBuilder withChild(final T child) { if (this.children == null) this.children = new java.util.ArrayList(); this.children.add(child); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder withChildren(final java.util.Collection children) { + public BuilderSingularListsWithSetterPrefixBuilder withChildren(final java.util.Collection children) { if (this.children == null) this.children = new java.util.ArrayList(); this.children.addAll(children); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder clearChildren() { + public BuilderSingularListsWithSetterPrefixBuilder clearChildren() { if (this.children != null) this.children.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder withScarf(final Number scarf) { + public BuilderSingularListsWithSetterPrefixBuilder withScarf(final Number scarf) { if (this.scarves == null) this.scarves = new java.util.ArrayList(); this.scarves.add(scarf); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder withScarves(final java.util.Collection scarves) { + public BuilderSingularListsWithSetterPrefixBuilder withScarves(final java.util.Collection scarves) { if (this.scarves == null) this.scarves = new java.util.ArrayList(); this.scarves.addAll(scarves); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder clearScarves() { + public BuilderSingularListsWithSetterPrefixBuilder clearScarves() { if (this.scarves != null) this.scarves.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder withRawList(final java.lang.Object rawList) { + public BuilderSingularListsWithSetterPrefixBuilder withRawList(final java.lang.Object rawList) { if (this.rawList == null) this.rawList = new java.util.ArrayList(); this.rawList.add(rawList); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder withRawList(final java.util.Collection rawList) { + public BuilderSingularListsWithSetterPrefixBuilder withRawList(final java.util.Collection rawList) { if (this.rawList == null) this.rawList = new java.util.ArrayList(); this.rawList.addAll(rawList); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularListsBuilder clearRawList() { + public BuilderSingularListsWithSetterPrefixBuilder clearRawList() { if (this.rawList != null) this.rawList.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularLists build() { + public BuilderSingularListsWithSetterPrefix build() { java.util.List children; switch (this.children == null ? 0 : this.children.size()) { case 0: @@ -108,16 +108,16 @@ class BuilderSingularLists { default: rawList = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.rawList)); } - return new BuilderSingularLists(children, scarves, rawList); + return new BuilderSingularListsWithSetterPrefix(children, scarves, rawList); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")"; + return "BuilderSingularListsWithSetterPrefix.BuilderSingularListsWithSetterPrefixBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularListsBuilder builder() { - return new BuilderSingularListsBuilder(); + public static BuilderSingularListsWithSetterPrefixBuilder builder() { + return new BuilderSingularListsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java index 4b250994..361a9f09 100644 --- a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java @@ -1,6 +1,6 @@ import java.util.Map; import java.util.SortedMap; -class BuilderSingularMaps { +class BuilderSingularMapsWithSetterPrefix { private Map women; private SortedMap men; @SuppressWarnings("all") @@ -14,7 +14,7 @@ class BuilderSingularMaps { this.stringMap = stringMap; } @SuppressWarnings("all") - public static class BuilderSingularMapsBuilder { + public static class BuilderSingularMapsWithSetterPrefixBuilder { @SuppressWarnings("all") private java.util.ArrayList women$key; @SuppressWarnings("all") @@ -35,7 +35,7 @@ class BuilderSingularMaps { BuilderSingularMapsBuilder() { } @SuppressWarnings("all") - public BuilderSingularMapsBuilder withWoman(K womanKey, V womanValue) { + public BuilderSingularMapsWithSetterPrefixBuilder withWoman(K womanKey, V womanValue) { if (this.women$key == null) { this.women$key = new java.util.ArrayList(); this.women$value = new java.util.ArrayList(); @@ -45,7 +45,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder withWomen(java.util.Map women) { + public BuilderSingularMapsWithSetterPrefixBuilder withWomen(java.util.Map women) { if (this.women$key == null) { this.women$key = new java.util.ArrayList(); this.women$value = new java.util.ArrayList(); @@ -57,7 +57,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder clearWomen() { + public BuilderSingularMapsWithSetterPrefixBuilder clearWomen() { if (this.women$key != null) { this.women$key.clear(); this.women$value.clear(); @@ -65,7 +65,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder withMan(K manKey, Number manValue) { + public BuilderSingularMapsWithSetterPrefixBuilder withMan(K manKey, Number manValue) { if (this.men$key == null) { this.men$key = new java.util.ArrayList(); this.men$value = new java.util.ArrayList(); @@ -75,7 +75,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder withMen(java.util.Map men) { + public BuilderSingularMapsWithSetterPrefixBuilder withMen(java.util.Map men) { if (this.men$key == null) { this.men$key = new java.util.ArrayList(); this.men$value = new java.util.ArrayList(); @@ -87,7 +87,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder clearMen() { + public BuilderSingularMapsWithSetterPrefixBuilder clearMen() { if (this.men$key != null) { this.men$key.clear(); this.men$value.clear(); @@ -95,7 +95,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder withRawMan(Object rawMapKey, Object rawMapValue) { + public BuilderSingularMapsWithSetterPrefixBuilder withRawMan(Object rawMapKey, Object rawMapValue) { if (this.rawMap$key == null) { this.rawMap$key = new java.util.ArrayList(); this.rawMap$value = new java.util.ArrayList(); @@ -105,7 +105,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder withRawMap(java.util.Map rawMap) { + public BuilderSingularMapsWithSetterPrefixBuilder withRawMap(java.util.Map rawMap) { if (this.rawMap$key == null) { this.rawMap$key = new java.util.ArrayList(); this.rawMap$value = new java.util.ArrayList(); @@ -117,7 +117,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder clearRawMap() { + public BuilderSingularMapsWithSetterPrefixBuilder clearRawMap() { if (this.rawMap$key != null) { this.rawMap$key.clear(); this.rawMap$value.clear(); @@ -125,7 +125,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder stringMap(String stringMapKey, V stringMapValue) { + public BuilderSingularMapsWithSetterPrefixBuilder stringMap(String stringMapKey, V stringMapValue) { if (this.stringMap$key == null) { this.stringMap$key = new java.util.ArrayList(); this.stringMap$value = new java.util.ArrayList(); @@ -135,7 +135,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder stringMap(java.util.Map stringMap) { + public BuilderSingularMapsWithSetterPrefixBuilder stringMap(java.util.Map stringMap) { if (this.stringMap$key == null) { this.stringMap$key = new java.util.ArrayList(); this.stringMap$value = new java.util.ArrayList(); @@ -147,7 +147,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMapsBuilder clearStringMap() { + public BuilderSingularMapsWithSetterPrefixBuilder clearStringMap() { if (this.stringMap$key != null) { this.stringMap$key.clear(); this.stringMap$value.clear(); @@ -155,7 +155,7 @@ class BuilderSingularMaps { return this; } @SuppressWarnings("all") - public BuilderSingularMaps build() { + public BuilderSingularMapsWithSetterPrefix build() { java.util.Map women; switch (this.women$key == null ? 0 : this.women$key.size()) { case 0: @@ -198,16 +198,16 @@ class BuilderSingularMaps { for (int $i = 0; $i < this.stringMap$key.size(); $i++) stringMap.put(this.stringMap$key.get($i), (V) this.stringMap$value.get($i)); stringMap = java.util.Collections.unmodifiableMap(stringMap); } - return new BuilderSingularMaps(women, men, rawMap, stringMap); + return new BuilderSingularMapsWithSetterPrefix(women, men, rawMap, stringMap); } @Override @SuppressWarnings("all") public String toString() { - return "BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key + ", women$value=" + this.women$value + ", men$key=" + this.men$key + ", men$value=" + this.men$value + ", rawMap$key=" + this.rawMap$key + ", rawMap$value=" + this.rawMap$value + ", stringMap$key=" + this.stringMap$key + ", stringMap$value=" + this.stringMap$value + ")"; + return "BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder(women$key=" + this.women$key + ", women$value=" + this.women$value + ", men$key=" + this.men$key + ", men$value=" + this.men$value + ", rawMap$key=" + this.rawMap$key + ", rawMap$value=" + this.rawMap$value + ", stringMap$key=" + this.stringMap$key + ", stringMap$value=" + this.stringMap$value + ")"; } } @SuppressWarnings("all") - public static BuilderSingularMapsBuilder builder() { - return new BuilderSingularMapsBuilder(); + public static BuilderSingularMapsWithSetterPrefixBuilder builder() { + return new BuilderSingularMapsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java index 453b9d74..6a22152b 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -1,16 +1,16 @@ import java.util.List; -class BuilderSingularNoAuto { +class BuilderSingularNoAutoWithSetterPrefix { private List things; private List widgets; private List items; @java.lang.SuppressWarnings("all") - BuilderSingularNoAuto(final List things, final List widgets, final List items) { + BuilderSingularNoAutoWithSetterPrefix(final List things, final List widgets, final List items) { this.things = things; this.widgets = widgets; this.items = items; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularNoAutoBuilder { + public static class BuilderSingularNoAutoWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList things; @java.lang.SuppressWarnings("all") @@ -21,58 +21,58 @@ class BuilderSingularNoAuto { BuilderSingularNoAutoBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder withThings(final String things) { + public BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final String things) { if (this.things == null) this.things = new java.util.ArrayList(); this.things.add(things); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder withThings(final java.util.Collection things) { + public BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection things) { if (this.things == null) this.things = new java.util.ArrayList(); this.things.addAll(things); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder clearThings() { + public BuilderSingularNoAutoWithSetterPrefixBuilder clearThings() { if (this.things != null) this.things.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder withWidget(final String widget) { + public BuilderSingularNoAutoWithSetterPrefixBuilder withWidget(final String widget) { if (this.widgets == null) this.widgets = new java.util.ArrayList(); this.widgets.add(widget); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder withWidgets(final java.util.Collection widgets) { + public BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection widgets) { if (this.widgets == null) this.widgets = new java.util.ArrayList(); this.widgets.addAll(widgets); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder clearWidgets() { + public BuilderSingularNoAutoWithSetterPrefixBuilder clearWidgets() { if (this.widgets != null) this.widgets.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder withItems(final String items) { + public BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final String items) { if (this.items == null) this.items = new java.util.ArrayList(); this.items.add(items); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder withItems(final java.util.Collection items) { + public BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection items) { if (this.items == null) this.items = new java.util.ArrayList(); this.items.addAll(items); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAutoBuilder clearItems() { + public BuilderSingularNoAutoWithSetterPrefixBuilder clearItems() { if (this.items != null) this.items.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularNoAuto build() { + public BuilderSingularNoAutoWithSetterPrefix build() { java.util.List things; switch (this.things == null ? 0 : this.things.size()) { case 0: @@ -106,16 +106,16 @@ class BuilderSingularNoAuto { default: items = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.items)); } - return new BuilderSingularNoAuto(things, widgets, items); + return new BuilderSingularNoAutoWithSetterPrefix(things, widgets, items); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")"; + return "BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularNoAutoBuilder builder() { - return new BuilderSingularNoAutoBuilder(); + public static BuilderSingularNoAutoWithSetterPrefixBuilder builder() { + return new BuilderSingularNoAutoWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java index 4b1b3d70..b0fe8135 100644 --- a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -1,18 +1,18 @@ import java.util.Set; import java.util.NavigableMap; import java.util.Collection; -class BuilderSingularRedirectToGuava { +class BuilderSingularRedirectToGuavaWithSetterPrefix { private Set dangerMice; private NavigableMap things; private Collection> doohickeys; @java.lang.SuppressWarnings("all") - BuilderSingularRedirectToGuava(final Set dangerMice, final NavigableMap things, final Collection> doohickeys) { + BuilderSingularRedirectToGuavaWithSetterPrefix(final Set dangerMice, final NavigableMap things, final Collection> doohickeys) { this.dangerMice = dangerMice; this.things = things; this.doohickeys = doohickeys; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularRedirectToGuavaBuilder { + public static class BuilderSingularRedirectToGuavaWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private com.google.common.collect.ImmutableSet.Builder dangerMice; @java.lang.SuppressWarnings("all") @@ -20,74 +20,74 @@ class BuilderSingularRedirectToGuava { @java.lang.SuppressWarnings("all") private com.google.common.collect.ImmutableList.Builder> doohickeys; @java.lang.SuppressWarnings("all") - BuilderSingularRedirectToGuavaBuilder() { + BuilderSingularRedirectToGuavaWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder withDangerMouse(final String dangerMouse) { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDangerMouse(final String dangerMouse) { if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); this.dangerMice.add(dangerMouse); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder withDangerMice(final java.lang.Iterable dangerMice) { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDangerMice(final java.lang.Iterable dangerMice) { if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); this.dangerMice.addAll(dangerMice); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder clearDangerMice() { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDangerMice() { this.dangerMice = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder withThing(final Integer key, final Number value) { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withThing(final Integer key, final Number value) { if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); this.things.put(key, value); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder withThings(final java.util.Map things) { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withThings(final java.util.Map things) { if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); this.things.putAll(things); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder clearThings() { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearThings() { this.things = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder withDoohickey(final Class doohickey) { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDoohickey(final Class doohickey) { if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); this.doohickeys.add(doohickey); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder withDoohickeys(final java.lang.Iterable> doohickeys) { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDoohickeys(final java.lang.Iterable> doohickeys) { if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); this.doohickeys.addAll(doohickeys); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuavaBuilder clearDoohickeys() { + public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDoohickeys() { this.doohickeys = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularRedirectToGuava build() { + public BuilderSingularRedirectToGuavaWithSetterPrefix build() { java.util.Set dangerMice = this.dangerMice == null ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build(); java.util.NavigableMap things = this.things == null ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build(); java.util.Collection> doohickeys = this.doohickeys == null ? com.google.common.collect.ImmutableList.>of() : this.doohickeys.build(); - return new BuilderSingularRedirectToGuava(dangerMice, things, doohickeys); + return new BuilderSingularRedirectToGuavaWithSetterPrefix(dangerMice, things, doohickeys); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder(dangerMice=" + this.dangerMice + ", things=" + this.things + ", doohickeys=" + this.doohickeys + ")"; + return "BuilderSingularRedirectToGuavaWithSetterPrefix.BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(dangerMice=" + this.dangerMice + ", things=" + this.things + ", doohickeys=" + this.doohickeys + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularRedirectToGuavaBuilder builder() { - return new BuilderSingularRedirectToGuavaBuilder(); + public static BuilderSingularRedirectToGuavaWithSetterPrefixBuilder builder() { + return new BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java index 83e58e1d..043cf25c 100644 --- a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -1,38 +1,38 @@ -class BuilderSingularToBuilderWithNull { +class BuilderSingularToBuilderWithNullWithSetterPrefix { private java.util.List elems; public static void test() { - new BuilderSingularToBuilderWithNull(null).toBuilder(); + new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder(); } @java.lang.SuppressWarnings("all") - BuilderSingularToBuilderWithNull(final java.util.List elems) { + BuilderSingularToBuilderWithNullWithSetterPrefix(final java.util.List elems) { this.elems = elems; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularToBuilderWithNullBuilder { + public static class BuilderSingularToBuilderWithNullWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList elems; @java.lang.SuppressWarnings("all") - BuilderSingularToBuilderWithNullBuilder() { + BuilderSingularToBuilderWithNullWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularToBuilderWithNullBuilder withElem(final String elem) { + public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElem(final String elem) { if (this.elems == null) this.elems = new java.util.ArrayList(); this.elems.add(elem); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularToBuilderWithNullBuilder withElems(final java.util.Collection elems) { + public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElems(final java.util.Collection elems) { if (this.elems == null) this.elems = new java.util.ArrayList(); this.elems.addAll(elems); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularToBuilderWithNullBuilder clearElems() { + public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder clearElems() { if (this.elems != null) this.elems.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularToBuilderWithNull build() { + public BuilderSingularToBuilderWithNullWithSetterPrefix build() { java.util.List elems; switch (this.elems == null ? 0 : this.elems.size()) { case 0: @@ -44,21 +44,21 @@ class BuilderSingularToBuilderWithNull { default: elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); } - return new BuilderSingularToBuilderWithNull(elems); + return new BuilderSingularToBuilderWithNullWithSetterPrefix(elems); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder(elems=" + this.elems + ")"; + return "BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(elems=" + this.elems + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularToBuilderWithNullBuilder builder() { - return new BuilderSingularToBuilderWithNullBuilder(); + public static BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder() { + return new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); } @java.lang.SuppressWarnings("all") - public BuilderSingularToBuilderWithNullBuilder toBuilder() { - final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder(); + public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() { + final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); if (this.elems != null) builder.elems(this.elems); return builder; } diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index 583d4df0..c061a726 100644 --- a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -1,58 +1,58 @@ import java.util.List; import java.util.Collection; -class BuilderSingularWildcardListsWithToBuilder { +class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { private List objects; private Collection numbers; @java.lang.SuppressWarnings("all") - BuilderSingularWildcardListsWithToBuilder(final List objects, final Collection numbers) { + BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(final List objects, final Collection numbers) { this.objects = objects; this.numbers = numbers; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularWildcardListsWithToBuilderBuilder { + public static class BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList objects; @java.lang.SuppressWarnings("all") private java.util.ArrayList numbers; @java.lang.SuppressWarnings("all") - BuilderSingularWildcardListsWithToBuilderBuilder() { + BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder withObject(final java.lang.Object object) { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObject(final java.lang.Object object) { if (this.objects == null) this.objects = new java.util.ArrayList(); this.objects.add(object); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder withObjects(final java.util.Collection objects) { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObjects(final java.util.Collection objects) { if (this.objects == null) this.objects = new java.util.ArrayList(); this.objects.addAll(objects); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearObjects() { if (this.objects != null) this.objects.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder withNumber(final Number number) { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumber(final Number number) { if (this.numbers == null) this.numbers = new java.util.ArrayList(); this.numbers.add(number); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder withNumbers(final java.util.Collection numbers) { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumbers(final java.util.Collection numbers) { if (this.numbers == null) this.numbers = new java.util.ArrayList(); this.numbers.addAll(numbers); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearNumbers() { if (this.numbers != null) this.numbers.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilder build() { + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefix build() { java.util.List objects; switch (this.objects == null ? 0 : this.objects.size()) { case 0: @@ -75,21 +75,21 @@ class BuilderSingularWildcardListsWithToBuilder { default: numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.numbers)); } - return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(objects, numbers); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects + ", numbers=" + this.numbers + ")"; + return "BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(objects=" + this.objects + ", numbers=" + this.numbers + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularWildcardListsWithToBuilderBuilder builder() { - return new BuilderSingularWildcardListsWithToBuilderBuilder(); + public static BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); } @java.lang.SuppressWarnings("all") - public BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { - final BuilderSingularWildcardListsWithToBuilderBuilder builder = new BuilderSingularWildcardListsWithToBuilderBuilder(); + public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); if (this.objects != null) builder.objects(this.objects); if (this.numbers != null) builder.numbers(this.numbers); return builder; diff --git a/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java index 216cd01f..2f163caf 100644 --- a/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -1,35 +1,35 @@ -class BuilderSingularWithPrefixes { +class BuilderSingularWithPrefixesWithSetterPrefix { private java.util.List _elems; @java.lang.SuppressWarnings("all") - BuilderSingularWithPrefixes(final java.util.List elems) { + BuilderSingularWithPrefixesWithSetterPrefix(final java.util.List elems) { this._elems = elems; } @java.lang.SuppressWarnings("all") - public static class BuilderSingularWithPrefixesBuilder { + public static class BuilderSingularWithPrefixesWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList elems; @java.lang.SuppressWarnings("all") - BuilderSingularWithPrefixesBuilder() { + BuilderSingularWithPrefixesWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderSingularWithPrefixesBuilder withElem(final String elem) { + public BuilderSingularWithPrefixesWithSetterPrefixBuilder withElem(final String elem) { if (this.elems == null) this.elems = new java.util.ArrayList(); this.elems.add(elem); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWithPrefixesBuilder withElems(final java.util.Collection elems) { + public BuilderSingularWithPrefixesWithSetterPrefixBuilder withElems(final java.util.Collection elems) { if (this.elems == null) this.elems = new java.util.ArrayList(); this.elems.addAll(elems); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWithPrefixesBuilder clearElems() { + public BuilderSingularWithPrefixesWithSetterPrefixBuilder clearElems() { if (this.elems != null) this.elems.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderSingularWithPrefixes build() { + public BuilderSingularWithPrefixesWithSetterPrefix build() { java.util.List elems; switch (this.elems == null ? 0 : this.elems.size()) { case 0: @@ -41,16 +41,16 @@ class BuilderSingularWithPrefixes { default: elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); } - return new BuilderSingularWithPrefixes(elems); + return new BuilderSingularWithPrefixesWithSetterPrefix(elems); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder(elems=" + this.elems + ")"; + return "BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderSingularWithPrefixesBuilder builder() { - return new BuilderSingularWithPrefixesBuilder(); + public static BuilderSingularWithPrefixesWithSetterPrefixBuilder builder() { + return new BuilderSingularWithPrefixesWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java index b8bb81b7..0d4f8059 100644 --- a/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java @@ -7,39 +7,39 @@ import java.util.List; @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB { } -class BuilderTypeAnnos { +class BuilderTypeAnnosWithSetterPrefix { @TA @TB private List foo; @java.lang.SuppressWarnings("all") - BuilderTypeAnnos(@TA final List foo) { + BuilderTypeAnnosWithSetterPrefix(@TA final List foo) { this.foo = foo; } @java.lang.SuppressWarnings("all") - public static class BuilderTypeAnnosBuilder { + public static class BuilderTypeAnnosWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private List foo; @java.lang.SuppressWarnings("all") - BuilderTypeAnnosBuilder() { + BuilderTypeAnnosWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderTypeAnnosBuilder withFoo(@TA final List foo) { + public BuilderTypeAnnosWithSetterPrefixBuilder withFoo(@TA final List foo) { this.foo = foo; return this; } @java.lang.SuppressWarnings("all") - public BuilderTypeAnnos build() { - return new BuilderTypeAnnos(foo); + public BuilderTypeAnnosWithSetterPrefix build() { + return new BuilderTypeAnnosWithSetterPrefix(foo); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo + ")"; + return "BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder(foo=" + this.foo + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderTypeAnnosBuilder builder() { - return new BuilderTypeAnnosBuilder(); + public static BuilderTypeAnnosWithSetterPrefixBuilder builder() { + return new BuilderTypeAnnosWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java index e1c107da..87905208 100644 --- a/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java @@ -1,27 +1,27 @@ import java.util.List; -final class BuilderAndValue { +final class BuilderAndValueWithSetterPrefix { private final int zero = 0; @java.lang.SuppressWarnings("all") - BuilderAndValue() { + BuilderAndValueWithSetterPrefix() { } @java.lang.SuppressWarnings("all") - public static class BuilderAndValueBuilder { + public static class BuilderAndValueWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") - BuilderAndValueBuilder() { + BuilderAndValueWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderAndValue build() { - return new BuilderAndValue(); + public BuilderAndValueWithSetterPrefix build() { + return new BuilderAndValueWithSetterPrefix(); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderAndValue.BuilderAndValueBuilder()"; + return "BuilderAndValueWithSetterPrefix.BuilderAndValueWithSetterPrefixBuilder()"; } } @java.lang.SuppressWarnings("all") - public static BuilderAndValueBuilder builder() { - return new BuilderAndValueBuilder(); + public static BuilderAndValueWithSetterPrefixBuilder builder() { + return new BuilderAndValueWithSetterPrefixBuilder(); } @java.lang.SuppressWarnings("all") public int getZero() { @@ -31,8 +31,8 @@ final class BuilderAndValue { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (!(o instanceof BuilderAndValue)) return false; - final BuilderAndValue other = (BuilderAndValue) o; + if (!(o instanceof BuilderAndValueWithSetterPrefix)) return false; + final BuilderAndValueWithSetterPrefix other = (BuilderAndValueWithSetterPrefix) o; if (this.getZero() != other.getZero()) return false; return true; } @@ -47,33 +47,33 @@ final class BuilderAndValue { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderAndValue(zero=" + this.getZero() + ")"; + return "BuilderAndValueWithSetterPrefix(zero=" + this.getZero() + ")"; } } -class BuilderAndData { +class BuilderAndDataWithSetterPrefix { private final int zero = 0; @java.lang.SuppressWarnings("all") - BuilderAndData() { + BuilderAndDataWithSetterPrefix() { } @java.lang.SuppressWarnings("all") - public static class BuilderAndDataBuilder { + public static class BuilderAndDataWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") - BuilderAndDataBuilder() { + BuilderAndDataWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderAndData build() { - return new BuilderAndData(); + public BuilderAndDataWithSetterPrefix build() { + return new BuilderAndDataWithSetterPrefix(); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderAndData.BuilderAndDataBuilder()"; + return "BuilderAndDataWithSetterPrefix.BuilderAndDataWithSetterPrefixBuilder()"; } } @java.lang.SuppressWarnings("all") - public static BuilderAndDataBuilder builder() { - return new BuilderAndDataBuilder(); + public static BuilderAndDataWithSetterPrefixBuilder builder() { + return new BuilderAndDataWithSetterPrefixBuilder(); } @java.lang.SuppressWarnings("all") public int getZero() { @@ -83,15 +83,15 @@ class BuilderAndData { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (!(o instanceof BuilderAndData)) return false; - final BuilderAndData other = (BuilderAndData) o; + if (!(o instanceof BuilderAndDataWithSetterPrefix)) return false; + final BuilderAndDataWithSetterPrefix other = (BuilderAndDataWithSetterPrefix) o; if (!other.canEqual((java.lang.Object) this)) return false; if (this.getZero() != other.getZero()) return false; return true; } @java.lang.SuppressWarnings("all") protected boolean canEqual(final java.lang.Object other) { - return other instanceof BuilderAndData; + return other instanceof BuilderAndDataWithSetterPrefix; } @java.lang.Override @java.lang.SuppressWarnings("all") @@ -104,6 +104,6 @@ class BuilderAndData { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderAndData(zero=" + this.getZero() + ")"; + return "BuilderAndDataWithSetterPrefix(zero=" + this.getZero() + ")"; } } diff --git a/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java index d8e075b8..be581c47 100644 --- a/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java @@ -1,17 +1,17 @@ -class BuilderWithAccessors { +class BuilderWithAccessorsWithSetterPrefix { private final int plower; private final int pUpper; private int _foo; private int __bar; @java.lang.SuppressWarnings("all") - BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + BuilderWithAccessorsWithSetterPrefix(final int plower, final int upper, final int foo, final int _bar) { this.plower = plower; this.pUpper = upper; this._foo = foo; this.__bar = _bar; } @java.lang.SuppressWarnings("all") - public static class BuilderWithAccessorsBuilder { + public static class BuilderWithAccessorsWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private int plower; @java.lang.SuppressWarnings("all") @@ -21,40 +21,40 @@ class BuilderWithAccessors { @java.lang.SuppressWarnings("all") private int _bar; @java.lang.SuppressWarnings("all") - BuilderWithAccessorsBuilder() { + BuilderWithAccessorsWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithAccessorsBuilder withPlower(final int plower) { + public BuilderWithAccessorsWithSetterPrefixBuilder withPlower(final int plower) { this.plower = plower; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithAccessorsBuilder withUpper(final int upper) { + public BuilderWithAccessorsWithSetterPrefixBuilder withUpper(final int upper) { this.upper = upper; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithAccessorsBuilder withFoo(final int foo) { + public BuilderWithAccessorsWithSetterPrefixBuilder withFoo(final int foo) { this.foo = foo; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithAccessorsBuilder with_Bar(final int _bar) { + public BuilderWithAccessorsWithSetterPrefixBuilder with_Bar(final int _bar) { this._bar = _bar; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithAccessors build() { - return new BuilderWithAccessors(plower, upper, foo, _bar); + public BuilderWithAccessorsWithSetterPrefix build() { + return new BuilderWithAccessorsWithSetterPrefix(plower, upper, foo, _bar); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithAccessors.BuilderWithAccessorsBuilder(plower=" + this.plower + ", upper=" + this.upper + ", foo=" + this.foo + ", _bar=" + this._bar + ")"; + return "BuilderWithAccessorsWithSetterPrefix.BuilderWithAccessorsWithSetterPrefixBuilder(plower=" + this.plower + ", upper=" + this.upper + ", foo=" + this.foo + ", _bar=" + this._bar + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderWithAccessorsBuilder builder() { - return new BuilderWithAccessorsBuilder(); + public static BuilderWithAccessorsWithSetterPrefixBuilder builder() { + return new BuilderWithAccessorsWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java index d19bf947..be7a78c7 100644 --- a/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java @@ -1,42 +1,42 @@ -public class BuilderWithBadNames { +public class BuilderWithBadNamesWithSetterPrefix { String build; String toString; @java.lang.SuppressWarnings("all") - BuilderWithBadNames(final String build, final String toString) { + BuilderWithBadNamesWithSetterPrefix(final String build, final String toString) { this.build = build; this.toString = toString; } @java.lang.SuppressWarnings("all") - public static class BuilderWithBadNamesBuilder { + public static class BuilderWithBadNamesWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private String build; @java.lang.SuppressWarnings("all") private String toString; @java.lang.SuppressWarnings("all") - BuilderWithBadNamesBuilder() { + BuilderWithBadNamesWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithBadNamesBuilder withBuild(final String build) { + public BuilderWithBadNamesWithSetterPrefixBuilder withBuild(final String build) { this.build = build; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithBadNamesBuilder withToString(final String toString) { + public BuilderWithBadNamesWithSetterPrefixBuilder withToString(final String toString) { this.toString = toString; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithBadNames build() { - return new BuilderWithBadNames(build, toString); + public BuilderWithBadNamesWithSetterPrefix build() { + return new BuilderWithBadNamesWithSetterPrefix(build, toString); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build + ", toString=" + this.toString + ")"; + return "BuilderWithBadNamesWithSetterPrefix.BuilderWithBadNamesWithSetterPrefixBuilder(build=" + this.build + ", toString=" + this.toString + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderWithBadNamesBuilder builder() { - return new BuilderWithBadNamesBuilder(); + public static BuilderWithBadNamesWithSetterPrefixBuilder builder() { + return new BuilderWithBadNamesWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java index 2045c1a5..5f6f2c32 100644 --- a/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java @@ -1,5 +1,5 @@ import com.google.common.collect.ImmutableList; -public class BuilderWithDeprecated { +public class BuilderWithDeprecatedWithSetterPrefix { /** * @deprecated since always */ @@ -11,14 +11,14 @@ public class BuilderWithDeprecated { @Deprecated ImmutableList numbers; @java.lang.SuppressWarnings("all") - BuilderWithDeprecated(final String dep1, final int dep2, final java.util.List strings, final ImmutableList numbers) { + BuilderWithDeprecatedWithSetterPrefix(final String dep1, final int dep2, final java.util.List strings, final ImmutableList numbers) { this.dep1 = dep1; this.dep2 = dep2; this.strings = strings; this.numbers = numbers; } @java.lang.SuppressWarnings("all") - public static class BuilderWithDeprecatedBuilder { + public static class BuilderWithDeprecatedWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private String dep1; @java.lang.SuppressWarnings("all") @@ -28,65 +28,65 @@ public class BuilderWithDeprecated { @java.lang.SuppressWarnings("all") private com.google.common.collect.ImmutableList.Builder numbers; @java.lang.SuppressWarnings("all") - BuilderWithDeprecatedBuilder() { + BuilderWithDeprecatedWithSetterPrefixBuilder() { } /** * @deprecated since always */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder withDep1(final String dep1) { + public BuilderWithDeprecatedWithSetterPrefixBuilder withDep1(final String dep1) { this.dep1 = dep1; return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder withDep2(final int dep2) { + public BuilderWithDeprecatedWithSetterPrefixBuilder withDep2(final int dep2) { this.dep2 = dep2; return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder withString(final String string) { + public BuilderWithDeprecatedWithSetterPrefixBuilder withString(final String string) { if (this.strings == null) this.strings = new java.util.ArrayList(); this.strings.add(string); return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder withStrings(final java.util.Collection strings) { + public BuilderWithDeprecatedWithSetterPrefixBuilder withStrings(final java.util.Collection strings) { if (this.strings == null) this.strings = new java.util.ArrayList(); this.strings.addAll(strings); return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder clearStrings() { + public BuilderWithDeprecatedWithSetterPrefixBuilder clearStrings() { if (this.strings != null) this.strings.clear(); return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder withNumber(final Integer number) { + public BuilderWithDeprecatedWithSetterPrefixBuilder withNumber(final Integer number) { if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); this.numbers.add(number); return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder withNumbers(final java.lang.Iterable numbers) { + public BuilderWithDeprecatedWithSetterPrefixBuilder withNumbers(final java.lang.Iterable numbers) { if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); this.numbers.addAll(numbers); return this; } @java.lang.Deprecated @java.lang.SuppressWarnings("all") - public BuilderWithDeprecatedBuilder clearNumbers() { + public BuilderWithDeprecatedWithSetterPrefixBuilder clearNumbers() { this.numbers = null; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithDeprecated build() { + public BuilderWithDeprecatedWithSetterPrefix build() { java.util.List strings; switch (this.strings == null ? 0 : this.strings.size()) { case 0: @@ -99,16 +99,16 @@ public class BuilderWithDeprecated { strings = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.strings)); } com.google.common.collect.ImmutableList numbers = this.numbers == null ? com.google.common.collect.ImmutableList.of() : this.numbers.build(); - return new BuilderWithDeprecated(dep1, dep2, strings, numbers); + return new BuilderWithDeprecatedWithSetterPrefix(dep1, dep2, strings, numbers); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithDeprecated.BuilderWithDeprecatedBuilder(dep1=" + this.dep1 + ", dep2=" + this.dep2 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")"; + return "BuilderWithDeprecatedWithSetterPrefix.BuilderWithDeprecatedWithSetterPrefixBuilder(dep1=" + this.dep1 + ", dep2=" + this.dep2 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderWithDeprecatedBuilder builder() { - return new BuilderWithDeprecatedBuilder(); + public static BuilderWithDeprecatedWithSetterPrefixBuilder builder() { + return new BuilderWithDeprecatedWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java index fd9504c2..95f89c9d 100644 --- a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -1,8 +1,8 @@ -class BuilderWithExistingBuilderClass { - public static BuilderWithExistingBuilderClass staticMethod(Z arg1, boolean arg2, String arg3) { +class BuilderWithExistingBuilderClassWithSetterPrefix { + public static BuilderWithExistingBuilderClassWithSetterPrefix staticMethod(Z arg1, boolean arg2, String arg3) { return null; } - public static class BuilderWithExistingBuilderClassBuilder { + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private boolean arg2; @java.lang.SuppressWarnings("all") @@ -11,30 +11,30 @@ class BuilderWithExistingBuilderClass { public void withArg2(boolean arg) { } @java.lang.SuppressWarnings("all") - BuilderWithExistingBuilderClassBuilder() { + BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithExistingBuilderClassBuilder withArg1(final Z arg1) { + public BuilderWithExistingBuilderClassWithSetterPrefixBuilder withArg1(final Z arg1) { this.arg1 = arg1; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithExistingBuilderClassBuilder withArg3(final String arg3) { + public BuilderWithExistingBuilderClassWithSetterPrefixBuilder withArg3(final String arg3) { this.arg3 = arg3; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithExistingBuilderClass build() { - return BuilderWithExistingBuilderClass.staticMethod(arg1, arg2, arg3); + public BuilderWithExistingBuilderClassWithSetterPrefix build() { + return BuilderWithExistingBuilderClassWithSetterPrefix.staticMethod(arg1, arg2, arg3); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1 + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ")"; + return "BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder(arg1=" + this.arg1 + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderWithExistingBuilderClassBuilder builder() { - return new BuilderWithExistingBuilderClassBuilder(); + public static BuilderWithExistingBuilderClassWithSetterPrefixBuilder builder() { + return new BuilderWithExistingBuilderClassWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java index ec0ccb28..0f478ed1 100644 --- a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,33 +1,33 @@ -class BuilderWithNoBuilderMethod { +class BuilderWithNoBuilderMethodWithSetterPrefix { private String a = ""; @java.lang.SuppressWarnings("all") - BuilderWithNoBuilderMethod(final String a) { + BuilderWithNoBuilderMethodWithSetterPrefix(final String a) { this.a = a; } @java.lang.SuppressWarnings("all") - public static class BuilderWithNoBuilderMethodBuilder { + public static class BuilderWithNoBuilderMethodWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private String a; @java.lang.SuppressWarnings("all") - BuilderWithNoBuilderMethodBuilder() { + BuilderWithNoBuilderMethodWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithNoBuilderMethodBuilder withA(final String a) { + public BuilderWithNoBuilderMethodWithSetterPrefixBuilder withA(final String a) { this.a = a; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithNoBuilderMethod build() { - return new BuilderWithNoBuilderMethod(a); + public BuilderWithNoBuilderMethodWithSetterPrefix build() { + return new BuilderWithNoBuilderMethodWithSetterPrefix(a); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a + ")"; + return "BuilderWithNoBuilderMethodWithSetterPrefix.BuilderWithNoBuilderMethodWithSetterPrefixBuilder(a=" + this.a + ")"; } } @java.lang.SuppressWarnings("all") - public BuilderWithNoBuilderMethodBuilder toBuilder() { - return new BuilderWithNoBuilderMethodBuilder().withA(this.a); + public BuilderWithNoBuilderMethodWithSetterPrefixBuilder toBuilder() { + return new BuilderWithNoBuilderMethodWithSetterPrefixBuilder().withA(this.a); } } diff --git a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java index 29f1b792..49be1717 100644 --- a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java @@ -1,22 +1,22 @@ -class BuilderWithNonNull { +class BuilderWithNonNullWithSetterPrefix { @lombok.NonNull private final String id; @java.lang.SuppressWarnings("all") - BuilderWithNonNull(@lombok.NonNull final String id) { + BuilderWithNonNullWithSetterPrefix(@lombok.NonNull final String id) { if (id == null) { throw new java.lang.NullPointerException("id is marked non-null but is null"); } this.id = id; } @java.lang.SuppressWarnings("all") - public static class BuilderWithNonNullBuilder { + public static class BuilderWithNonNullWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private String id; @java.lang.SuppressWarnings("all") - BuilderWithNonNullBuilder() { + BuilderWithNonNullWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithNonNullBuilder withId(@lombok.NonNull final String id) { + public BuilderWithNonNullWithSetterPrefixBuilder withId(@lombok.NonNull final String id) { if (id == null) { throw new java.lang.NullPointerException("id is marked non-null but is null"); } @@ -24,17 +24,17 @@ class BuilderWithNonNull { return this; } @java.lang.SuppressWarnings("all") - public BuilderWithNonNull build() { - return new BuilderWithNonNull(id); + public BuilderWithNonNullWithSetterPrefix build() { + return new BuilderWithNonNullWithSetterPrefix(id); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithNonNull.BuilderWithNonNullBuilder(id=" + this.id + ")"; + return "BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder(id=" + this.id + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderWithNonNullBuilder builder() { - return new BuilderWithNonNullBuilder(); + public static BuilderWithNonNullWithSetterPrefixBuilder builder() { + return new BuilderWithNonNullWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java index d0ca7c05..04494ff9 100644 --- a/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -1,5 +1,5 @@ import java.util.Set; -public class BuilderWithRecursiveGenerics { +public class BuilderWithRecursiveGenericsWithSetterPrefix { interface Inter> { } public static final class Test, Quz extends Inter> { @@ -36,7 +36,7 @@ public class BuilderWithRecursiveGenerics { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo + ", bar=" + this.bar + ")"; + return "BuilderWithRecursiveGenericsWithSetterPrefix.Test.TestBuilder(foo=" + this.foo + ", bar=" + this.bar + ")"; } } @java.lang.SuppressWarnings("all") @@ -55,8 +55,8 @@ public class BuilderWithRecursiveGenerics { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (!(o instanceof BuilderWithRecursiveGenerics.Test)) return false; - final BuilderWithRecursiveGenerics.Test other = (BuilderWithRecursiveGenerics.Test) o; + if (!(o instanceof BuilderWithRecursiveGenericsWithSetterPrefix.Test)) return false; + final BuilderWithRecursiveGenericsWithSetterPrefix.Test other = (BuilderWithRecursiveGenericsWithSetterPrefix.Test) o; final java.lang.Object this$foo = this.getFoo(); final java.lang.Object other$foo = other.getFoo(); if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false; @@ -79,7 +79,7 @@ public class BuilderWithRecursiveGenerics { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo() + ", bar=" + this.getBar() + ")"; + return "BuilderWithRecursiveGenericsWithSetterPrefix.Test(foo=" + this.getFoo() + ", bar=" + this.getBar() + ")"; } } } diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java index ac8264d3..322c667c 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java @@ -1,21 +1,21 @@ import java.util.List; -class BuilderWithToBuilder { +class BuilderWithToBuilderWithSetterPrefix { private String mOne; private String mTwo; private T foo; private List bars; - public static K rrr(BuilderWithToBuilder x) { + public static K rrr(BuilderWithToBuilderWithSetterPrefix x) { return x.foo; } @java.lang.SuppressWarnings("all") - BuilderWithToBuilder(final String one, final String two, final T foo, final List bars) { + BuilderWithToBuilderWithSetterPrefix(final String one, final String two, final T foo, final List bars) { this.mOne = one; this.mTwo = two; this.foo = foo; this.bars = bars; } @java.lang.SuppressWarnings("all") - public static class BuilderWithToBuilderBuilder { + public static class BuilderWithToBuilderWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private String one; @java.lang.SuppressWarnings("all") @@ -25,42 +25,42 @@ class BuilderWithToBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList bars; @java.lang.SuppressWarnings("all") - BuilderWithToBuilderBuilder() { + BuilderWithToBuilderWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder withOne(final String one) { + public BuilderWithToBuilderWithSetterPrefixBuilder withOne(final String one) { this.one = one; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder withTwo(final String two) { + public BuilderWithToBuilderWithSetterPrefixBuilder withTwo(final String two) { this.two = two; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder withFoo(final T foo) { + public BuilderWithToBuilderWithSetterPrefixBuilder withFoo(final T foo) { this.foo = foo; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder withBar(final T bar) { + public BuilderWithToBuilderWithSetterPrefixBuilder withBar(final T bar) { if (this.bars == null) this.bars = new java.util.ArrayList(); this.bars.add(bar); return this; } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder withBars(final java.util.Collection bars) { + public BuilderWithToBuilderWithSetterPrefixBuilder withBars(final java.util.Collection bars) { if (this.bars == null) this.bars = new java.util.ArrayList(); this.bars.addAll(bars); return this; } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder clearBars() { + public BuilderWithToBuilderWithSetterPrefixBuilder clearBars() { if (this.bars != null) this.bars.clear(); return this; } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilder build() { + public BuilderWithToBuilderWithSetterPrefix build() { java.util.List bars; switch (this.bars == null ? 0 : this.bars.size()) { case 0: @@ -72,35 +72,35 @@ class BuilderWithToBuilder { default: bars = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.bars)); } - return new BuilderWithToBuilder(one, two, foo, bars); + return new BuilderWithToBuilderWithSetterPrefix(one, two, foo, bars); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one + ", two=" + this.two + ", foo=" + this.foo + ", bars=" + this.bars + ")"; + return "BuilderWithToBuilderWithSetterPrefix.BuilderWithToBuilderWithSetterPrefixBuilder(one=" + this.one + ", two=" + this.two + ", foo=" + this.foo + ", bars=" + this.bars + ")"; } } @java.lang.SuppressWarnings("all") - public static BuilderWithToBuilderBuilder builder() { - return new BuilderWithToBuilderBuilder(); + public static BuilderWithToBuilderWithSetterPrefixBuilder builder() { + return new BuilderWithToBuilderWithSetterPrefixBuilder(); } @java.lang.SuppressWarnings("all") - public BuilderWithToBuilderBuilder toBuilder() { - final BuilderWithToBuilderBuilder builder = new BuilderWithToBuilderBuilder().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilder.rrr(this)); + public BuilderWithToBuilderWithSetterPrefixBuilder toBuilder() { + final BuilderWithToBuilderWithSetterPrefixBuilder builder = new BuilderWithToBuilderWithSetterPrefixBuilder().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilderWithSetterPrefix.rrr(this)); if (this.bars != null) builder.withBars(this.bars); return builder; } } -class ConstructorWithToBuilder { +class ConstructorWithToBuilderWithSetterPrefix { private String mOne; private String mTwo; private T foo; @lombok.Singular private com.google.common.collect.ImmutableList bars; - public ConstructorWithToBuilder(String mOne, T baz, com.google.common.collect.ImmutableList bars) { + public ConstructorWithToBuilderWithSetterPrefix(String mOne, T baz, com.google.common.collect.ImmutableList bars) { } @java.lang.SuppressWarnings("all") - public static class ConstructorWithToBuilderBuilder { + public static class ConstructorWithToBuilderWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private String mOne; @java.lang.SuppressWarnings("all") @@ -108,39 +108,39 @@ class ConstructorWithToBuilder { @java.lang.SuppressWarnings("all") private com.google.common.collect.ImmutableList bars; @java.lang.SuppressWarnings("all") - ConstructorWithToBuilderBuilder() { + ConstructorWithToBuilderWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public ConstructorWithToBuilderBuilder withMOne(final String mOne) { + public ConstructorWithToBuilderWithSetterPrefixBuilder withMOne(final String mOne) { this.mOne = mOne; return this; } @java.lang.SuppressWarnings("all") - public ConstructorWithToBuilderBuilder withBaz(final T baz) { + public ConstructorWithToBuilderWithSetterPrefixBuilder withBaz(final T baz) { this.baz = baz; return this; } @java.lang.SuppressWarnings("all") - public ConstructorWithToBuilderBuilder withBars(final com.google.common.collect.ImmutableList bars) { + public ConstructorWithToBuilderWithSetterPrefixBuilder withBars(final com.google.common.collect.ImmutableList bars) { this.bars = bars; return this; } @java.lang.SuppressWarnings("all") - public ConstructorWithToBuilder build() { - return new ConstructorWithToBuilder(mOne, baz, bars); + public ConstructorWithToBuilderWithSetterPrefix build() { + return new ConstructorWithToBuilderWithSetterPrefix(mOne, baz, bars); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne + ", baz=" + this.baz + ", bars=" + this.bars + ")"; + return "ConstructorWithToBuilderWithSetterPrefix.ConstructorWithToBuilderWithSetterPrefixBuilder(mOne=" + this.mOne + ", baz=" + this.baz + ", bars=" + this.bars + ")"; } } @java.lang.SuppressWarnings("all") - public static ConstructorWithToBuilderBuilder builder() { - return new ConstructorWithToBuilderBuilder(); + public static ConstructorWithToBuilderWithSetterPrefixBuilder builder() { + return new ConstructorWithToBuilderWithSetterPrefixBuilder(); } @java.lang.SuppressWarnings("all") - public ConstructorWithToBuilderBuilder toBuilder() { - return new ConstructorWithToBuilderBuilder().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); + public ConstructorWithToBuilderWithSetterPrefixBuilder toBuilder() { + return new ConstructorWithToBuilderWithSetterPrefixBuilder().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); } } diff --git a/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java index a3ae2c6d..70394d09 100644 --- a/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java @@ -1,40 +1,40 @@ import lombok.experimental.Tolerate; -public class BuilderWithTolerate { +public class BuilderWithTolerateWithSetterPrefix { private final int value; public static void main(String[] args) { - BuilderWithTolerate.builder().withValue("42").build(); + BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build(); } - public static class BuilderWithTolerateBuilder { + public static class BuilderWithTolerateWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private int value; @Tolerate - public BuilderWithTolerateBuilder withValue(String s) { + public BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) { return this.withValue(Integer.parseInt(s)); } @java.lang.SuppressWarnings("all") - BuilderWithTolerateBuilder() { + BuilderWithTolerateWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") - public BuilderWithTolerateBuilder withValue(final int value) { + public BuilderWithTolerateWithSetterPrefixBuilder withValue(final int value) { this.value = value; return this; } @java.lang.SuppressWarnings("all") - public BuilderWithTolerate build() { - return new BuilderWithTolerate(value); + public BuilderWithTolerateWithSetterPrefix build() { + return new BuilderWithTolerateWithSetterPrefix(value); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value + ")"; + return "BuilderWithTolerateWithSetterPrefix.BuilderWithTolerateWithSetterPrefixBuilder(value=" + this.value + ")"; } } @java.lang.SuppressWarnings("all") - BuilderWithTolerate(final int value) { + BuilderWithTolerateWithSetterPrefix(final int value) { this.value = value; } @java.lang.SuppressWarnings("all") - public static BuilderWithTolerateBuilder builder() { - return new BuilderWithTolerateBuilder(); + public static BuilderWithTolerateWithSetterPrefixBuilder builder() { + return new BuilderWithTolerateWithSetterPrefixBuilder(); } } -- cgit From bae66a3450cf6118d7447a390baf333f862c7d8e Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 19 Sep 2019 13:14:43 -0500 Subject: Fix null pointers and incorrect tests --- src/core/lombok/javac/handlers/JavacSingularsRecipes.java | 7 ++++--- .../resource/after-delombok/BuilderSimpleWithSetterPrefix.java | 2 +- .../resource/after-ecj/BuilderSimpleWithSetterPrefix.java | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'test/transform/resource') 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 typeArgs, String targetFqn, JavacSingularizer singularizer, String setterPrefix) { @@ -293,8 +293,9 @@ public class JavacSingularsRecipes { ListBuffer statements = generateSingularMethodStatements(maker, data, builderType, source); List 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())); diff --git a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java index b10ad619..24ca09d6 100644 --- a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java @@ -10,7 +10,7 @@ class BuilderSimpleWithSetterPrefix { @java.lang.SuppressWarnings("all") private int unprefixed; @java.lang.SuppressWarnings("all") - BuilderSimpelWithSetterPrefixBuilder() { + BuilderSimpleWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") public BuilderSimpleWithSetterPrefixBuilder withUnprefixed(final int unprefixed) { diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java index 98c42fe9..3bc8d882 100644 --- a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -1,6 +1,6 @@ import java.util.List; -@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderWithPrefix { - protected static @java.lang.SuppressWarnings("all") class BuilderWithPrefixBuilder { +@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BulderSimpleWithSetterPrefix { + protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefix { private @java.lang.SuppressWarnings("all") int unprefixed; @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() { super(); @@ -17,11 +17,11 @@ import java.util.List; } } private int unprefixed; - @java.lang.SuppressWarnings("all") BuilderWithPrefix(final int unprefixed) { + @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder(final int unprefixed) { super(); this.unprefixed = unprefixed; } - protected static @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder builder() { - return new BuilderWithPrefixBuilder(); + protected static @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder builder() { + return new BuilderSimpleWithSetterPrefixBuilder(); } } -- cgit From 4b6588ed02830e48adc3d178e5fac66c6b0fe943 Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 19 Sep 2019 13:48:19 -0500 Subject: Fix test copy/paste errors --- .../after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java | 2 +- .../after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java | 2 +- .../resource/after-delombok/BuilderSingularListsWithSetterPrefix.java | 2 +- .../resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java | 4 ++-- .../after-delombok/BuilderSingularNoAutoWithSetterPrefix.java | 2 +- .../BuilderSingularToBuilderWithNullWithSetterPrefix.java | 2 +- .../BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java | 4 ++-- .../after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java | 2 +- .../BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java index c90e3233..6e9c2cee 100644 --- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -119,6 +119,6 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix { } @java.lang.SuppressWarnings("all") public static BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() { - return new BuilderSingularAnnotatedTypesBuilder(); + return new BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java index 792a873e..b349b160 100644 --- a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -31,7 +31,7 @@ class BuilderSingularGuavaListsSetsWithSetterPrefix { @java.lang.SuppressWarnings("all") private com.google.common.collect.ImmutableTable.Builder users; @java.lang.SuppressWarnings("all") - BuilderSingularGuavaListsSetsBuilder() { + BuilderSingularGuavaListsSetsWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder withCard(final T card) { diff --git a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java index 029ecda7..c685a352 100644 --- a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java @@ -20,7 +20,7 @@ class BuilderSingularListsWithSetterPrefix { @java.lang.SuppressWarnings("all") private java.util.ArrayList rawList; @java.lang.SuppressWarnings("all") - BuilderSingularListsBuilder() { + BuilderSingularListsWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") public BuilderSingularListsWithSetterPrefixBuilder withChild(final T child) { diff --git a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java index 361a9f09..352a0723 100644 --- a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java @@ -7,7 +7,7 @@ class BuilderSingularMapsWithSetterPrefix { private Map rawMap; private Map stringMap; @SuppressWarnings("all") - BuilderSingularMaps(Map women, SortedMap men, Map rawMap, Map stringMap) { + BuilderSingularMapsWithSetterPrefix(Map women, SortedMap men, Map rawMap, Map stringMap) { this.women = women; this.men = men; this.rawMap = rawMap; @@ -32,7 +32,7 @@ class BuilderSingularMapsWithSetterPrefix { @SuppressWarnings("all") private java.util.ArrayList stringMap$value; @SuppressWarnings("all") - BuilderSingularMapsBuilder() { + BuilderSingularMapsWithSetterPrefixBuilder() { } @SuppressWarnings("all") public BuilderSingularMapsWithSetterPrefixBuilder withWoman(K womanKey, V womanValue) { diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java index 6a22152b..d2b5ff37 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -18,7 +18,7 @@ class BuilderSingularNoAutoWithSetterPrefix { @java.lang.SuppressWarnings("all") private java.util.ArrayList items; @java.lang.SuppressWarnings("all") - BuilderSingularNoAutoBuilder() { + BuilderSingularNoAutoWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") public BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final String things) { diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java index 043cf25c..5f42d87e 100644 --- a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -59,7 +59,7 @@ class BuilderSingularToBuilderWithNullWithSetterPrefix { @java.lang.SuppressWarnings("all") public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() { final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); - if (this.elems != null) builder.elems(this.elems); + if (this.elems != null) builder.withElems(this.elems); return builder; } } diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index c061a726..367f0ac1 100644 --- a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -90,8 +90,8 @@ class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { @java.lang.SuppressWarnings("all") public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() { final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); - if (this.objects != null) builder.objects(this.objects); - if (this.numbers != null) builder.numbers(this.numbers); + if (this.objects != null) builder.withObjects(this.objects); + if (this.numbers != null) builder.withNumbers(this.numbers); return builder; } } diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java index 03f8adf9..8728867d 100644 --- a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -54,7 +54,7 @@ import lombok.Singular; public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() { final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); if ((this.elems != null)) - builder.elems(this.elems); + builder.withElems(this.elems); return builder; } } diff --git a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index 358e6910..fe451d78 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -84,9 +84,9 @@ import lombok.Singular; public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() { final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); if ((this.objects != null)) - builder.objects(this.objects); + builder.withObjects(this.objects); if ((this.numbers != null)) - builder.numbers(this.numbers); + builder.withNumbers(this.numbers); return builder; } } -- cgit From 24a49a9d2bc9ae6776eabcbeb8ce6bbe4ad5ebcf Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 19 Sep 2019 15:16:02 -0500 Subject: Fix more copy/paste test errors --- .../javac/handlers/JavacSingularsRecipes.java | 7 +- .../BuilderSingularGuavaMapsWithSetterPrefix.java | 94 +++++++++++++ .../BuilderSingularSetsWithPrefix.java | 153 --------------------- .../BuilderSingularSetsWithSetterPrefix.java | 153 +++++++++++++++++++++ .../after-ecj/BuilderSimpleWithSetterPrefix.java | 2 +- .../before/BuilderSingularGuavaMapsWithPrefix.java | 12 -- .../BuilderSingularGuavaMapsWithSetterPrefix.java | 12 ++ ...rSingularToBuilderWithNullWithSetterPrefix.java | 2 +- ...derSingularNoAutoWithSetterPrefix.java.messages | 2 + 9 files changed, 267 insertions(+), 170 deletions(-) create mode 100644 test/transform/resource/after-delombok/BuilderSingularGuavaMapsWithSetterPrefix.java delete mode 100644 test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java create mode 100644 test/transform/resource/after-delombok/BuilderSingularSetsWithSetterPrefix.java delete mode 100644 test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java create mode 100644 test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java create mode 100644 test/transform/resource/messages-delombok/BuilderSingularNoAutoWithSetterPrefix.java.messages (limited to 'test/transform/resource') diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index 56116346..10e6f9b4 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -326,9 +326,10 @@ public class JavacSingularsRecipes { private void generatePluralMethod(CheckerFrameworkVersion cfv, boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent, AccessLevel access) { ListBuffer statements = generatePluralMethodStatements(maker, data, builderType, source); Name name = data.getPluralName(); - Name prefixedSingularName = builderType.toName(data.getSetterPrefix()); - name = fluent ? prefixedSingularName : builderType.toName(HandlerUtil.buildAccessorName( - getAddMethodName() + "All", name.toString())); + + Name prefixedSingularName = data.getSetterPrefix().isEmpty() ? name : builderType.toName(HandlerUtil.buildAccessorName(data.getSetterPrefix(), data.getPluralName().toString())); + name = fluent ? prefixedSingularName + : builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName() + "All", name.toString())); JCExpression paramType = getPluralMethodParamType(builderType); paramType = addTypeArgs(getTypeArgumentsCount(), true, builderType, paramType, data.getTypeArgs(), source); long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext()); diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularGuavaMapsWithSetterPrefix.java new file mode 100644 index 00000000..b3162854 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaMapsWithSetterPrefix.java @@ -0,0 +1,94 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; +class BuilderSingularGuavaMapsWithSetterPrefix { + private ImmutableMap battleaxes; + private ImmutableSortedMap vertices; + @SuppressWarnings("all") + private ImmutableBiMap rawMap; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaMapsWithSetterPrefix(final ImmutableMap battleaxes, final ImmutableSortedMap vertices, final ImmutableBiMap rawMap) { + this.battleaxes = battleaxes; + this.vertices = vertices; + this.rawMap = rawMap; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularGuavaMapsWithSetterPrefixBuilder { + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableMap.Builder battleaxes; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSortedMap.Builder vertices; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableBiMap.Builder rawMap; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaMapsWithSetterPrefixBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder withBattleaxe(final K key, final V value) { + if (this.battleaxes == null) this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.put(key, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder withBattleaxes(final java.util.Map battleaxes) { + if (this.battleaxes == null) this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.putAll(battleaxes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder clearBattleaxes() { + this.battleaxes = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder withVertex(final Integer key, final V value) { + if (this.vertices == null) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.put(key, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder withVertices(final java.util.Map vertices) { + if (this.vertices == null) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.putAll(vertices); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder clearVertices() { + this.vertices = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder withRawMap(final java.lang.Object key, final java.lang.Object value) { + if (this.rawMap == null) this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.put(key, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder withRawMap(final java.util.Map rawMap) { + if (this.rawMap == null) this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.putAll(rawMap); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefixBuilder clearRawMap() { + this.rawMap = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsWithSetterPrefix build() { + com.google.common.collect.ImmutableMap battleaxes = this.battleaxes == null ? com.google.common.collect.ImmutableMap.of() : this.battleaxes.build(); + com.google.common.collect.ImmutableSortedMap vertices = this.vertices == null ? com.google.common.collect.ImmutableSortedMap.of() : this.vertices.build(); + com.google.common.collect.ImmutableBiMap rawMap = this.rawMap == null ? com.google.common.collect.ImmutableBiMap.of() : this.rawMap.build(); + return new BuilderSingularGuavaMapsWithSetterPrefix(battleaxes, vertices, rawMap); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularGuavaMapsWithSetterPrefix.BuilderSingularGuavaMapsWithSetterPrefixBuilder(battleaxes=" + this.battleaxes + ", vertices=" + this.vertices + ", rawMap=" + this.rawMap + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularGuavaMapsWithSetterPrefixBuilder builder() { + return new BuilderSingularGuavaMapsWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java b/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java deleted file mode 100644 index e3817b59..00000000 --- a/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java +++ /dev/null @@ -1,153 +0,0 @@ -import java.util.Set; -import java.util.SortedSet; -class BuilderSingularSets { - private Set dangerMice; - private SortedSet octopodes; - @SuppressWarnings("all") - private Set rawSet; - private Set stringSet; - @java.lang.SuppressWarnings("all") - BuilderSingularSets(final Set dangerMice, final SortedSet octopodes, final Set rawSet, final Set stringSet) { - this.dangerMice = dangerMice; - this.octopodes = octopodes; - this.rawSet = rawSet; - this.stringSet = stringSet; - } - @java.lang.SuppressWarnings("all") - public static class BuilderSingularSetsBuilder { - @java.lang.SuppressWarnings("all") - private java.util.ArrayList dangerMice; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList octopodes; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList rawSet; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList stringSet; - @java.lang.SuppressWarnings("all") - BuilderSingularSetsBuilder() { - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withDangerMouse(final T dangerMouse) { - if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList(); - this.dangerMice.add(dangerMouse); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withDangerMice(final java.util.Collection dangerMice) { - if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList(); - this.dangerMice.addAll(dangerMice); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder clearDangerMice() { - if (this.dangerMice != null) this.dangerMice.clear(); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withOctopus(final Number octopus) { - if (this.octopodes == null) this.octopodes = new java.util.ArrayList(); - this.octopodes.add(octopus); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withOctopodes(final java.util.Collection octopodes) { - if (this.octopodes == null) this.octopodes = new java.util.ArrayList(); - this.octopodes.addAll(octopodes); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder clearOctopodes() { - if (this.octopodes != null) this.octopodes.clear(); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withRawSet(final java.lang.Object rawSet) { - if (this.rawSet == null) this.rawSet = new java.util.ArrayList(); - this.rawSet.add(rawSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withRawSet(final java.util.Collection rawSet) { - if (this.rawSet == null) this.rawSet = new java.util.ArrayList(); - this.rawSet.addAll(rawSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder clearRawSet() { - if (this.rawSet != null) this.rawSet.clear(); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withStringSet(final String stringSet) { - if (this.stringSet == null) this.stringSet = new java.util.ArrayList(); - this.stringSet.add(stringSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder withStringSet(final java.util.Collection stringSet) { - if (this.stringSet == null) this.stringSet = new java.util.ArrayList(); - this.stringSet.addAll(stringSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSetsBuilder clearStringSet() { - if (this.stringSet != null) this.stringSet.clear(); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingularSets build() { - java.util.Set dangerMice; - switch (this.dangerMice == null ? 0 : this.dangerMice.size()) { - case 0: - dangerMice = java.util.Collections.emptySet(); - break; - case 1: - dangerMice = java.util.Collections.singleton(this.dangerMice.get(0)); - break; - default: - dangerMice = new java.util.LinkedHashSet(this.dangerMice.size() < 1073741824 ? 1 + this.dangerMice.size() + (this.dangerMice.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); - dangerMice.addAll(this.dangerMice); - dangerMice = java.util.Collections.unmodifiableSet(dangerMice); - } - java.util.SortedSet octopodes = new java.util.TreeSet(); - if (this.octopodes != null) octopodes.addAll(this.octopodes); - octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); - java.util.Set rawSet; - switch (this.rawSet == null ? 0 : this.rawSet.size()) { - case 0: - rawSet = java.util.Collections.emptySet(); - break; - case 1: - rawSet = java.util.Collections.singleton(this.rawSet.get(0)); - break; - default: - rawSet = new java.util.LinkedHashSet(this.rawSet.size() < 1073741824 ? 1 + this.rawSet.size() + (this.rawSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); - rawSet.addAll(this.rawSet); - rawSet = java.util.Collections.unmodifiableSet(rawSet); - } - java.util.Set stringSet; - switch (this.stringSet == null ? 0 : this.stringSet.size()) { - case 0: - stringSet = java.util.Collections.emptySet(); - break; - case 1: - stringSet = java.util.Collections.singleton(this.stringSet.get(0)); - break; - default: - stringSet = new java.util.LinkedHashSet(this.stringSet.size() < 1073741824 ? 1 + this.stringSet.size() + (this.stringSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); - stringSet.addAll(this.stringSet); - stringSet = java.util.Collections.unmodifiableSet(stringSet); - } - return new BuilderSingularSets(dangerMice, octopodes, rawSet, stringSet); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")"; - } - } - @java.lang.SuppressWarnings("all") - public static BuilderSingularSetsBuilder builder() { - return new BuilderSingularSetsBuilder(); - } -} diff --git a/test/transform/resource/after-delombok/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..9702b850 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularSetsWithSetterPrefix.java @@ -0,0 +1,153 @@ +import java.util.Set; +import java.util.SortedSet; +class BuilderSingularSetsWithSetterPrefix { + private Set dangerMice; + private SortedSet octopodes; + @SuppressWarnings("all") + private Set rawSet; + private Set stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSetsWithSetterPrefix(final Set dangerMice, final SortedSet octopodes, final Set rawSet, final Set stringSet) { + this.dangerMice = dangerMice; + this.octopodes = octopodes; + this.rawSet = rawSet; + this.stringSet = stringSet; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularSetsWithSetterPrefixBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList dangerMice; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList octopodes; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList rawSet; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSetsWithSetterPrefixBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withDangerMouse(final T dangerMouse) { + if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList(); + this.dangerMice.add(dangerMouse); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withDangerMice(final java.util.Collection dangerMice) { + if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList(); + this.dangerMice.addAll(dangerMice); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder clearDangerMice() { + if (this.dangerMice != null) this.dangerMice.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withOctopus(final Number octopus) { + if (this.octopodes == null) this.octopodes = new java.util.ArrayList(); + this.octopodes.add(octopus); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withOctopodes(final java.util.Collection octopodes) { + if (this.octopodes == null) this.octopodes = new java.util.ArrayList(); + this.octopodes.addAll(octopodes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder clearOctopodes() { + if (this.octopodes != null) this.octopodes.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withRawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = new java.util.ArrayList(); + this.rawSet.add(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withRawSet(final java.util.Collection rawSet) { + if (this.rawSet == null) this.rawSet = new java.util.ArrayList(); + this.rawSet.addAll(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder clearRawSet() { + if (this.rawSet != null) this.rawSet.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withStringSet(final String stringSet) { + if (this.stringSet == null) this.stringSet = new java.util.ArrayList(); + this.stringSet.add(stringSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder withStringSet(final java.util.Collection stringSet) { + if (this.stringSet == null) this.stringSet = new java.util.ArrayList(); + this.stringSet.addAll(stringSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefixBuilder clearStringSet() { + if (this.stringSet != null) this.stringSet.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsWithSetterPrefix build() { + java.util.Set dangerMice; + switch (this.dangerMice == null ? 0 : this.dangerMice.size()) { + case 0: + dangerMice = java.util.Collections.emptySet(); + break; + case 1: + dangerMice = java.util.Collections.singleton(this.dangerMice.get(0)); + break; + default: + dangerMice = new java.util.LinkedHashSet(this.dangerMice.size() < 1073741824 ? 1 + this.dangerMice.size() + (this.dangerMice.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + dangerMice.addAll(this.dangerMice); + dangerMice = java.util.Collections.unmodifiableSet(dangerMice); + } + java.util.SortedSet octopodes = new java.util.TreeSet(); + if (this.octopodes != null) octopodes.addAll(this.octopodes); + octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); + java.util.Set rawSet; + switch (this.rawSet == null ? 0 : this.rawSet.size()) { + case 0: + rawSet = java.util.Collections.emptySet(); + break; + case 1: + rawSet = java.util.Collections.singleton(this.rawSet.get(0)); + break; + default: + rawSet = new java.util.LinkedHashSet(this.rawSet.size() < 1073741824 ? 1 + this.rawSet.size() + (this.rawSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + rawSet.addAll(this.rawSet); + rawSet = java.util.Collections.unmodifiableSet(rawSet); + } + java.util.Set stringSet; + switch (this.stringSet == null ? 0 : this.stringSet.size()) { + case 0: + stringSet = java.util.Collections.emptySet(); + break; + case 1: + stringSet = java.util.Collections.singleton(this.stringSet.get(0)); + break; + default: + stringSet = new java.util.LinkedHashSet(this.stringSet.size() < 1073741824 ? 1 + this.stringSet.size() + (this.stringSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + stringSet.addAll(this.stringSet); + stringSet = java.util.Collections.unmodifiableSet(stringSet); + } + return new BuilderSingularSetsWithSetterPrefix(dangerMice, octopodes, rawSet, stringSet); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularSetsWithSetterPrefixBuilder builder() { + return new BuilderSingularSetsWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java index 3bc8d882..ad3485c6 100644 --- a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -1,5 +1,5 @@ import java.util.List; -@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BulderSimpleWithSetterPrefix { +@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderSimpleWithSetterPrefix { protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefix { private @java.lang.SuppressWarnings("all") int unprefixed; @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() { diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java deleted file mode 100644 index a2b48cb3..00000000 --- a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java +++ /dev/null @@ -1,12 +0,0 @@ -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableSortedMap; - -import lombok.Singular; - -@lombok.Builder(setterPrefix = "with") -class BuilderSingularGuavaMapsWithSetterPrefix { - @Singular private ImmutableMap battleaxes; - @Singular private ImmutableSortedMap vertices; - @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap; -} diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java new file mode 100644 index 00000000..a2b48cb3 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java @@ -0,0 +1,12 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularGuavaMapsWithSetterPrefix { + @Singular private ImmutableMap battleaxes; + @Singular private ImmutableSortedMap vertices; + @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap; +} diff --git a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java index 845b38df..454cac97 100644 --- a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -5,6 +5,6 @@ class BuilderSingularToBuilderWithNullWithSetterPrefix { @Singular private java.util.List elems; public static void test() { - new BuilderSingularToBuilderWithNull(null).toBuilder(); + new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder(); } } diff --git a/test/transform/resource/messages-delombok/BuilderSingularNoAutoWithSetterPrefix.java.messages b/test/transform/resource/messages-delombok/BuilderSingularNoAutoWithSetterPrefix.java.messages new file mode 100644 index 00000000..8719789b --- /dev/null +++ b/test/transform/resource/messages-delombok/BuilderSingularNoAutoWithSetterPrefix.java.messages @@ -0,0 +1,2 @@ +8 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. +10 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. -- cgit From ffb299730e8f378748c4594988ec568812bf895b Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Thu, 19 Sep 2019 16:05:17 -0500 Subject: Fix more broken tests --- .../BuilderSingularMapsWithSetterPrefix.java | 6 +++--- ...ularWildcardListsWithToBuilderWithSetterPrefix.java | 1 + .../BuilderWithAccessorsWithSetterPrefix.java | 2 +- ...uilderWithExistingBuilderClassWithSetterPrefix.java | 4 ++-- .../BuilderWithNoBuilderMethodWithSetterPrefix.java | 1 + .../BuilderWithToBuilderWithSetterPrefix.java | 1 + .../after-ecj/BuilderSimpleWithSetterPrefix.java | 4 ++-- ...ilderSingularToBuilderWithNullWithSetterPrefix.java | 2 +- ...ularWildcardListsWithToBuilderWithSetterPrefix.java | 2 +- .../BuilderSingularWithPrefixesWithSetterPrefix.java | 18 +++++++++--------- .../after-ecj/BuilderValueDataWithSetterPrefix.java | 2 +- .../BuilderWithAccessorsWithSetterPrefix.java | 2 +- ...uilderWithExistingBuilderClassWithSetterPrefix.java | 2 +- ...uilderWithExistingBuilderClassWithSetterPrefix.java | 2 +- .../BuilderWithNoBuilderMethodWithSetterPrefix.java | 4 ++-- ...BuilderSingularNoAutoWithSetterPrefix.java.messages | 2 ++ 16 files changed, 30 insertions(+), 25 deletions(-) create mode 100644 test/transform/resource/messages-ecj/BuilderSingularNoAutoWithSetterPrefix.java.messages (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java index 352a0723..a4afb8a8 100644 --- a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java @@ -95,7 +95,7 @@ class BuilderSingularMapsWithSetterPrefix { return this; } @SuppressWarnings("all") - public BuilderSingularMapsWithSetterPrefixBuilder withRawMan(Object rawMapKey, Object rawMapValue) { + public BuilderSingularMapsWithSetterPrefixBuilder withRawMap(Object rawMapKey, Object rawMapValue) { if (this.rawMap$key == null) { this.rawMap$key = new java.util.ArrayList(); this.rawMap$value = new java.util.ArrayList(); @@ -125,7 +125,7 @@ class BuilderSingularMapsWithSetterPrefix { return this; } @SuppressWarnings("all") - public BuilderSingularMapsWithSetterPrefixBuilder stringMap(String stringMapKey, V stringMapValue) { + public BuilderSingularMapsWithSetterPrefixBuilder withStringMap(String stringMapKey, V stringMapValue) { if (this.stringMap$key == null) { this.stringMap$key = new java.util.ArrayList(); this.stringMap$value = new java.util.ArrayList(); @@ -135,7 +135,7 @@ class BuilderSingularMapsWithSetterPrefix { return this; } @SuppressWarnings("all") - public BuilderSingularMapsWithSetterPrefixBuilder stringMap(java.util.Map stringMap) { + public BuilderSingularMapsWithSetterPrefixBuilder withStringMap(java.util.Map stringMap) { if (this.stringMap$key == null) { this.stringMap$key = new java.util.ArrayList(); this.stringMap$value = new java.util.ArrayList(); diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index 367f0ac1..8e849f44 100644 --- a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -1,5 +1,6 @@ import java.util.List; import java.util.Collection; +@Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { private List objects; private Collection numbers; diff --git a/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java index be581c47..45a79fdc 100644 --- a/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java @@ -39,7 +39,7 @@ class BuilderWithAccessorsWithSetterPrefix { return this; } @java.lang.SuppressWarnings("all") - public BuilderWithAccessorsWithSetterPrefixBuilder with_Bar(final int _bar) { + public BuilderWithAccessorsWithSetterPrefixBuilder with_bar(final int _bar) { this._bar = _bar; return this; } diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java index 95f89c9d..9b7b0c95 100644 --- a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -2,7 +2,7 @@ class BuilderWithExistingBuilderClassWithSetterPrefix { public static BuilderWithExistingBuilderClassWithSetterPrefix staticMethod(Z arg1, boolean arg2, String arg3) { return null; } - public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { + public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private boolean arg2; @java.lang.SuppressWarnings("all") @@ -11,7 +11,7 @@ class BuilderWithExistingBuilderClassWithSetterPrefix { public void withArg2(boolean arg) { } @java.lang.SuppressWarnings("all") - BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { + BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") public BuilderWithExistingBuilderClassWithSetterPrefixBuilder withArg1(final Z arg1) { diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java index 0f478ed1..2381dcbe 100644 --- a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,3 +1,4 @@ +import lombok.Builder class BuilderWithNoBuilderMethodWithSetterPrefix { private String a = ""; @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java index 322c667c..091aed4d 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java @@ -1,4 +1,5 @@ import java.util.List; +import lombok.Builder; class BuilderWithToBuilderWithSetterPrefix { private String mOne; private String mTwo; diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java index ad3485c6..110774e2 100644 --- a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -1,8 +1,8 @@ import java.util.List; @lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderSimpleWithSetterPrefix { - protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefix { + protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") int unprefixed; - @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() { + @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder() { super(); } public @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java index 8728867d..ef2d02a1 100644 --- a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -1,5 +1,5 @@ import lombok.Singular; -@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularToBuilderWithNullWithSetterPrefix { +@lombok.Builder(toBuilder = true,setterPrefix = "with") class BuilderSingularToBuilderWithNullWithSetterPrefix { public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList elems; @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder() { diff --git a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index fe451d78..bbb10087 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -1,7 +1,7 @@ import java.util.List; import java.util.Collection; import lombok.Singular; -@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { +@lombok.Builder(toBuilder = true,setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList objects; private @java.lang.SuppressWarnings("all") java.util.ArrayList numbers; diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java index 88f64f34..920803cc 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -1,23 +1,23 @@ import lombok.Singular; -@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") class BuilderSingularWithPrefixesWithSetterPrefixes { - public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesWithSetterPrefixesBuilder { +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") class BuilderSingularWithPrefixesWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") java.util.ArrayList elems; - @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder() { + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder withElem(final String elem) { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder withElem(final String elem) { if ((this.elems == null)) this.elems = new java.util.ArrayList(); this.elems.add(elem); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder withElems(final java.util.Collection elems) { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder withElems(final java.util.Collection elems) { if ((this.elems == null)) this.elems = new java.util.ArrayList(); this.elems.addAll(elems); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder clearElems() { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder clearElems() { if ((this.elems != null)) this.elems.clear(); return this; @@ -37,7 +37,7 @@ import lombok.Singular; return new BuilderSingularWithPrefixesWithSetterPrefixes(elems); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderSingularWithPrefixesWithSetterPrefixes.BuilderSingularWithPrefixesWithSetterPrefixesBuilder(elems=" + this.elems) + ")"); + return (("BuilderSingularWithPrefixesWithSetterPrefixes.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems) + ")"); } } private @Singular java.util.List _elems; @@ -45,7 +45,7 @@ import lombok.Singular; super(); this._elems = elems; } - public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixesBuilder builder() { - return new BuilderSingularWithPrefixesWithSetterPrefixesBuilder(); + public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder builder() { + return new BuilderSingularWithPrefixesWithSetterPrefixBuilder(); } } diff --git a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java index 679591a4..065c93fe 100644 --- a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java @@ -41,7 +41,7 @@ final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue return (("BuilderAndValueWithSetterPrefix(zero=" + this.getZero()) + ")"); } } -@lombok.Builder @lombok.Data class BuilderAndDataWithSetterPrefix { +@lombok.Builder(setterPrefix = "with") @lombok.Data class BuilderAndDataWithSetterPrefix { public static @java.lang.SuppressWarnings("all") class BuilderAndDataWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder() { super(); diff --git a/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java index 5894a4a2..d9c10e5b 100644 --- a/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java @@ -19,7 +19,7 @@ this.foo = foo; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder with_Bar(final int _bar) { + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder with_bar(final int _bar) { this._bar = _bar; return this; } diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java index 8da2f012..b14c120f 100644 --- a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -1,6 +1,6 @@ import lombok.Builder; class BuilderWithExistingBuilderClassWithSetterPrefix { - public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { + public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") boolean arg2; private @java.lang.SuppressWarnings("all") String arg3; private Z arg1; diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java index cb699295..99c3ccc6 100644 --- a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -6,7 +6,7 @@ class BuilderWithExistingBuilderClassWithSetterPrefix { return null; } - public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefix { + public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder { private Z arg1; public void withArg2(boolean arg) { diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java index b787e303..6fddd748 100644 --- a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,5 +1,5 @@ -import lombok.Builder(setterPrefix = "with"); -@Builder(toBuilder = true, builderMethodName = "", setterPrefix = "with") +import lombok.Builder +@Builder(toBuilder = true, builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethodWithSetterPrefix { private String a = ""; } diff --git a/test/transform/resource/messages-ecj/BuilderSingularNoAutoWithSetterPrefix.java.messages b/test/transform/resource/messages-ecj/BuilderSingularNoAutoWithSetterPrefix.java.messages new file mode 100644 index 00000000..8719789b --- /dev/null +++ b/test/transform/resource/messages-ecj/BuilderSingularNoAutoWithSetterPrefix.java.messages @@ -0,0 +1,2 @@ +8 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. +10 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. -- cgit From 666defaff365d9841d5136063fc6f9e6ee5c0403 Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Fri, 25 Oct 2019 15:38:07 -0500 Subject: Fix up some more tests and copy-paste errors --- .../lombok/eclipse/handlers/HandleBuilder.java | 15 ++++++++--- ...WildcardListsWithToBuilderWithSetterPrefix.java | 1 - ...erWithExistingBuilderClassWithSetterPrefix.java | 4 +-- ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 1 - .../BuilderWithToBuilderWithSetterPrefix.java | 1 - .../after-ecj/BuilderSimpleWithSetterPrefix.java | 10 ++++---- .../BuilderSingularSetsWithSetterPrefix.java | 16 ++++++------ ...uilderSingularWithPrefixesWithSetterPrefix.java | 8 +++--- ...erWithExistingBuilderClassWithSetterPrefix.java | 2 +- ...ilderWithRecursiveGenericsWithSetterPrefix.java | 2 +- .../BuilderWithToBuilderWithSetterPrefix.java | 29 +++++++++++----------- ...BuilderWithNoBuilderMethodWithSetterPrefix.java | 2 +- .../BuilderWithToBuilderWithSetterPrefix.java | 4 +-- .../BuilderWithTolerateWithSetterPrefix.java | 2 +- 14 files changed, 51 insertions(+), 46 deletions(-) (limited to 'test/transform/resource') diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index ec2be523..017cde17 100755 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -539,7 +539,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { tps[i].name = typeArgsForToBuilder.get(i); } } - MethodDeclaration md = generateToBuilderMethod(cfv, toBuilderMethodName, builderClassName, tdParent, tps, builderFields, fluent, ast, accessForOuters); + MethodDeclaration md = generateToBuilderMethod(cfv, toBuilderMethodName, builderClassName, tdParent, tps, builderFields, fluent, ast, accessForOuters, builderInstance.setterPrefix()); if (md != null) injectMethod(tdParent, md); } @@ -552,7 +552,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } private static final char[] BUILDER_TEMP_VAR = {'b', 'u', 'i', 'l', 'd', 'e', 'r'}; - private MethodDeclaration generateToBuilderMethod(CheckerFrameworkVersion cfv, String methodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, List builderFields, boolean fluent, ASTNode source, AccessLevel access) { + private MethodDeclaration generateToBuilderMethod(CheckerFrameworkVersion cfv, String methodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, List builderFields, boolean fluent, ASTNode source, AccessLevel access, String prefix) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long) pS << 32 | pE; @@ -567,7 +567,14 @@ public class HandleBuilder extends EclipseAnnotationHandler { Expression receiver = invoke; List statements = null; for (BuilderFieldData bfd : builderFields) { - char[] setterName = fluent ? bfd.name : HandlerUtil.buildAccessorName("set", new String(bfd.name)).toCharArray(); + String setterPrefix = prefix.isEmpty() ? "set" : prefix; + //char[] setterName = fluent ? bfd.name : HandlerUtil.buildAccessorName("set", new String(bfd.name)).toCharArray(); + String setterName; + if(fluent) { + setterName = prefix.isEmpty() ? new String(bfd.name) : HandlerUtil.buildAccessorName(setterPrefix, new String(bfd.name)); + } else { + setterName = HandlerUtil.buildAccessorName(setterPrefix, new String(bfd.name)); + } MessageSend ms = new MessageSend(); Expression[] tgt = new Expression[bfd.singularData == null ? 1 : 2]; @@ -600,7 +607,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } - ms.selector = setterName; + ms.selector = setterName.toCharArray(); if (bfd.singularData == null) { ms.arguments = tgt; ms.receiver = receiver; diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java index 8e849f44..367f0ac1 100644 --- a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -1,6 +1,5 @@ import java.util.List; import java.util.Collection; -@Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { private List objects; private Collection numbers; diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java index 9b7b0c95..95f89c9d 100644 --- a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -2,7 +2,7 @@ class BuilderWithExistingBuilderClassWithSetterPrefix { public static BuilderWithExistingBuilderClassWithSetterPrefix staticMethod(Z arg1, boolean arg2, String arg3) { return null; } - public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder { + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { @java.lang.SuppressWarnings("all") private boolean arg2; @java.lang.SuppressWarnings("all") @@ -11,7 +11,7 @@ class BuilderWithExistingBuilderClassWithSetterPrefix { public void withArg2(boolean arg) { } @java.lang.SuppressWarnings("all") - BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder() { + BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { } @java.lang.SuppressWarnings("all") public BuilderWithExistingBuilderClassWithSetterPrefixBuilder withArg1(final Z arg1) { diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java index 2381dcbe..0f478ed1 100644 --- a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,4 +1,3 @@ -import lombok.Builder class BuilderWithNoBuilderMethodWithSetterPrefix { private String a = ""; @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java index 091aed4d..322c667c 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java @@ -1,5 +1,4 @@ import java.util.List; -import lombok.Builder; class BuilderWithToBuilderWithSetterPrefix { private String mOne; private String mTwo; diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java index 110774e2..993c66da 100644 --- a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -5,19 +5,19 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder withUnprefixed(final int unprefixed) { + public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder withUnprefixed(final int unprefixed) { this.unprefixed = unprefixed; return this; } - public @java.lang.SuppressWarnings("all") BuilderWithPrefix build() { - return new BuilderWithPrefix(unprefixed); + public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix build() { + return new BuilderSimpleWithSetterPrefix(unprefixed); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderWithPrefix.BuilderWithPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); + return (("BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); } } private int unprefixed; - @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder(final int unprefixed) { + @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix(final int unprefixed) { super(); this.unprefixed = unprefixed; } diff --git a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java index cb5041a7..905e9190 100644 --- a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java @@ -10,13 +10,13 @@ import lombok.Singular; @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder dangerMouse(final T dangerMouse) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withDangerMouse(final T dangerMouse) { if ((this.dangerMice == null)) this.dangerMice = new java.util.ArrayList(); this.dangerMice.add(dangerMouse); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder dangerMice(final java.util.Collection dangerMice) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withDangerMice(final java.util.Collection dangerMice) { if ((this.dangerMice == null)) this.dangerMice = new java.util.ArrayList(); this.dangerMice.addAll(dangerMice); @@ -27,13 +27,13 @@ import lombok.Singular; this.dangerMice.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder octopus(final Number octopus) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withOctopus(final Number octopus) { if ((this.octopodes == null)) this.octopodes = new java.util.ArrayList(); this.octopodes.add(octopus); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder octopodes(final java.util.Collection octopodes) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withOctopodes(final java.util.Collection octopodes) { if ((this.octopodes == null)) this.octopodes = new java.util.ArrayList(); this.octopodes.addAll(octopodes); @@ -44,13 +44,13 @@ import lombok.Singular; this.octopodes.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder rawSet(final java.lang.Object rawSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withRawSet(final java.lang.Object rawSet) { if ((this.rawSet == null)) this.rawSet = new java.util.ArrayList(); this.rawSet.add(rawSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder rawSet(final java.util.Collection rawSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withRawSet(final java.util.Collection rawSet) { if ((this.rawSet == null)) this.rawSet = new java.util.ArrayList(); this.rawSet.addAll(rawSet); @@ -61,13 +61,13 @@ import lombok.Singular; this.rawSet.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder stringSet(final String stringSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withStringSet(final String stringSet) { if ((this.stringSet == null)) this.stringSet = new java.util.ArrayList(); this.stringSet.add(stringSet); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder stringSet(final java.util.Collection stringSet) { + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder withStringSet(final java.util.Collection stringSet) { if ((this.stringSet == null)) this.stringSet = new java.util.ArrayList(); this.stringSet.addAll(stringSet); diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java index 920803cc..f3218f27 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -22,7 +22,7 @@ import lombok.Singular; this.elems.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixes build() { + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix build() { java.util.List elems; switch (((this.elems == null) ? 0 : this.elems.size())) { case 0 : @@ -34,14 +34,14 @@ import lombok.Singular; default : elems = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.elems)); } - return new BuilderSingularWithPrefixesWithSetterPrefixes(elems); + return new BuilderSingularWithPrefixesWithSetterPrefix(elems); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderSingularWithPrefixesWithSetterPrefixes.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems) + ")"); + return (("BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems) + ")"); } } private @Singular java.util.List _elems; - @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixes(final java.util.List elems) { + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix(final java.util.List elems) { super(); this._elems = elems; } diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java index b14c120f..8da2f012 100644 --- a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -1,6 +1,6 @@ import lombok.Builder; class BuilderWithExistingBuilderClassWithSetterPrefix { - public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder { + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") boolean arg2; private @java.lang.SuppressWarnings("all") String arg3; private Z arg1; diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java index 2ce25b0a..7c5b191d 100644 --- a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -4,7 +4,7 @@ import lombok.Value; public class BuilderWithRecursiveGenericsWithSetterPrefix { interface Inter> { } - public static final @Builder(setterPrefix = "with(setterPrefix = "with")") @Value class Test, Quz extends Inter> { + public static final @Builder(setterPrefix = "with") @Value class Test, Quz extends Inter> { public static @java.lang.SuppressWarnings("all") class TestBuilder, Quz extends Inter> { private @java.lang.SuppressWarnings("all") Foo foo; private @java.lang.SuppressWarnings("all") Bar bar; diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java index c33315a4..6f3906d9 100644 --- a/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java @@ -80,44 +80,45 @@ import lombok.Builder; return builder; } } -@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder { - public static @java.lang.SuppressWarnings("all") class ConstructorWithToBuilderBuilder { + +@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilderWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class ConstructorWithToBuilderWithSetterPrefixBuilder { private @java.lang.SuppressWarnings("all") String mOne; private @java.lang.SuppressWarnings("all") T baz; private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList bars; - @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder() { + @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder() { super(); } - public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder withMOne(final String mOne) { + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder withMOne(final String mOne) { this.mOne = mOne; return this; } - public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder withBaz(final T baz) { + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder withBaz(final T baz) { this.baz = baz; return this; } - public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder withBars(final com.google.common.collect.ImmutableList bars) { + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder withBars(final com.google.common.collect.ImmutableList bars) { this.bars = bars; return this; } - public @java.lang.SuppressWarnings("all") ConstructorWithToBuilder build() { - return new ConstructorWithToBuilder(mOne, baz, bars); + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefix build() { + return new ConstructorWithToBuilderWithSetterPrefix(mOne, baz, bars); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne) + ", baz=") + this.baz) + ", bars=") + this.bars) + ")"); + return (((((("ConstructorWithToBuilderWithSetterPrefix.ConstructorWithToBuilderWithSetterPrefixBuilder(mOne=" + this.mOne) + ", baz=") + this.baz) + ", bars=") + this.bars) + ")"); } } private String mOne; private String mTwo; private T foo; private @lombok.Singular com.google.common.collect.ImmutableList bars; - public @Builder(toBuilder = true) ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { + public @Builder(toBuilder = true,setterPrefix = "with") ConstructorWithToBuilderWithSetterPrefix(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { super(); } - public static @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder builder() { - return new ConstructorWithToBuilderBuilder(); + public static @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder builder() { + return new ConstructorWithToBuilderWithSetterPrefixBuilder(); } - public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder toBuilder() { - return new ConstructorWithToBuilderBuilder().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder toBuilder() { + return new ConstructorWithToBuilderWithSetterPrefixBuilder().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); } } diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java index 6fddd748..80197dd3 100644 --- a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -1,4 +1,4 @@ -import lombok.Builder +import lombok.Builder; @Builder(toBuilder = true, builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethodWithSetterPrefix { private String a = ""; diff --git a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java index b33211e9..3b442b8d 100644 --- a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java @@ -5,7 +5,7 @@ class BuilderWithToBuilderWithSetterPrefix { private String mOne, mTwo; @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; @lombok.Singular private List bars; - public static K rrr(BuilderWithToBuilder x) { + public static K rrr(BuilderWithToBuilderWithSetterPrefix x) { return x.foo; } } @@ -15,6 +15,6 @@ class ConstructorWithToBuilderWithSetterPrefix { private T foo; @lombok.Singular private com.google.common.collect.ImmutableList bars; @Builder(toBuilder = true, setterPrefix = "with") - public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { + public ConstructorWithToBuilderWithSetterPrefix(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList bars) { } } diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java index fa7c0298..5c77e177 100644 --- a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java @@ -12,7 +12,7 @@ public class BuilderWithTolerateWithSetterPrefix { public static class BuilderWithTolerateWithSetterPrefixBuilder { @Tolerate public BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) { - return this.value(Integer.parseInt(s)); + return this.withValue(Integer.parseInt(s)); } } } -- cgit From 65302bc13a1ab670dac552e2214989c7381f71a8 Mon Sep 17 00:00:00 2001 From: Caleb Brinkman Date: Mon, 28 Oct 2019 12:09:15 -0500 Subject: More test fixes --- src/core/lombok/eclipse/handlers/HandleBuilder.java | 12 ++++++------ .../BuilderWithExistingBuilderClassWithSetterPrefix.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test/transform/resource') diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index 017cde17..70b07fb8 100755 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -931,12 +931,6 @@ public class HandleBuilder extends EclipseAnnotationHandler { FieldDeclaration fd = (FieldDeclaration) fieldNode.get(); char[] name = fd.name; - for (int i = 0; i < len; i++) { - if (!(existing[i] instanceof MethodDeclaration)) continue; - char[] existingName = existing[i].selector; - if (Arrays.equals(name, existingName) && !isTolerate(fieldNode, existing[i])) return; - } - String setterPrefix = prefix.isEmpty() ? "set" : prefix; String setterName; if(fluent) { @@ -945,6 +939,12 @@ public class HandleBuilder extends EclipseAnnotationHandler { setterName = HandlerUtil.buildAccessorName(setterPrefix, new String(paramName)); } + for (int i = 0; i < len; i++) { + if (!(existing[i] instanceof MethodDeclaration)) continue; + char[] existingName = existing[i].selector; + if (Arrays.equals(setterName.toCharArray(), existingName) && !isTolerate(fieldNode, existing[i])) return; + } + List methodAnnsList = Collections.emptyList(); Annotation[] methodAnns = EclipseHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode); if (methodAnns != null && methodAnns.length > 0) methodAnnsList = Arrays.asList(methodAnns); diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java index 99c3ccc6..e30dd1ff 100644 --- a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -6,7 +6,7 @@ class BuilderWithExistingBuilderClassWithSetterPrefix { return null; } - public static class BuilderWithExistingBuilderClassBuilderWithSetterPrefixBuilder { + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder { private Z arg1; public void withArg2(boolean arg) { -- cgit