aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rwxr-xr-xAUTHORS1
-rw-r--r--buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.36.xml14
-rw-r--r--buildScripts/ivy.xml2
-rw-r--r--doc/changelog.markdown1
-rw-r--r--docker/ant/files/jdk-13/build.xml35
-rw-r--r--docker/maven/files/jdk-13/pom.xml53
-rw-r--r--docker/provision/jdk/java-13.sh4
-rw-r--r--docker/readme.md3
-rw-r--r--docker/shared/src/main/java/SneakyThrowsExample.java7
-rw-r--r--src/core/lombok/Builder.java16
-rw-r--r--src/core/lombok/core/PostCompiler.java8
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java10
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleBuilder.java57
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java6
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java6
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java14
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java42
-rw-r--r--src/core/lombok/javac/handlers/JavacSingularsRecipes.java18
-rw-r--r--test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java34
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java124
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java140
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularGuavaMapsWithSetterPrefix.java94
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java123
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java213
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java121
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java93
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularSetsWithSetterPrefix.java153
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java65
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java97
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java56
-rw-r--r--test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java45
-rw-r--r--test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java109
-rw-r--r--test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java60
-rw-r--r--test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java42
-rw-r--r--test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java114
-rw-r--r--test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java40
-rw-r--r--test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java33
-rw-r--r--test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java40
-rw-r--r--test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java85
-rw-r--r--test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java146
-rw-r--r--test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java40
-rw-r--r--test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java27
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java121
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java125
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java83
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java116
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java209
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java114
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java83
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java145
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java60
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java92
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java51
-rw-r--r--test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java33
-rw-r--r--test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java90
-rw-r--r--test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java47
-rw-r--r--test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java33
-rw-r--r--test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java87
-rw-r--r--test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java36
-rw-r--r--test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java27
-rw-r--r--test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java34
-rw-r--r--test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java78
-rw-r--r--test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java124
-rw-r--r--test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java34
-rw-r--r--test/transform/resource/before/BuilderSimpleWithSetterPrefix.java6
-rw-r--r--test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java14
-rw-r--r--test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java16
-rw-r--r--test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java12
-rw-r--r--test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java15
-rw-r--r--test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java13
-rw-r--r--test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java12
-rw-r--r--test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java10
-rw-r--r--test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java10
-rw-r--r--test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java7
-rw-r--r--test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java14
-rw-r--r--test/transform/resource/before/BuilderValueDataWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java7
-rw-r--r--test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java5
-rw-r--r--test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java15
-rw-r--r--test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java5
-rw-r--r--test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java5
-rw-r--r--test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java13
-rw-r--r--test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java20
-rw-r--r--test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java18
-rw-r--r--test/transform/resource/messages-delombok/BuilderSingularNoAutoWithSetterPrefix.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/BuilderSingularNoAutoWithSetterPrefix.java.messages2
-rw-r--r--website/templates/features/Builder.html6
-rw-r--r--website/templates/order-license-info.html2
-rw-r--r--website/templates/setup/javac.html4
-rw-r--r--website/templates/tidelift.html2
-rw-r--r--website/usageExamples/ToStringExample_post.jpage2
95 files changed, 4436 insertions, 61 deletions
diff --git a/.gitignore b/.gitignore
index b3f7b18d..824ae9c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,10 +15,11 @@
/.factorypath
/lombok.iml
/.idea
+*.iml
*.markdown.html
/junit*.properties
/eclipse.location
/.apt_generated/
/out
/website/lombokSupporters
-/pom.xml \ No newline at end of file
+/pom.xml
diff --git a/AUTHORS b/AUTHORS
index 91ef1793..77cbbfe9 100755
--- a/AUTHORS
+++ b/AUTHORS
@@ -2,6 +2,7 @@ Lombok contributors in alphabetical order:
Adam Juraszek <juriad@gmail.com>
Bulgakov Alexander <buls@yandex.ru>
+Caleb Brinkman <floralvikings@gmail.com>
Christian Nüssgens <christian@nuessgens.com>
Christian Sterzl <christian.sterzl@gmail.com>
DaveLaw <project.lombok@apconsult.de>
diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.36.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.36.xml
new file mode 100644
index 00000000..b75b111d
--- /dev/null
+++ b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.36.xml
@@ -0,0 +1,14 @@
+<ivy-module version="2.0">
+ <info organisation="org.projectlombok" module="lombok.patcher" revision="0.36" publication="20191210010000">
+ <license name="MIT License" url="https://www.opensource.org/licenses/mit-license.php" />
+ <ivyauthor name="rzwitserloot" url="https://github.com/rzwitserloot" />
+ <ivyauthor name="rspilker" url="https://github.com/rspilker" />
+ <description homepage="https://projectlombok.org/" />
+ </info>
+ <configurations>
+ <conf name="default" />
+ </configurations>
+ <publications>
+ <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.36.jar" />
+ </publications>
+</ivy-module>
diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml
index 9d6c991c..1edce11d 100644
--- a/buildScripts/ivy.xml
+++ b/buildScripts/ivy.xml
@@ -18,7 +18,7 @@
<conf name="supporters" />
</configurations>
<dependencies>
- <dependency org="org.projectlombok" name="lombok.patcher" rev="0.34" conf="buildBase->default; runtime->default" />
+ <dependency org="org.projectlombok" name="lombok.patcher" rev="0.36" conf="buildBase->default; runtime->default" />
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="buildBase->runtime; runtime" />
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 44b7f553..b859c5a8 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -3,6 +3,7 @@ Lombok Changelog
### v1.18.11 "Edgy Guinea Pig"
* PLATFORM: Support for JDK13 (including `yield` in switch expressions, as well as delombok having a nicer style for arrow-style switch blocks, and text blocks).
+* FEATURE: You can now configure a builder's 'setter' prefixes via `@Builder(setterPrefix = "set")` for example. We discourage doing this, but if some library you use requires them, have at it. [Pull Request #2174](https://github.com/rzwitserloot/lombok/pull/2174], [Issue #1805](https://github.com/rzwitserloot/lombok/issues/1805).
### v1.18.10 (September 10th, 2019)
diff --git a/docker/ant/files/jdk-13/build.xml b/docker/ant/files/jdk-13/build.xml
new file mode 100644
index 00000000..3f181ed9
--- /dev/null
+++ b/docker/ant/files/jdk-13/build.xml
@@ -0,0 +1,35 @@
+<project name="example" default="dist" basedir=".">
+ <property name="src" location="src/main/java"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <target name="init">
+ <tstamp/>
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init" description="compile the source">
+ <javac classpath="lombok.jar" srcdir="${src}" destdir="${build}" fork="true">
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
+ <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
+ </javac>
+ </target>
+
+ <target name="dist" depends="compile" description="generate the distribution">
+ <mkdir dir="${dist}/lib"/>
+ <jar jarfile="${dist}/lib/example-${DSTAMP}.jar" basedir="${build}"/>
+ </target>
+
+ <target name="clean" description="clean up">
+ <delete dir="${build}"/>
+ <delete dir="${dist}"/>
+ </target>
+</project> \ No newline at end of file
diff --git a/docker/maven/files/jdk-13/pom.xml b/docker/maven/files/jdk-13/pom.xml
new file mode 100644
index 00000000..46a7e3c8
--- /dev/null
+++ b/docker/maven/files/jdk-13/pom.xml
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.example</groupId>
+ <artifactId>lombok-jdk-${env.JDK_VERSION}</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <java.version>13</java.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <fork>true</fork>
+ <compilerargs>
+ <arg>-Werror</arg>
+ <arg>-Xlint:all</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
+ </compilerargs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.2.3</version>
+ <scope>system</scope>
+ <systemPath>/workspace/lombok.jar</systemPath>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/docker/provision/jdk/java-13.sh b/docker/provision/jdk/java-13.sh
new file mode 100644
index 00000000..fe5d4fdc
--- /dev/null
+++ b/docker/provision/jdk/java-13.sh
@@ -0,0 +1,4 @@
+apt-get update && apt-get install -y wget
+wget https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk13u-2019-12-10-19-42/OpenJDK13U-jdk_x64_linux_hotspot_2019-12-10-19-42.tar.gz -O jdk.tar.gz
+tar -xzf jdk.tar.gz -C /opt/
+mv /opt/jdk-13.0.1+9 /opt/jdk \ No newline at end of file
diff --git a/docker/readme.md b/docker/readme.md
index 3500a6ef..2e2c706c 100644
--- a/docker/readme.md
+++ b/docker/readme.md
@@ -14,6 +14,7 @@ can download a specific version by adding `--build-arg lombokjar=lombok-<major.m
The jdk version to be used. Supported values:
+- `13` (experimental)
- `12` (default)
- `11`
- `10`
@@ -30,5 +31,7 @@ you can mount your recently built lombok.jar by providing `-v /<lombokhome>/dist
## Examples
+- [ant](ant/readme.md)
+- [bazel](bazel/readme.md)
- [gradle](gradle/readme.md)
- [maven](maven/readme.md)
diff --git a/docker/shared/src/main/java/SneakyThrowsExample.java b/docker/shared/src/main/java/SneakyThrowsExample.java
new file mode 100644
index 00000000..04811bae
--- /dev/null
+++ b/docker/shared/src/main/java/SneakyThrowsExample.java
@@ -0,0 +1,7 @@
+public class SneakyThrowsExample {
+
+ @lombok.SneakyThrows
+ public static void main(String... args) {
+ throw new java.io.IOException("boo");
+ }
+}
diff --git a/src/core/lombok/Builder.java b/src/core/lombok/Builder.java
index dfa5ecb5..4ca3da65 100644
--- a/src/core/lombok/Builder.java
+++ b/src/core/lombok/Builder.java
@@ -153,6 +153,22 @@ public @interface Builder {
* @return The builder class will be generated with this access modifier.
*/
AccessLevel access() default lombok.AccessLevel.PUBLIC;
+
+ /**
+ * Prefix to prepend to 'set' methods in the generated builder class. By default, generated methods do not include a prefix.
+ *
+ * For example, a method normally generated as {@code someField(String someField)} would instead be
+ * generated as {@code withSomeField(String someField)} if using {@code @Builder(setterPrefix = "with")}.
+ *
+ * Note that using "with" to prefix builder setter methods is strongly discouraged as as "with" normally
+ * suggests immutable data structures, and builders by definition are mutable objects.
+ *
+ * For {@code @Singular} fields, the generated methods are called {@code withName}, {@code withNames}, and {@code clearNames}, instead of
+ * the default {@code name}, {@code names}, and {@code clearNames}.
+ *
+ * @return The prefix to prepend to generated method names.
+ */
+ String setterPrefix() default "";
/**
* Put on a field (in case of {@code @Builder} on a type) or a parameter (for {@code @Builder} on a constructor or static method) to
diff --git a/src/core/lombok/core/PostCompiler.java b/src/core/lombok/core/PostCompiler.java
index 237867cb..e17f806e 100644
--- a/src/core/lombok/core/PostCompiler.java
+++ b/src/core/lombok/core/PostCompiler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2013 The Project Lombok Authors.
+ * Copyright (C) 2010-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
@@ -45,7 +45,9 @@ public final class PostCompiler {
previous = next;
}
} catch (Exception e) {
- diagnostics.addWarning(String.format("Error during the transformation of '%s'; post-compiler '%s' caused an exception: %s", fileName, transformation.getClass().getName(), e));
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw, true));
+ diagnostics.addError(String.format("Error during the transformation of '%s'; post-compiler '%s' caused an exception: %s", fileName, transformation.getClass().getName(), sw));
}
}
return previous;
@@ -59,7 +61,7 @@ public final class PostCompiler {
transformations = Collections.emptyList();
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
- diagnostics.addWarning("Could not load post-compile transformers: " + e.getMessage() + "\n" + sw.toString());
+ diagnostics.addError("Could not load post-compile transformers: " + e.getMessage() + "\n" + sw.toString());
}
}
diff --git a/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java b/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
index 483431cc..cb2ebe18 100755
--- a/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
+++ b/src/core/lombok/eclipse/handlers/EclipseSingularsRecipes.java
@@ -122,12 +122,17 @@ public class EclipseSingularsRecipes {
private final EclipseNode annotation;
private final char[] singularName;
private final char[] pluralName;
+ private final char[] setterPrefix;
private final List<TypeReference> typeArgs;
private final String targetFqn;
private final EclipseSingularizer singularizer;
private final ASTNode source;
public SingularData(EclipseNode annotation, char[] singularName, char[] pluralName, List<TypeReference> typeArgs, String targetFqn, EclipseSingularizer singularizer, ASTNode source) {
+ this(annotation, singularName, pluralName, typeArgs, targetFqn, singularizer, source, new char[0]);
+ }
+
+ public SingularData(EclipseNode annotation, char[] singularName, char[] pluralName, List<TypeReference> typeArgs, String targetFqn, EclipseSingularizer singularizer, ASTNode source, char[] setterPrefix) {
this.annotation = annotation;
this.singularName = singularName;
this.pluralName = pluralName;
@@ -135,6 +140,7 @@ public class EclipseSingularsRecipes {
this.targetFqn = targetFqn;
this.singularizer = singularizer;
this.source = source;
+ this.setterPrefix = setterPrefix;
}
public void setGeneratedByRecursive(ASTNode target) {
@@ -165,6 +171,10 @@ public class EclipseSingularsRecipes {
return pluralName;
}
+ public char[] getSetterPrefix() {
+ return setterPrefix;
+ }
+
public List<TypeReference> getTypeArgs() {
return typeArgs;
}
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index 8bfdeb65..70978e23 100755
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -239,7 +239,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
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) {
@@ -422,7 +422,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
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);
@@ -492,7 +492,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
}
for (BuilderFieldData bfd : builderFields) {
- makeSetterMethodsForBuilder(cfv, builderType, bfd, annotationNode, fluent, chain, accessForInners, bfd.originalFieldNode);
+ makePrefixedSetterMethodsForBuilder(cfv, builderType, bfd, annotationNode, fluent, chain, accessForInners, bfd.originalFieldNode, builderInstance.setterPrefix());
}
{
@@ -539,7 +539,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
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<Builder> {
}
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<BuilderFieldData> builderFields, boolean fluent, ASTNode source, AccessLevel access) {
+ private MethodDeclaration generateToBuilderMethod(CheckerFrameworkVersion cfv, String methodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, List<BuilderFieldData> 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,10 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
Expression receiver = invoke;
List<Statement> statements = null;
for (BuilderFieldData bfd : builderFields) {
- char[] setterName = fluent ? bfd.name : HandlerUtil.buildAccessorName("set", new String(bfd.name)).toCharArray();
+ String setterName = new String(bfd.name);
+ String setterPrefix = !prefix.isEmpty() ? prefix : fluent ? "" : "set";
+ if (!setterPrefix.isEmpty()) setterName = HandlerUtil.buildAccessorName(setterPrefix, setterName);
+
MessageSend ms = new MessageSend();
Expression[] tgt = new Expression[bfd.singularData == null ? 1 : 2];
@@ -600,7 +603,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
}
}
- ms.selector = setterName;
+ ms.selector = setterName.toCharArray();
if (bfd.singularData == null) {
ms.arguments = tgt;
ms.receiver = receiver;
@@ -634,7 +637,6 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope);
return out;
-
}
private MethodDeclaration generateCleanMethod(List<BuilderFieldData> builderFields, EclipseNode builderType, ASTNode source) {
@@ -746,10 +748,11 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
} else {
MessageSend invoke = new MessageSend();
invoke.selector = staticName;
- if (isStatic)
+ if (isStatic) {
invoke.receiver = new SingleNameReference(type.up().getName().toCharArray(), 0);
- else
+ } 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]);
@@ -862,33 +865,39 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
private static final AbstractMethodDeclaration[] EMPTY = {};
- public void makeSetterMethodsForBuilder(CheckerFrameworkVersion cfv, EclipseNode builderType, BuilderFieldData bfd, EclipseNode sourceNode, boolean fluent, boolean chain, AccessLevel access, EclipseNode originalFieldNode) {
+ public void makePrefixedSetterMethodsForBuilder(CheckerFrameworkVersion cfv, 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) {
- makeSimpleSetterMethodForBuilder(cfv, builderType, deprecate, bfd.createdFields.get(0), bfd.name, bfd.nameOfSetFlag, sourceNode, fluent, chain, bfd.annotations, access, originalFieldNode);
+ makePrefixedSetterMethodForBuilder(cfv, builderType, deprecate, bfd.createdFields.get(0), bfd.name, bfd.nameOfSetFlag, sourceNode, fluent, chain, bfd.annotations, access, originalFieldNode, prefix);
} else {
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) {
+ private void makePrefixedSetterMethodForBuilder(CheckerFrameworkVersion cfv, EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] paramName, 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;
- ASTNode source = sourceNode.get();
if (existing == null) existing = EMPTY;
int len = existing.length;
- FieldDeclaration fd = (FieldDeclaration) fieldNode.get();
- char[] name = fd.name;
+
+ String setterPrefix = prefix.isEmpty() ? "set" : prefix;
+ String setterName;
+ if(fluent) {
+ setterName = prefix.isEmpty() ? new String(paramName) : HandlerUtil.buildAccessorName(setterPrefix, new String(paramName));
+ } else {
+ 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(name, existingName) && !isTolerate(fieldNode, existing[i])) return;
+ if (Arrays.equals(setterName.toCharArray(), existingName) && !isTolerate(fieldNode, existing[i])) return;
}
- String setterName = fluent ? new String(paramName) : HandlerUtil.buildAccessorName("set", new String(paramName));
-
- List<Annotation> methodAnnsList = Arrays.asList(EclipseHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode));
+ List<Annotation> methodAnnsList = Collections.<Annotation>emptyList();
+ Annotation[] methodAnns = EclipseHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode);
+ if (methodAnns != null && methodAnns.length > 0) methodAnnsList = Arrays.asList(methodAnns);
+ ASTNode source = sourceNode.get();
MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, paramName, nameOfSetFlag, chain, toEclipseModifier(access),
sourceNode, methodAnnsList, annotations != null ? Arrays.asList(copyAnnotations(source, annotations)) : Collections.<Annotation>emptyList());
if (cfv.generateCalledMethods()) {
@@ -897,7 +906,8 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
System.arraycopy(arr, 0, newArr, 1, arr.length);
newArr[0] = new Argument(new char[] { 't', 'h', 'i', 's' }, 0, new SingleTypeReference(builderType.getName().toCharArray(), 0), Modifier.FINAL);
char[][] nameNotCalled = fromQualifiedName(CheckerFrameworkVersion.NAME__NOT_CALLED);
- SingleMemberAnnotation ann = new SingleMemberAnnotation(new QualifiedTypeReference(nameNotCalled, poss(source, nameNotCalled.length)), source.sourceStart);
+ SingleMemberAnnotation ann = new SingleMemberAnnotation(new QualifiedTypeReference(nameNotCalled, poss(
+ source, nameNotCalled.length)), source.sourceStart);
ann.memberValue = new StringLiteral(setterName.toCharArray(), 0, 0, 0);
newArr[0].annotations = new Annotation[] {ann};
setter.arguments = newArr;
@@ -932,8 +942,9 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
* 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 Explicitly requested setter prefix.
*/
- 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;
@@ -980,7 +991,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
return null;
}
- return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.<TypeReference>emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source);
+ return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.<TypeReference>emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source, setterPrefix.toCharArray());
}
return null;
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
index 338f5eab..8f80d228 100755
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
@@ -172,7 +172,8 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer {
md.arguments[i].annotations = typeUseAnns;
}
md.returnType = returnType;
- md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName(getAddMethodName(), 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);
@@ -204,7 +205,8 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer {
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(getAddMethodName() + "All", 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/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/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
index 8684987f..b0223c50 100755
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
@@ -245,7 +245,12 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer
valueParam.annotations = typeUseAnnsValue;
md.arguments = new Argument[] {keyParam, valueParam};
md.returnType = returnType;
- md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName("put", new String(data.getSingularName())).toCharArray();
+
+ String name = new String(data.getSingularName());
+ String setterPrefix = data.getSetterPrefix().length > 0 ? new String(data.getSetterPrefix()) : fluent ? "" : "put";
+ String setterName = HandlerUtil.buildAccessorName(setterPrefix, name);
+
+ md.selector = setterName.toCharArray();
md.annotations = generateSelfReturnAnnotations(deprecate, cfv, data.getSource());
data.setGeneratedByRecursive(md);
@@ -309,7 +314,12 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer
Argument param = new Argument(data.getPluralName(), 0, paramType, ClassFileConstants.AccFinal);
md.arguments = new Argument[] {param};
md.returnType = returnType;
- md.selector = fluent ? data.getPluralName() : HandlerUtil.buildAccessorName("putAll", new String(data.getPluralName())).toCharArray();
+
+ String name = new String(data.getPluralName());
+ String setterPrefix = data.getSetterPrefix().length > 0 ? new String(data.getSetterPrefix()) : fluent ? "" : "put";
+ String setterName = HandlerUtil.buildAccessorName(setterPrefix, name);
+
+ md.selector = setterName.toCharArray();
md.annotations = generateSelfReturnAnnotations(deprecate, cfv, data.getSource());
data.setGeneratedByRecursive(md);
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index de2bdde1..349b1382 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -180,7 +180,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
bfd.builderFieldName = bfd.name;
bfd.annotations = findCopyableAnnotations(fieldNode);
bfd.type = fd.vartype;
- bfd.singularData = getSingularData(fieldNode);
+ bfd.singularData = getSingularData(fieldNode, builderInstance.setterPrefix());
bfd.originalFieldNode = fieldNode;
if (bfd.singularData != null && isDefault != null) {
@@ -369,7 +369,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
bfd.rawName = raw.name;
bfd.annotations = findCopyableAnnotations(param);
bfd.type = raw.vartype;
- bfd.singularData = getSingularData(param);
+ bfd.singularData = getSingularData(param, builderInstance.setterPrefix());
bfd.originalFieldNode = param;
addObtainVia(bfd, param);
builderFields.add(bfd);
@@ -436,7 +436,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
}
for (BuilderFieldData bfd : builderFields) {
- makeSetterMethodsForBuilder(cfv, builderType, bfd, annotationNode, fluent, chain, accessForInners);
+ makePrefixedSetterMethodsForBuilder(cfv, builderType, bfd, annotationNode, fluent, chain, accessForInners, builderInstance.setterPrefix());
}
{
@@ -487,7 +487,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
}
tps = lb.toList();
}
- JCMethodDecl md = generateToBuilderMethod(cfv, toBuilderMethodName, builderClassName, tdParent, tps, builderFields, fluent, ast, accessForOuters);
+ JCMethodDecl md = generateToBuilderMethod(cfv, toBuilderMethodName, builderClassName, tdParent, tps, builderFields, fluent, ast, accessForOuters, builderInstance.setterPrefix());
if (md != null) {
recursiveSetGeneratedBy(md, ast, annotationNode.getContext());
injectMethod(tdParent, md);
@@ -536,7 +536,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
}
private static final String BUILDER_TEMP_VAR = "builder";
- private JCMethodDecl generateToBuilderMethod(CheckerFrameworkVersion cfv, String toBuilderMethodName, String builderClassName, JavacNode type, List<JCTypeParameter> typeParams, java.util.List<BuilderFieldData> builderFields, boolean fluent, JCAnnotation ast, AccessLevel access) {
+ private JCMethodDecl generateToBuilderMethod(CheckerFrameworkVersion cfv, String toBuilderMethodName, String builderClassName, JavacNode type, List<JCTypeParameter> typeParams, java.util.List<BuilderFieldData> builderFields, boolean fluent, JCAnnotation ast, AccessLevel access, String prefix) {
// return new ThingieBuilder<A, B>().setA(this.a).setB(this.b);
JavacTreeMaker maker = type.getTreeMaker();
@@ -549,7 +549,11 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
JCExpression invoke = call;
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
for (BuilderFieldData bfd : builderFields) {
- Name setterName = fluent ? bfd.name : type.toName(HandlerUtil.buildAccessorName("set", bfd.name.toString()));
+ String setterPrefix = !prefix.isEmpty() ? prefix : fluent ? "" : "set";
+ String prefixedSetterName = bfd.name.toString();
+ if (!setterPrefix.isEmpty()) prefixedSetterName = HandlerUtil.buildAccessorName(setterPrefix, prefixedSetterName);
+
+ Name setterName = type.toName(prefixedSetterName);
JCExpression[] tgt = new JCExpression[bfd.singularData == null ? 1 : 2];
if (bfd.obtainVia == null || !bfd.obtainVia.field().isEmpty()) {
for (int i = 0; i < tgt.length; i++) {
@@ -622,12 +626,12 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
static List<JCVariableDecl> generateBuildArgs(CheckerFrameworkVersion cfv, JavacNode type, java.util.List<BuilderFieldData> builderFields) {
if (!cfv.generateCalledMethods()) return List.<JCVariableDecl>nil();
-
+
ArrayList<String> mandatories = new ArrayList<String>();
for (BuilderFieldData bfd : builderFields) {
if (bfd.singularData == null && bfd.nameOfSetFlag == null) mandatories.add(bfd.name.toString());
}
-
+
JCExpression arg;
JavacTreeMaker maker = type.getTreeMaker();
if (mandatories.size() == 0) return List.<JCVariableDecl>nil();
@@ -642,7 +646,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
JCVariableDecl recv = maker.VarDef(maker.Modifiers(0L, List.<JCAnnotation>of(recvAnno)), type.toName("this"), maker.Ident(builderTypeNode.name), null);
return List.of(recv);
}
-
+
private JCMethodDecl generateBuildMethod(CheckerFrameworkVersion cfv, JavacNode tdParent, boolean isStatic, String buildName, Name builderName, JCExpression returnType, java.util.List<BuilderFieldData> builderFields, JavacNode type, List<JCExpression> thrownExceptions, JCTree source, boolean addCleaning, AccessLevel access) {
JavacTreeMaker maker = type.getTreeMaker();
@@ -776,27 +780,28 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
for (JCVariableDecl gen : generated) recursiveSetGeneratedBy(gen, source, builderType.getContext());
}
- public void makeSetterMethodsForBuilder(CheckerFrameworkVersion cfv, JavacNode builderType, BuilderFieldData fieldNode, JavacNode source, boolean fluent, boolean chain, AccessLevel access) {
+ public void makePrefixedSetterMethodsForBuilder(CheckerFrameworkVersion cfv, 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) {
- makeSimpleSetterMethodForBuilder(cfv, builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.name, fieldNode.nameOfSetFlag, source, fluent, chain, fieldNode.annotations, fieldNode.originalFieldNode, access);
+ makePrefixedSetterMethodForBuilder(cfv, builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.name, fieldNode.nameOfSetFlag, source, fluent, chain, fieldNode.annotations, fieldNode.originalFieldNode, access, prefix);
} else {
+ // TODO prefixed version
fieldNode.singularData.getSingularizer().generateMethods(cfv, fieldNode.singularData, deprecate, builderType, source.get(), fluent, chain, access);
}
}
- private void makeSimpleSetterMethodForBuilder(CheckerFrameworkVersion cfv, JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name paramName, Name nameOfSetFlag, JavacNode source, boolean fluent, boolean chain, List<JCAnnotation> annosOnParam, JavacNode originalFieldNode, AccessLevel access) {
- Name fieldName = ((JCVariableDecl) fieldNode.get()).name;
+ private void makePrefixedSetterMethodForBuilder(CheckerFrameworkVersion cfv, JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name paramName, Name nameOfSetFlag, JavacNode source, boolean fluent, boolean chain, List<JCAnnotation> annosOnParam, JavacNode originalFieldNode, AccessLevel access, String prefix) {
+ String setterPrefix = !prefix.isEmpty() ? prefix : fluent ? "" : "set";
+ String setterName = HandlerUtil.buildAccessorName(setterPrefix, paramName.toString());
+ Name setterName_ = builderType.toName(setterName);
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;
+ if (existingName.equals(setterName_) && !isTolerate(fieldNode, methodDecl)) return;
}
- String setterName = fluent ? paramName.toString() : HandlerUtil.buildAccessorName("set", paramName.toString());
-
JavacTreeMaker maker = fieldNode.getTreeMaker();
List<JCAnnotation> methodAnns = JavacHandlerUtil.findCopyableToSetterAnnotations(originalFieldNode);
@@ -838,8 +843,9 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
* 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 Explicitly requested setter prefix.
*/
- private SingularData getSingularData(JavacNode node) {
+ private SingularData getSingularData(JavacNode node, String setterPrefix) {
for (JavacNode child : node.down()) {
if (!annotationTypeMatches(Singular.class, child)) continue;
Name pluralName = node.getKind() == Kind.FIELD ? removePrefixFromField(node) : ((JCVariableDecl) node.get()).name;
@@ -881,7 +887,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
return null;
}
- return new SingularData(child, singularName, pluralName, typeArgs, targetFqn, singularizer);
+ return new SingularData(child, singularName, pluralName, typeArgs, targetFqn, singularizer, setterPrefix);
}
return null;
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
index fa384df3..86f148ca 100644
--- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
+++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
@@ -119,14 +119,20 @@ public class JavacSingularsRecipes {
private final List<JCExpression> typeArgs;
private final String targetFqn;
private final JavacSingularizer singularizer;
+ private final String setterPrefix;
public SingularData(JavacNode annotation, Name singularName, Name pluralName, List<JCExpression> typeArgs, String targetFqn, JavacSingularizer singularizer) {
+ this(annotation, singularName, pluralName, typeArgs, targetFqn, singularizer, "");
+ }
+
+ public SingularData(JavacNode annotation, Name singularName, Name pluralName, List<JCExpression> typeArgs, String targetFqn, JavacSingularizer singularizer, String setterPrefix) {
this.annotation = annotation;
this.singularName = singularName;
this.pluralName = pluralName;
this.typeArgs = typeArgs;
this.targetFqn = targetFqn;
this.singularizer = singularizer;
+ this.setterPrefix = setterPrefix;
}
public JavacNode getAnnotation() {
@@ -141,6 +147,10 @@ public class JavacSingularsRecipes {
return pluralName;
}
+ public String getSetterPrefix() {
+ return setterPrefix;
+ }
+
public List<JCExpression> getTypeArgs() {
return typeArgs;
}
@@ -281,7 +291,9 @@ public class JavacSingularsRecipes {
ListBuffer<JCStatement> statements = generateSingularMethodStatements(maker, data, builderType, source);
List<JCVariableDecl> params = generateSingularMethodParameters(maker, data, builderType, source);
Name name = data.getSingularName();
- if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), name.toString()));
+ String setterPrefix = data.getSetterPrefix();
+ if (setterPrefix.isEmpty() && !fluent) setterPrefix = getAddMethodName();
+ if (!setterPrefix.isEmpty()) name = builderType.toName(HandlerUtil.buildAccessorName(setterPrefix, name.toString()));
statements.prepend(createConstructBuilderVarIfNeeded(maker, data, builderType, source));
finishAndInjectMethod(cfv, maker, returnType, returnStatement, data, builderType, source, deprecate, statements, name, params, access);
@@ -309,7 +321,9 @@ 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<JCStatement> statements = generatePluralMethodStatements(maker, data, builderType, source);
Name name = data.getPluralName();
- if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName() + "All", name.toString()));
+ String setterPrefix = data.getSetterPrefix();
+ if (setterPrefix.isEmpty() && !fluent) setterPrefix = getAddMethodName() + "All";
+ if (!setterPrefix.isEmpty()) name = builderType.toName(HandlerUtil.buildAccessorName(setterPrefix, 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/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java
new file mode 100644
index 00000000..24ca09d6
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java
@@ -0,0 +1,34 @@
+import java.util.List;
+class BuilderSimpleWithSetterPrefix<T> {
+ private int unprefixed;
+ @java.lang.SuppressWarnings("all")
+ BuilderSimpleWithSetterPrefix(final int unprefixed) {
+ this.unprefixed = unprefixed;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected static class BuilderSimpleWithSetterPrefixBuilder<T> {
+ @java.lang.SuppressWarnings("all")
+ private int unprefixed;
+ @java.lang.SuppressWarnings("all")
+ BuilderSimpleWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSimpleWithSetterPrefixBuilder<T> withUnprefixed(final int unprefixed) {
+ this.unprefixed = unprefixed;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSimpleWithSetterPrefix<T> build() {
+ return new BuilderSimpleWithSetterPrefix<T>(unprefixed);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder(unprefixed=" + this.unprefixed + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected static <T> BuilderSimpleWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSimpleWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java
new file mode 100644
index 00000000..6e9c2cee
--- /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 BuilderSingularAnnotatedTypesWithSetterPrefix {
+ private Set<@MyAnnotation @NonNull String> foos;
+ private 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) {
+ this.foos = foos;
+ this.bars = bars;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularAnnotatedTypesWithSetterPrefixBuilder {
+ @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")
+ BuilderSingularAnnotatedTypesWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder 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 BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> 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 BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearFoos() {
+ if (this.foos != null) this.foos.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ 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");
+ }
+ 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 BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> 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<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearBars() {
+ if (this.bars$key != null) {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesWithSetterPrefix 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 BuilderSingularAnnotatedTypesWithSetterPrefix(foos, bars);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() {
+ return new BuilderSingularAnnotatedTypesWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java
new file mode 100644
index 00000000..b349b160
--- /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 BuilderSingularGuavaListsSetsWithSetterPrefix<T> {
+ private ImmutableList<T> cards;
+ private ImmutableCollection<? extends Number> frogs;
+ @SuppressWarnings("all")
+ private ImmutableSet rawSet;
+ private ImmutableSortedSet<String> passes;
+ private ImmutableTable<? extends Number, ? extends Number, String> users;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularGuavaListsSetsWithSetterPrefix(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) {
+ this.cards = cards;
+ this.frogs = frogs;
+ this.rawSet = rawSet;
+ this.passes = passes;
+ this.users = users;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> {
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableList.Builder<T> cards;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableList.Builder<Number> frogs;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableSortedSet.Builder<String> passes;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableTable.Builder<Number, Number, String> users;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularGuavaListsSetsWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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 BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withCards(final java.lang.Iterable<? extends T> cards) {
+ if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder();
+ this.cards.addAll(cards);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearCards() {
+ this.cards = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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 BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withFrogs(final java.lang.Iterable<? extends Number> frogs) {
+ if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder();
+ this.frogs.addAll(frogs);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearFrogs() {
+ this.frogs = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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 BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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 BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearRawSet() {
+ this.rawSet = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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 BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withPasses(final java.lang.Iterable<? extends String> passes) {
+ if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
+ this.passes.addAll(passes);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearPasses() {
+ this.passes = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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 BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withUsers(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
+ if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder();
+ this.users.putAll(users);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearUsers() {
+ this.users = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaListsSetsWithSetterPrefix<T> build() {
+ com.google.common.collect.ImmutableList<T> cards = this.cards == null ? com.google.common.collect.ImmutableList.<T>of() : this.cards.build();
+ com.google.common.collect.ImmutableCollection<Number> frogs = this.frogs == null ? com.google.common.collect.ImmutableList.<Number>of() : this.frogs.build();
+ com.google.common.collect.ImmutableSet<java.lang.Object> rawSet = this.rawSet == null ? com.google.common.collect.ImmutableSet.<java.lang.Object>of() : this.rawSet.build();
+ com.google.common.collect.ImmutableSortedSet<String> passes = this.passes == null ? com.google.common.collect.ImmutableSortedSet.<String>of() : this.passes.build();
+ com.google.common.collect.ImmutableTable<Number, Number, String> users = this.users == null ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : this.users.build();
+ return new BuilderSingularGuavaListsSetsWithSetterPrefix<T>(cards, frogs, rawSet, passes, users);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularGuavaListsSetsWithSetterPrefix.BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ", users=" + this.users + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <T> BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T>();
+ }
+}
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<K, V> {
+ private ImmutableMap<K, V> battleaxes;
+ private ImmutableSortedMap<Integer, ? extends V> vertices;
+ @SuppressWarnings("all")
+ private ImmutableBiMap rawMap;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularGuavaMapsWithSetterPrefix(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) {
+ this.battleaxes = battleaxes;
+ this.vertices = vertices;
+ this.rawMap = rawMap;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> {
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableMap.Builder<K, V> battleaxes;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableSortedMap.Builder<Integer, V> vertices;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableBiMap.Builder<java.lang.Object, java.lang.Object> rawMap;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularGuavaMapsWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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<K, V> withBattleaxes(final java.util.Map<? extends K, ? extends V> 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<K, V> clearBattleaxes() {
+ this.battleaxes = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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<K, V> withVertices(final java.util.Map<? extends Integer, ? extends V> 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<K, V> clearVertices() {
+ this.vertices = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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<K, V> 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<K, V> clearRawMap() {
+ this.rawMap = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularGuavaMapsWithSetterPrefix<K, V> build() {
+ com.google.common.collect.ImmutableMap<K, V> battleaxes = this.battleaxes == null ? com.google.common.collect.ImmutableMap.<K, V>of() : this.battleaxes.build();
+ com.google.common.collect.ImmutableSortedMap<Integer, V> vertices = this.vertices == null ? com.google.common.collect.ImmutableSortedMap.<Integer, V>of() : this.vertices.build();
+ com.google.common.collect.ImmutableBiMap<java.lang.Object, java.lang.Object> rawMap = this.rawMap == null ? com.google.common.collect.ImmutableBiMap.<java.lang.Object, java.lang.Object>of() : this.rawMap.build();
+ return new BuilderSingularGuavaMapsWithSetterPrefix<K, V>(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 <K, V> BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> builder() {
+ return new BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V>();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java
new file mode 100644
index 00000000..c685a352
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java
@@ -0,0 +1,123 @@
+import java.util.List;
+import java.util.Collection;
+class BuilderSingularListsWithSetterPrefix<T> {
+ private List<T> children;
+ private Collection<? extends Number> scarves;
+ @SuppressWarnings("all")
+ private List rawList;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularListsWithSetterPrefix(final List<T> children, final Collection<? extends Number> scarves, final List rawList) {
+ this.children = children;
+ this.scarves = scarves;
+ this.rawList = rawList;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularListsWithSetterPrefixBuilder<T> {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<T> children;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<Number> scarves;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<java.lang.Object> rawList;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularListsWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> withChild(final T child) {
+ if (this.children == null) this.children = new java.util.ArrayList<T>();
+ this.children.add(child);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> withChildren(final java.util.Collection<? extends T> children) {
+ if (this.children == null) this.children = new java.util.ArrayList<T>();
+ this.children.addAll(children);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> clearChildren() {
+ if (this.children != null) this.children.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> withScarf(final Number scarf) {
+ if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>();
+ this.scarves.add(scarf);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> withScarves(final java.util.Collection<? extends Number> scarves) {
+ if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>();
+ this.scarves.addAll(scarves);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> clearScarves() {
+ if (this.scarves != null) this.scarves.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> withRawList(final java.lang.Object rawList) {
+ if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>();
+ this.rawList.add(rawList);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> withRawList(final java.util.Collection<?> rawList) {
+ if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>();
+ this.rawList.addAll(rawList);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefixBuilder<T> clearRawList() {
+ if (this.rawList != null) this.rawList.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularListsWithSetterPrefix<T> build() {
+ java.util.List<T> 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<T>(this.children));
+ }
+ java.util.Collection<Number> 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<Number>(this.scarves));
+ }
+ java.util.List<java.lang.Object> 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<java.lang.Object>(this.rawList));
+ }
+ return new BuilderSingularListsWithSetterPrefix<T>(children, scarves, rawList);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularListsWithSetterPrefix.BuilderSingularListsWithSetterPrefixBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <T> BuilderSingularListsWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSingularListsWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java
new file mode 100644
index 00000000..a4afb8a8
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java
@@ -0,0 +1,213 @@
+import java.util.Map;
+import java.util.SortedMap;
+class BuilderSingularMapsWithSetterPrefix<K, V> {
+ private Map<K, V> women;
+ private SortedMap<K, ? extends Number> men;
+ @SuppressWarnings("all")
+ private Map rawMap;
+ private Map<String, V> stringMap;
+ @SuppressWarnings("all")
+ BuilderSingularMapsWithSetterPrefix(Map<K, V> women, SortedMap<K, ? extends Number> men, Map rawMap, Map<String, V> stringMap) {
+ this.women = women;
+ this.men = men;
+ this.rawMap = rawMap;
+ this.stringMap = stringMap;
+ }
+ @SuppressWarnings("all")
+ public static class BuilderSingularMapsWithSetterPrefixBuilder<K, V> {
+ @SuppressWarnings("all")
+ private java.util.ArrayList<K> women$key;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<V> women$value;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<K> men$key;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<Number> men$value;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<Object> rawMap$key;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<Object> rawMap$value;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<String> stringMap$key;
+ @SuppressWarnings("all")
+ private java.util.ArrayList<V> stringMap$value;
+ @SuppressWarnings("all")
+ BuilderSingularMapsWithSetterPrefixBuilder() {
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withWoman(K womanKey, V womanValue) {
+ if (this.women$key == null) {
+ this.women$key = new java.util.ArrayList<K>();
+ this.women$value = new java.util.ArrayList<V>();
+ }
+ this.women$key.add(womanKey);
+ this.women$value.add(womanValue);
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withWomen(java.util.Map<? extends K, ? extends V> women) {
+ if (this.women$key == null) {
+ this.women$key = new java.util.ArrayList<K>();
+ this.women$value = new java.util.ArrayList<V>();
+ }
+ for (java.util.Map.Entry<? extends K, ? extends V> $lombokEntry : women.entrySet()) {
+ this.women$key.add($lombokEntry.getKey());
+ this.women$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearWomen() {
+ if (this.women$key != null) {
+ this.women$key.clear();
+ this.women$value.clear();
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withMan(K manKey, Number manValue) {
+ if (this.men$key == null) {
+ this.men$key = new java.util.ArrayList<K>();
+ this.men$value = new java.util.ArrayList<Number>();
+ }
+ this.men$key.add(manKey);
+ this.men$value.add(manValue);
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withMen(java.util.Map<? extends K, ? extends Number> men) {
+ if (this.men$key == null) {
+ this.men$key = new java.util.ArrayList<K>();
+ this.men$value = new java.util.ArrayList<Number>();
+ }
+ for (java.util.Map.Entry<? extends K, ? extends Number> $lombokEntry : men.entrySet()) {
+ this.men$key.add($lombokEntry.getKey());
+ this.men$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearMen() {
+ if (this.men$key != null) {
+ this.men$key.clear();
+ this.men$value.clear();
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withRawMap(Object rawMapKey, Object rawMapValue) {
+ if (this.rawMap$key == null) {
+ this.rawMap$key = new java.util.ArrayList<Object>();
+ this.rawMap$value = new java.util.ArrayList<Object>();
+ }
+ this.rawMap$key.add(rawMapKey);
+ this.rawMap$value.add(rawMapValue);
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withRawMap(java.util.Map<?, ?> rawMap) {
+ if (this.rawMap$key == null) {
+ this.rawMap$key = new java.util.ArrayList<Object>();
+ this.rawMap$value = new java.util.ArrayList<Object>();
+ }
+ 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 BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearRawMap() {
+ if (this.rawMap$key != null) {
+ this.rawMap$key.clear();
+ this.rawMap$value.clear();
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withStringMap(String stringMapKey, V stringMapValue) {
+ if (this.stringMap$key == null) {
+ this.stringMap$key = new java.util.ArrayList<String>();
+ this.stringMap$value = new java.util.ArrayList<V>();
+ }
+ this.stringMap$key.add(stringMapKey);
+ this.stringMap$value.add(stringMapValue);
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> withStringMap(java.util.Map<? extends String, ? extends V> stringMap) {
+ if (this.stringMap$key == null) {
+ this.stringMap$key = new java.util.ArrayList<String>();
+ this.stringMap$value = new java.util.ArrayList<V>();
+ }
+ for (java.util.Map.Entry<? extends String, ? extends V> $lombokEntry : stringMap.entrySet()) {
+ this.stringMap$key.add($lombokEntry.getKey());
+ this.stringMap$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearStringMap() {
+ if (this.stringMap$key != null) {
+ this.stringMap$key.clear();
+ this.stringMap$value.clear();
+ }
+ return this;
+ }
+ @SuppressWarnings("all")
+ public BuilderSingularMapsWithSetterPrefix<K, V> build() {
+ java.util.Map<K, V> 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<K, V>(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<K, Number> men = new java.util.TreeMap<K, Number>();
+ 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<Object, Object> 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<Object, Object>(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<String, V> 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<String, V>(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 BuilderSingularMapsWithSetterPrefix<K, V>(women, men, rawMap, stringMap);
+ }
+ @Override
+ @SuppressWarnings("all")
+ public String toString() {
+ 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 <K, V> BuilderSingularMapsWithSetterPrefixBuilder<K, V> builder() {
+ return new BuilderSingularMapsWithSetterPrefixBuilder<K, V>();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java
new file mode 100644
index 00000000..d2b5ff37
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java
@@ -0,0 +1,121 @@
+import java.util.List;
+class BuilderSingularNoAutoWithSetterPrefix {
+ private List<String> things;
+ private List<String> widgets;
+ private List<String> items;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularNoAutoWithSetterPrefix(final List<String> things, final List<String> widgets, final List<String> items) {
+ this.things = things;
+ this.widgets = widgets;
+ this.items = items;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularNoAutoWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> things;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> widgets;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> items;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularNoAutoWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final String things) {
+ if (this.things == null) this.things = new java.util.ArrayList<String>();
+ this.things.add(things);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection<? extends String> things) {
+ if (this.things == null) this.things = new java.util.ArrayList<String>();
+ this.things.addAll(things);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder clearThings() {
+ if (this.things != null) this.things.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder withWidget(final String widget) {
+ if (this.widgets == null) this.widgets = new java.util.ArrayList<String>();
+ this.widgets.add(widget);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection<? extends String> widgets) {
+ if (this.widgets == null) this.widgets = new java.util.ArrayList<String>();
+ this.widgets.addAll(widgets);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder clearWidgets() {
+ if (this.widgets != null) this.widgets.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final String items) {
+ if (this.items == null) this.items = new java.util.ArrayList<String>();
+ this.items.add(items);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection<? extends String> items) {
+ if (this.items == null) this.items = new java.util.ArrayList<String>();
+ this.items.addAll(items);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefixBuilder clearItems() {
+ if (this.items != null) this.items.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularNoAutoWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.things));
+ }
+ java.util.List<String> 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<String>(this.widgets));
+ }
+ java.util.List<String> 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<String>(this.items));
+ }
+ return new BuilderSingularNoAutoWithSetterPrefix(things, widgets, items);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..b0fe8135
--- /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 BuilderSingularRedirectToGuavaWithSetterPrefix {
+ private Set<String> dangerMice;
+ private NavigableMap<Integer, Number> things;
+ private Collection<Class<?>> doohickeys;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularRedirectToGuavaWithSetterPrefix(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) {
+ this.dangerMice = dangerMice;
+ this.things = things;
+ this.doohickeys = doohickeys;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularRedirectToGuavaWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableSet.Builder<String> dangerMice;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularRedirectToGuavaWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ 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 BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDangerMice(final java.lang.Iterable<? extends String> dangerMice) {
+ if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder();
+ this.dangerMice.addAll(dangerMice);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDangerMice() {
+ this.dangerMice = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ 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 BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withThings(final java.util.Map<? extends Integer, ? extends Number> things) {
+ if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder();
+ this.things.putAll(things);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearThings() {
+ this.things = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ 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 BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDoohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) {
+ if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder();
+ this.doohickeys.addAll(doohickeys);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDoohickeys() {
+ this.doohickeys = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularRedirectToGuavaWithSetterPrefix build() {
+ java.util.Set<String> dangerMice = this.dangerMice == null ? com.google.common.collect.ImmutableSet.<String>of() : this.dangerMice.build();
+ java.util.NavigableMap<Integer, Number> things = this.things == null ? com.google.common.collect.ImmutableSortedMap.<Integer, Number>of() : this.things.build();
+ java.util.Collection<Class<?>> doohickeys = this.doohickeys == null ? com.google.common.collect.ImmutableList.<Class<?>>of() : this.doohickeys.build();
+ return new BuilderSingularRedirectToGuavaWithSetterPrefix(dangerMice, things, doohickeys);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularRedirectToGuavaWithSetterPrefix.BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(dangerMice=" + this.dangerMice + ", things=" + this.things + ", doohickeys=" + this.doohickeys + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderSingularRedirectToGuavaWithSetterPrefixBuilder builder() {
+ return new BuilderSingularRedirectToGuavaWithSetterPrefixBuilder();
+ }
+}
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<T> {
+ private Set<T> dangerMice;
+ private SortedSet<? extends Number> octopodes;
+ @SuppressWarnings("all")
+ private Set rawSet;
+ private Set<String> stringSet;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularSetsWithSetterPrefix(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) {
+ this.dangerMice = dangerMice;
+ this.octopodes = octopodes;
+ this.rawSet = rawSet;
+ this.stringSet = stringSet;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularSetsWithSetterPrefixBuilder<T> {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<T> dangerMice;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<Number> octopodes;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<java.lang.Object> rawSet;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> stringSet;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularSetsWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMouse(final T dangerMouse) {
+ if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList<T>();
+ this.dangerMice.add(dangerMouse);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMice(final java.util.Collection<? extends T> dangerMice) {
+ if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList<T>();
+ this.dangerMice.addAll(dangerMice);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> clearDangerMice() {
+ if (this.dangerMice != null) this.dangerMice.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopus(final Number octopus) {
+ if (this.octopodes == null) this.octopodes = new java.util.ArrayList<Number>();
+ this.octopodes.add(octopus);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopodes(final java.util.Collection<? extends Number> octopodes) {
+ if (this.octopodes == null) this.octopodes = new java.util.ArrayList<Number>();
+ this.octopodes.addAll(octopodes);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> clearOctopodes() {
+ if (this.octopodes != null) this.octopodes.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withRawSet(final java.lang.Object rawSet) {
+ if (this.rawSet == null) this.rawSet = new java.util.ArrayList<java.lang.Object>();
+ this.rawSet.add(rawSet);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withRawSet(final java.util.Collection<?> rawSet) {
+ if (this.rawSet == null) this.rawSet = new java.util.ArrayList<java.lang.Object>();
+ this.rawSet.addAll(rawSet);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> clearRawSet() {
+ if (this.rawSet != null) this.rawSet.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(final String stringSet) {
+ if (this.stringSet == null) this.stringSet = new java.util.ArrayList<String>();
+ this.stringSet.add(stringSet);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(final java.util.Collection<? extends String> stringSet) {
+ if (this.stringSet == null) this.stringSet = new java.util.ArrayList<String>();
+ this.stringSet.addAll(stringSet);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefixBuilder<T> clearStringSet() {
+ if (this.stringSet != null) this.stringSet.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularSetsWithSetterPrefix<T> build() {
+ java.util.Set<T> 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<T>(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<Number> octopodes = new java.util.TreeSet<Number>();
+ if (this.octopodes != null) octopodes.addAll(this.octopodes);
+ octopodes = java.util.Collections.unmodifiableSortedSet(octopodes);
+ java.util.Set<java.lang.Object> 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<java.lang.Object>(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<String> 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<String>(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<T>(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 <T> BuilderSingularSetsWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSingularSetsWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java
new file mode 100644
index 00000000..5f42d87e
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java
@@ -0,0 +1,65 @@
+class BuilderSingularToBuilderWithNullWithSetterPrefix {
+ private java.util.List<String> elems;
+ public static void test() {
+ new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder();
+ }
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularToBuilderWithNullWithSetterPrefix(final java.util.List<String> elems) {
+ this.elems = elems;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularToBuilderWithNullWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> elems;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularToBuilderWithNullWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElem(final String elem) {
+ if (this.elems == null) this.elems = new java.util.ArrayList<String>();
+ this.elems.add(elem);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
+ if (this.elems == null) this.elems = new java.util.ArrayList<String>();
+ this.elems.addAll(elems);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder clearElems() {
+ if (this.elems != null) this.elems.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularToBuilderWithNullWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.elems));
+ }
+ return new BuilderSingularToBuilderWithNullWithSetterPrefix(elems);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(elems=" + this.elems + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder() {
+ return new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder();
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() {
+ final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder();
+ 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
new file mode 100644
index 00000000..367f0ac1
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java
@@ -0,0 +1,97 @@
+import java.util.List;
+import java.util.Collection;
+class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix {
+ private List<?> objects;
+ private Collection<? extends Number> numbers;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(final List<?> objects, final Collection<? extends Number> numbers) {
+ this.objects = objects;
+ this.numbers = numbers;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<java.lang.Object> objects;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<Number> numbers;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObject(final java.lang.Object object) {
+ if (this.objects == null) this.objects = new java.util.ArrayList<java.lang.Object>();
+ this.objects.add(object);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObjects(final java.util.Collection<?> objects) {
+ if (this.objects == null) this.objects = new java.util.ArrayList<java.lang.Object>();
+ this.objects.addAll(objects);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearObjects() {
+ if (this.objects != null) this.objects.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumber(final Number number) {
+ if (this.numbers == null) this.numbers = new java.util.ArrayList<Number>();
+ this.numbers.add(number);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumbers(final java.util.Collection<? extends Number> numbers) {
+ if (this.numbers == null) this.numbers = new java.util.ArrayList<Number>();
+ this.numbers.addAll(numbers);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearNumbers() {
+ if (this.numbers != null) this.numbers.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefix build() {
+ java.util.List<java.lang.Object> 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<java.lang.Object>(this.objects));
+ }
+ java.util.Collection<Number> 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<Number>(this.numbers));
+ }
+ return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(objects, numbers);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(objects=" + this.objects + ", numbers=" + this.numbers + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder() {
+ return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder();
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() {
+ final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder();
+ 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-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java
new file mode 100644
index 00000000..2f163caf
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java
@@ -0,0 +1,56 @@
+class BuilderSingularWithPrefixesWithSetterPrefix {
+ private java.util.List<String> _elems;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularWithPrefixesWithSetterPrefix(final java.util.List<String> elems) {
+ this._elems = elems;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularWithPrefixesWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> elems;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularWithPrefixesWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWithPrefixesWithSetterPrefixBuilder withElem(final String elem) {
+ if (this.elems == null) this.elems = new java.util.ArrayList<String>();
+ this.elems.add(elem);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWithPrefixesWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
+ if (this.elems == null) this.elems = new java.util.ArrayList<String>();
+ this.elems.addAll(elems);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWithPrefixesWithSetterPrefixBuilder clearElems() {
+ if (this.elems != null) this.elems.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularWithPrefixesWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.elems));
+ }
+ return new BuilderSingularWithPrefixesWithSetterPrefix(elems);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..0d4f8059
--- /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 BuilderTypeAnnosWithSetterPrefix {
+ @TA
+ @TB
+ private List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ BuilderTypeAnnosWithSetterPrefix(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderTypeAnnosWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ BuilderTypeAnnosWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderTypeAnnosWithSetterPrefixBuilder withFoo(@TA final List<String> foo) {
+ this.foo = foo;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderTypeAnnosWithSetterPrefix build() {
+ return new BuilderTypeAnnosWithSetterPrefix(foo);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder(foo=" + this.foo + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..87905208
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java
@@ -0,0 +1,109 @@
+import java.util.List;
+final class BuilderAndValueWithSetterPrefix {
+ private final int zero = 0;
+ @java.lang.SuppressWarnings("all")
+ BuilderAndValueWithSetterPrefix() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderAndValueWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ BuilderAndValueWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderAndValueWithSetterPrefix build() {
+ return new BuilderAndValueWithSetterPrefix();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderAndValueWithSetterPrefix.BuilderAndValueWithSetterPrefixBuilder()";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderAndValueWithSetterPrefixBuilder builder() {
+ return new BuilderAndValueWithSetterPrefixBuilder();
+ }
+ @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 BuilderAndValueWithSetterPrefix)) return false;
+ final BuilderAndValueWithSetterPrefix other = (BuilderAndValueWithSetterPrefix) 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 "BuilderAndValueWithSetterPrefix(zero=" + this.getZero() + ")";
+ }
+}
+
+class BuilderAndDataWithSetterPrefix {
+ private final int zero = 0;
+ @java.lang.SuppressWarnings("all")
+ BuilderAndDataWithSetterPrefix() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderAndDataWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ BuilderAndDataWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderAndDataWithSetterPrefix build() {
+ return new BuilderAndDataWithSetterPrefix();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderAndDataWithSetterPrefix.BuilderAndDataWithSetterPrefixBuilder()";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderAndDataWithSetterPrefixBuilder builder() {
+ return new BuilderAndDataWithSetterPrefixBuilder();
+ }
+ @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 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 BuilderAndDataWithSetterPrefix;
+ }
+ @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 "BuilderAndDataWithSetterPrefix(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..45a79fdc
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java
@@ -0,0 +1,60 @@
+class BuilderWithAccessorsWithSetterPrefix {
+ private final int plower;
+ private final int pUpper;
+ private int _foo;
+ private int __bar;
+ @java.lang.SuppressWarnings("all")
+ 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 BuilderWithAccessorsWithSetterPrefixBuilder {
+ @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")
+ BuilderWithAccessorsWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithAccessorsWithSetterPrefixBuilder withPlower(final int plower) {
+ this.plower = plower;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithAccessorsWithSetterPrefixBuilder withUpper(final int upper) {
+ this.upper = upper;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithAccessorsWithSetterPrefixBuilder withFoo(final int foo) {
+ this.foo = foo;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithAccessorsWithSetterPrefixBuilder with_bar(final int _bar) {
+ this._bar = _bar;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithAccessorsWithSetterPrefix build() {
+ return new BuilderWithAccessorsWithSetterPrefix(plower, upper, foo, _bar);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithAccessorsWithSetterPrefix.BuilderWithAccessorsWithSetterPrefixBuilder(plower=" + this.plower + ", upper=" + this.upper + ", foo=" + this.foo + ", _bar=" + this._bar + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..be7a78c7
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java
@@ -0,0 +1,42 @@
+public class BuilderWithBadNamesWithSetterPrefix {
+ String build;
+ String toString;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithBadNamesWithSetterPrefix(final String build, final String toString) {
+ this.build = build;
+ this.toString = toString;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderWithBadNamesWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private String build;
+ @java.lang.SuppressWarnings("all")
+ private String toString;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithBadNamesWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithBadNamesWithSetterPrefixBuilder withBuild(final String build) {
+ this.build = build;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithBadNamesWithSetterPrefixBuilder withToString(final String toString) {
+ this.toString = toString;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithBadNamesWithSetterPrefix build() {
+ return new BuilderWithBadNamesWithSetterPrefix(build, toString);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithBadNamesWithSetterPrefix.BuilderWithBadNamesWithSetterPrefixBuilder(build=" + this.build + ", toString=" + this.toString + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..5f6f2c32
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java
@@ -0,0 +1,114 @@
+import com.google.common.collect.ImmutableList;
+public class BuilderWithDeprecatedWithSetterPrefix {
+ /**
+ * @deprecated since always
+ */
+ String dep1;
+ @Deprecated
+ int dep2;
+ @Deprecated
+ java.util.List<String> strings;
+ @Deprecated
+ ImmutableList<Integer> numbers;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithDeprecatedWithSetterPrefix(final String dep1, final int dep2, final java.util.List<String> strings, final ImmutableList<Integer> numbers) {
+ this.dep1 = dep1;
+ this.dep2 = dep2;
+ this.strings = strings;
+ this.numbers = numbers;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderWithDeprecatedWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private String dep1;
+ @java.lang.SuppressWarnings("all")
+ private int dep2;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> strings;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableList.Builder<Integer> numbers;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithDeprecatedWithSetterPrefixBuilder() {
+ }
+ /**
+ * @deprecated since always
+ */
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedWithSetterPrefixBuilder withDep1(final String dep1) {
+ this.dep1 = dep1;
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedWithSetterPrefixBuilder withDep2(final int dep2) {
+ this.dep2 = dep2;
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedWithSetterPrefixBuilder withString(final String string) {
+ if (this.strings == null) this.strings = new java.util.ArrayList<String>();
+ this.strings.add(string);
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedWithSetterPrefixBuilder withStrings(final java.util.Collection<? extends String> strings) {
+ if (this.strings == null) this.strings = new java.util.ArrayList<String>();
+ this.strings.addAll(strings);
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedWithSetterPrefixBuilder clearStrings() {
+ if (this.strings != null) this.strings.clear();
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ 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 BuilderWithDeprecatedWithSetterPrefixBuilder withNumbers(final java.lang.Iterable<? extends Integer> 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 BuilderWithDeprecatedWithSetterPrefixBuilder clearNumbers() {
+ this.numbers = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.strings));
+ }
+ com.google.common.collect.ImmutableList<Integer> numbers = this.numbers == null ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build();
+ return new BuilderWithDeprecatedWithSetterPrefix(dep1, dep2, strings, numbers);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithDeprecatedWithSetterPrefix.BuilderWithDeprecatedWithSetterPrefixBuilder(dep1=" + this.dep1 + ", dep2=" + this.dep2 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..95f89c9d
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java
@@ -0,0 +1,40 @@
+class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> {
+ public static <Z extends Number> BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) {
+ return null;
+ }
+ public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z extends Number> {
+ @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")
+ BuilderWithExistingBuilderClassWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg1(final Z arg1) {
+ this.arg1 = arg1;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg3(final String arg3) {
+ this.arg3 = arg3;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> build() {
+ return BuilderWithExistingBuilderClassWithSetterPrefix.<Z>staticMethod(arg1, arg2, arg3);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder(arg1=" + this.arg1 + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <Z extends Number> BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> builder() {
+ return new BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z>();
+ }
+}
diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java
new file mode 100644
index 00000000..0f478ed1
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java
@@ -0,0 +1,33 @@
+class BuilderWithNoBuilderMethodWithSetterPrefix {
+ private String a = "";
+ @java.lang.SuppressWarnings("all")
+ BuilderWithNoBuilderMethodWithSetterPrefix(final String a) {
+ this.a = a;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderWithNoBuilderMethodWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private String a;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithNoBuilderMethodWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithNoBuilderMethodWithSetterPrefixBuilder withA(final String a) {
+ this.a = a;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithNoBuilderMethodWithSetterPrefix build() {
+ return new BuilderWithNoBuilderMethodWithSetterPrefix(a);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithNoBuilderMethodWithSetterPrefix.BuilderWithNoBuilderMethodWithSetterPrefixBuilder(a=" + this.a + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..49be1717
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java
@@ -0,0 +1,40 @@
+class BuilderWithNonNullWithSetterPrefix {
+ @lombok.NonNull
+ private final String id;
+ @java.lang.SuppressWarnings("all")
+ 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 BuilderWithNonNullWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private String id;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithNonNullWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithNonNullWithSetterPrefixBuilder 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 BuilderWithNonNullWithSetterPrefix build() {
+ return new BuilderWithNonNullWithSetterPrefix(id);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder(id=" + this.id + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ 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
new file mode 100644
index 00000000..04494ff9
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java
@@ -0,0 +1,85 @@
+import java.util.Set;
+public class BuilderWithRecursiveGenericsWithSetterPrefix {
+ interface Inter<T, U extends Inter<T, U>> {
+ }
+ public static final class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> {
+ 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<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> {
+ @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<Foo, Bar, Quz> withFoo(final Foo foo) {
+ this.foo = foo;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public TestBuilder<Foo, Bar, Quz> withBar(final Bar bar) {
+ this.bar = bar;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public Test<Foo, Bar, Quz> build() {
+ return new Test<Foo, Bar, Quz>(foo, bar);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithRecursiveGenericsWithSetterPrefix.Test.TestBuilder(foo=" + this.foo + ", bar=" + this.bar + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> TestBuilder<Foo, Bar, Quz> builder() {
+ return new TestBuilder<Foo, Bar, Quz>();
+ }
+ @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 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;
+ 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 "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
new file mode 100644
index 00000000..322c667c
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java
@@ -0,0 +1,146 @@
+import java.util.List;
+class BuilderWithToBuilderWithSetterPrefix<T> {
+ private String mOne;
+ private String mTwo;
+ private T foo;
+ private List<T> bars;
+ public static <K> K rrr(BuilderWithToBuilderWithSetterPrefix<K> x) {
+ return x.foo;
+ }
+ @java.lang.SuppressWarnings("all")
+ BuilderWithToBuilderWithSetterPrefix(final String one, final String two, final T foo, final List<T> bars) {
+ this.mOne = one;
+ this.mTwo = two;
+ this.foo = foo;
+ this.bars = bars;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderWithToBuilderWithSetterPrefixBuilder<T> {
+ @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<T> bars;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithToBuilderWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> withOne(final String one) {
+ this.one = one;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> withTwo(final String two) {
+ this.two = two;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> withFoo(final T foo) {
+ this.foo = foo;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> withBar(final T bar) {
+ if (this.bars == null) this.bars = new java.util.ArrayList<T>();
+ this.bars.add(bar);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> withBars(final java.util.Collection<? extends T> bars) {
+ if (this.bars == null) this.bars = new java.util.ArrayList<T>();
+ this.bars.addAll(bars);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> clearBars() {
+ if (this.bars != null) this.bars.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefix<T> build() {
+ java.util.List<T> 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<T>(this.bars));
+ }
+ return new BuilderWithToBuilderWithSetterPrefix<T>(one, two, foo, bars);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithToBuilderWithSetterPrefix.BuilderWithToBuilderWithSetterPrefixBuilder(one=" + this.one + ", two=" + this.two + ", foo=" + this.foo + ", bars=" + this.bars + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <T> BuilderWithToBuilderWithSetterPrefixBuilder<T> builder() {
+ return new BuilderWithToBuilderWithSetterPrefixBuilder<T>();
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithToBuilderWithSetterPrefixBuilder<T> toBuilder() {
+ final BuilderWithToBuilderWithSetterPrefixBuilder<T> builder = new BuilderWithToBuilderWithSetterPrefixBuilder<T>().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilderWithSetterPrefix.<T>rrr(this));
+ if (this.bars != null) builder.withBars(this.bars);
+ return builder;
+ }
+}
+class ConstructorWithToBuilderWithSetterPrefix<T> {
+ private String mOne;
+ private String mTwo;
+ private T foo;
+ @lombok.Singular
+ private com.google.common.collect.ImmutableList<T> bars;
+ public ConstructorWithToBuilderWithSetterPrefix(String mOne, T baz, com.google.common.collect.ImmutableList<T> bars) {
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class ConstructorWithToBuilderWithSetterPrefixBuilder<T> {
+ @java.lang.SuppressWarnings("all")
+ private String mOne;
+ @java.lang.SuppressWarnings("all")
+ private T baz;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableList<T> bars;
+ @java.lang.SuppressWarnings("all")
+ ConstructorWithToBuilderWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public ConstructorWithToBuilderWithSetterPrefixBuilder<T> withMOne(final String mOne) {
+ this.mOne = mOne;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public ConstructorWithToBuilderWithSetterPrefixBuilder<T> withBaz(final T baz) {
+ this.baz = baz;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public ConstructorWithToBuilderWithSetterPrefixBuilder<T> withBars(final com.google.common.collect.ImmutableList<T> bars) {
+ this.bars = bars;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public ConstructorWithToBuilderWithSetterPrefix<T> build() {
+ return new ConstructorWithToBuilderWithSetterPrefix<T>(mOne, baz, bars);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "ConstructorWithToBuilderWithSetterPrefix.ConstructorWithToBuilderWithSetterPrefixBuilder(mOne=" + this.mOne + ", baz=" + this.baz + ", bars=" + this.bars + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <T> ConstructorWithToBuilderWithSetterPrefixBuilder<T> builder() {
+ return new ConstructorWithToBuilderWithSetterPrefixBuilder<T>();
+ }
+ @java.lang.SuppressWarnings("all")
+ public ConstructorWithToBuilderWithSetterPrefixBuilder<T> toBuilder() {
+ return new ConstructorWithToBuilderWithSetterPrefixBuilder<T>().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..70394d09
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java
@@ -0,0 +1,40 @@
+import lombok.experimental.Tolerate;
+public class BuilderWithTolerateWithSetterPrefix {
+ private final int value;
+ public static void main(String[] args) {
+ BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build();
+ }
+ public static class BuilderWithTolerateWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all")
+ private int value;
+ @Tolerate
+ public BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) {
+ return this.withValue(Integer.parseInt(s));
+ }
+ @java.lang.SuppressWarnings("all")
+ BuilderWithTolerateWithSetterPrefixBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithTolerateWithSetterPrefixBuilder withValue(final int value) {
+ this.value = value;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithTolerateWithSetterPrefix build() {
+ return new BuilderWithTolerateWithSetterPrefix(value);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithTolerateWithSetterPrefix.BuilderWithTolerateWithSetterPrefixBuilder(value=" + this.value + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ BuilderWithTolerateWithSetterPrefix(final int value) {
+ this.value = value;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderWithTolerateWithSetterPrefixBuilder builder() {
+ return new BuilderWithTolerateWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java
new file mode 100644
index 00000000..993c66da
--- /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 BuilderSimpleWithSetterPrefix<T> {
+ protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefixBuilder<T> {
+ private @java.lang.SuppressWarnings("all") int unprefixed;
+ @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder<T> withUnprefixed(final int unprefixed) {
+ this.unprefixed = unprefixed;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix<T> build() {
+ return new BuilderSimpleWithSetterPrefix<T>(unprefixed);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder(unprefixed=" + this.unprefixed) + ")");
+ }
+ }
+ private int unprefixed;
+ @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix(final int unprefixed) {
+ super();
+ this.unprefixed = unprefixed;
+ }
+ protected static @java.lang.SuppressWarnings("all") <T>BuilderSimpleWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSimpleWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java
new file mode 100644
index 00000000..c978ff40
--- /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 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder() {
+ super();
+ }
+ 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");
+ }
+ if ((this.foos == null))
+ this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearFoos() {
+ if ((this.foos != null))
+ this.foos.clear();
+ return this;
+ }
+ 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");
+ }
+ 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> 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<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet())
+ {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearBars() {
+ if ((this.bars$key != null))
+ {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefix 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 BuilderSingularAnnotatedTypesWithSetterPrefix(foos, bars);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ 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") 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() {
+ return new BuilderSingularAnnotatedTypesWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java
new file mode 100644
index 00000000..ec700874
--- /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 BuilderSingularGuavaListsSetsWithSetterPrefix<T> {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> {
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<T> cards;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Number> frogs;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedSet.Builder<String> passes;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableTable.Builder<Number, Number, String> users;
+ @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withCards(final java.lang.Iterable<? extends T> cards) {
+ if ((this.cards == null))
+ this.cards = com.google.common.collect.ImmutableList.builder();
+ this.cards.addAll(cards);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearCards() {
+ this.cards = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withFrogs(final java.lang.Iterable<? extends Number> frogs) {
+ if ((this.frogs == null))
+ this.frogs = com.google.common.collect.ImmutableList.builder();
+ this.frogs.addAll(frogs);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearFrogs() {
+ this.frogs = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearRawSet() {
+ this.rawSet = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withPasses(final java.lang.Iterable<? extends String> passes) {
+ if ((this.passes == null))
+ this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
+ this.passes.addAll(passes);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearPasses() {
+ this.passes = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> 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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> withUsers(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
+ if ((this.users == null))
+ this.users = com.google.common.collect.ImmutableTable.builder();
+ this.users.putAll(users);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearUsers() {
+ this.users = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefix<T> build() {
+ com.google.common.collect.ImmutableList<T> cards = ((this.cards == null) ? com.google.common.collect.ImmutableList.<T>of() : this.cards.build());
+ com.google.common.collect.ImmutableCollection<Number> frogs = ((this.frogs == null) ? com.google.common.collect.ImmutableList.<Number>of() : this.frogs.build());
+ com.google.common.collect.ImmutableSet<java.lang.Object> rawSet = ((this.rawSet == null) ? com.google.common.collect.ImmutableSet.<java.lang.Object>of() : this.rawSet.build());
+ com.google.common.collect.ImmutableSortedSet<String> passes = ((this.passes == null) ? com.google.common.collect.ImmutableSortedSet.<String>of() : this.passes.build());
+ com.google.common.collect.ImmutableTable<Number, Number, String> users = ((this.users == null) ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : this.users.build());
+ return new BuilderSingularGuavaListsSetsWithSetterPrefix<T>(cards, frogs, rawSet, passes, users);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((((((("BuilderSingularGuavaListsSetsWithSetterPrefix.BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ", users=") + this.users) + ")");
+ }
+ }
+ private @Singular ImmutableList<T> cards;
+ private @Singular ImmutableCollection<? extends Number> frogs;
+ private @SuppressWarnings("all") @Singular("rawSet") ImmutableSet rawSet;
+ private @Singular ImmutableSortedSet<String> passes;
+ private @Singular ImmutableTable<? extends Number, ? extends Number, String> users;
+ @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefix(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) {
+ super();
+ this.cards = cards;
+ this.frogs = frogs;
+ this.rawSet = rawSet;
+ this.passes = passes;
+ this.users = users;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java
new file mode 100644
index 00000000..0f58f7a4
--- /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 BuilderSingularGuavaMapsWithSetterPrefix<K, V> {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> {
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableMap.Builder<K, V> battleaxes;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder<Integer, V> vertices;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableBiMap.Builder<java.lang.Object, java.lang.Object> rawMap;
+ @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> withBattleaxes(final java.util.Map<? extends K, ? extends V> battleaxes) {
+ if ((this.battleaxes == null))
+ this.battleaxes = com.google.common.collect.ImmutableMap.builder();
+ this.battleaxes.putAll(battleaxes);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> clearBattleaxes() {
+ this.battleaxes = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> withVertices(final java.util.Map<? extends Integer, ? extends V> vertices) {
+ if ((this.vertices == null))
+ this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder();
+ this.vertices.putAll(vertices);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> clearVertices() {
+ this.vertices = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> 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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> clearRawMap() {
+ this.rawMap = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefix<K, V> build() {
+ com.google.common.collect.ImmutableMap<K, V> battleaxes = ((this.battleaxes == null) ? com.google.common.collect.ImmutableMap.<K, V>of() : this.battleaxes.build());
+ com.google.common.collect.ImmutableSortedMap<Integer, V> vertices = ((this.vertices == null) ? com.google.common.collect.ImmutableSortedMap.<Integer, V>of() : this.vertices.build());
+ com.google.common.collect.ImmutableBiMap<java.lang.Object, java.lang.Object> rawMap = ((this.rawMap == null) ? com.google.common.collect.ImmutableBiMap.<java.lang.Object, java.lang.Object>of() : this.rawMap.build());
+ return new BuilderSingularGuavaMapsWithSetterPrefix<K, V>(battleaxes, vertices, rawMap);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderSingularGuavaMapsWithSetterPrefix.BuilderSingularGuavaMapsWithSetterPrefixBuilder(battleaxes=" + this.battleaxes) + ", vertices=") + this.vertices) + ", rawMap=") + this.rawMap) + ")");
+ }
+ }
+ private @Singular ImmutableMap<K, V> battleaxes;
+ private @Singular ImmutableSortedMap<Integer, ? extends V> vertices;
+ private @SuppressWarnings("all") @Singular("rawMap") ImmutableBiMap rawMap;
+ @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefix(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) {
+ super();
+ this.battleaxes = battleaxes;
+ this.vertices = vertices;
+ this.rawMap = rawMap;
+ }
+ public static @java.lang.SuppressWarnings("all") <K, V>BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> builder() {
+ return new BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java
new file mode 100644
index 00000000..ab90cb48
--- /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 BuilderSingularListsWithSetterPrefix<T> {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularListsWithSetterPrefixBuilder<T> {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<T> children;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> scarves;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawList;
+ @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> withChild(final T child) {
+ if ((this.children == null))
+ this.children = new java.util.ArrayList<T>();
+ this.children.add(child);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> withChildren(final java.util.Collection<? extends T> children) {
+ if ((this.children == null))
+ this.children = new java.util.ArrayList<T>();
+ this.children.addAll(children);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> clearChildren() {
+ if ((this.children != null))
+ this.children.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> withScarf(final Number scarf) {
+ if ((this.scarves == null))
+ this.scarves = new java.util.ArrayList<Number>();
+ this.scarves.add(scarf);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> withScarves(final java.util.Collection<? extends Number> scarves) {
+ if ((this.scarves == null))
+ this.scarves = new java.util.ArrayList<Number>();
+ this.scarves.addAll(scarves);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> clearScarves() {
+ if ((this.scarves != null))
+ this.scarves.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> withRawList(final java.lang.Object rawList) {
+ if ((this.rawList == null))
+ this.rawList = new java.util.ArrayList<java.lang.Object>();
+ this.rawList.add(rawList);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> withRawList(final java.util.Collection<?> rawList) {
+ if ((this.rawList == null))
+ this.rawList = new java.util.ArrayList<java.lang.Object>();
+ this.rawList.addAll(rawList);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<T> clearRawList() {
+ if ((this.rawList != null))
+ this.rawList.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefix<T> build() {
+ java.util.List<T> 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<T>(this.children));
+ }
+ java.util.Collection<Number> 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<Number>(this.scarves));
+ }
+ java.util.List<java.lang.Object> 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<java.lang.Object>(this.rawList));
+ }
+ return new BuilderSingularListsWithSetterPrefix<T>(children, scarves, rawList);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderSingularListsWithSetterPrefix.BuilderSingularListsWithSetterPrefixBuilder(children=" + this.children) + ", scarves=") + this.scarves) + ", rawList=") + this.rawList) + ")");
+ }
+ }
+ private @Singular List<T> children;
+ private @Singular Collection<? extends Number> scarves;
+ private @SuppressWarnings("all") @Singular("rawList") List rawList;
+ @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefix(final List<T> children, final Collection<? extends Number> scarves, final List rawList) {
+ super();
+ this.children = children;
+ this.scarves = scarves;
+ this.rawList = rawList;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>BuilderSingularListsWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSingularListsWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java
new file mode 100644
index 00000000..7848b154
--- /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 BuilderSingularMapsWithSetterPrefix<K, V> {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsWithSetterPrefixBuilder<K, V> {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<K> women$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<V> women$value;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<K> men$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> men$value;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawMap$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawMap$value;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> stringMap$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<V> stringMap$value;
+ @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withWoman(final K womanKey, final V womanValue) {
+ if ((this.women$key == null))
+ {
+ this.women$key = new java.util.ArrayList<K>();
+ this.women$value = new java.util.ArrayList<V>();
+ }
+ this.women$key.add(womanKey);
+ this.women$value.add(womanValue);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withWomen(final java.util.Map<? extends K, ? extends V> women) {
+ if ((this.women$key == null))
+ {
+ this.women$key = new java.util.ArrayList<K>();
+ this.women$value = new java.util.ArrayList<V>();
+ }
+ for (java.util.Map.Entry<? extends K, ? extends V> $lombokEntry : women.entrySet())
+ {
+ this.women$key.add($lombokEntry.getKey());
+ this.women$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearWomen() {
+ if ((this.women$key != null))
+ {
+ this.women$key.clear();
+ this.women$value.clear();
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withMan(final K manKey, final Number manValue) {
+ if ((this.men$key == null))
+ {
+ this.men$key = new java.util.ArrayList<K>();
+ this.men$value = new java.util.ArrayList<Number>();
+ }
+ this.men$key.add(manKey);
+ this.men$value.add(manValue);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withMen(final java.util.Map<? extends K, ? extends Number> men) {
+ if ((this.men$key == null))
+ {
+ this.men$key = new java.util.ArrayList<K>();
+ this.men$value = new java.util.ArrayList<Number>();
+ }
+ for (java.util.Map.Entry<? extends K, ? extends Number> $lombokEntry : men.entrySet())
+ {
+ this.men$key.add($lombokEntry.getKey());
+ this.men$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearMen() {
+ if ((this.men$key != null))
+ {
+ this.men$key.clear();
+ this.men$value.clear();
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withRawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) {
+ if ((this.rawMap$key == null))
+ {
+ this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
+ this.rawMap$value = new java.util.ArrayList<java.lang.Object>();
+ }
+ this.rawMap$key.add(rawMapKey);
+ this.rawMap$value.add(rawMapValue);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withRawMap(final java.util.Map<?, ?> rawMap) {
+ if ((this.rawMap$key == null))
+ {
+ this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
+ this.rawMap$value = new java.util.ArrayList<java.lang.Object>();
+ }
+ 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") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearRawMap() {
+ if ((this.rawMap$key != null))
+ {
+ this.rawMap$key.clear();
+ this.rawMap$value.clear();
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withStringMap(final String stringMapKey, final V stringMapValue) {
+ if ((this.stringMap$key == null))
+ {
+ this.stringMap$key = new java.util.ArrayList<String>();
+ this.stringMap$value = new java.util.ArrayList<V>();
+ }
+ this.stringMap$key.add(stringMapKey);
+ this.stringMap$value.add(stringMapValue);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> withStringMap(final java.util.Map<? extends String, ? extends V> stringMap) {
+ if ((this.stringMap$key == null))
+ {
+ this.stringMap$key = new java.util.ArrayList<String>();
+ this.stringMap$value = new java.util.ArrayList<V>();
+ }
+ for (java.util.Map.Entry<? extends String, ? extends V> $lombokEntry : stringMap.entrySet())
+ {
+ this.stringMap$key.add($lombokEntry.getKey());
+ this.stringMap$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearStringMap() {
+ if ((this.stringMap$key != null))
+ {
+ this.stringMap$key.clear();
+ this.stringMap$value.clear();
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix<K, V> build() {
+ java.util.Map<K, V> 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<K, V>(((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<K, Number> men = new java.util.TreeMap<K, Number>();
+ 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<java.lang.Object, java.lang.Object> 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<java.lang.Object, java.lang.Object>(((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<String, V> 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<String, V>(((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 BuilderSingularMapsWithSetterPrefix<K, V>(women, men, rawMap, stringMap);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ 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<K, V> women;
+ private @Singular SortedMap<K, ? extends Number> men;
+ private @SuppressWarnings("all") @Singular("rawMap") Map rawMap;
+ private @Singular("stringMap") Map<String, V> stringMap;
+ @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix(final Map<K, V> women, final SortedMap<K, ? extends Number> men, final Map rawMap, final Map<String, V> stringMap) {
+ super();
+ this.women = women;
+ this.men = men;
+ this.rawMap = rawMap;
+ this.stringMap = stringMap;
+ }
+ public static @java.lang.SuppressWarnings("all") <K, V>BuilderSingularMapsWithSetterPrefixBuilder<K, V> builder() {
+ return new BuilderSingularMapsWithSetterPrefixBuilder<K, V>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java
new file mode 100644
index 00000000..f24b1640
--- /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 BuilderSingularNoAutoWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutoWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> things;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> widgets;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
+ @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final String things) {
+ if ((this.things == null))
+ this.things = new java.util.ArrayList<String>();
+ this.things.add(things);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection<? extends String> things) {
+ if ((this.things == null))
+ this.things = new java.util.ArrayList<String>();
+ this.things.addAll(things);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder clearThings() {
+ if ((this.things != null))
+ this.things.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withWidget(final String widget) {
+ if ((this.widgets == null))
+ this.widgets = new java.util.ArrayList<String>();
+ this.widgets.add(widget);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection<? extends String> widgets) {
+ if ((this.widgets == null))
+ this.widgets = new java.util.ArrayList<String>();
+ this.widgets.addAll(widgets);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder clearWidgets() {
+ if ((this.widgets != null))
+ this.widgets.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final String items) {
+ if ((this.items == null))
+ this.items = new java.util.ArrayList<String>();
+ this.items.add(items);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection<? extends String> items) {
+ if ((this.items == null))
+ this.items = new java.util.ArrayList<String>();
+ this.items.addAll(items);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder clearItems() {
+ if ((this.items != null))
+ this.items.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.things));
+ }
+ java.util.List<String> 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<String>(this.widgets));
+ }
+ java.util.List<String> 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<String>(this.items));
+ }
+ return new BuilderSingularNoAutoWithSetterPrefix(things, widgets, items);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder(things=" + this.things) + ", widgets=") + this.widgets) + ", items=") + this.items) + ")");
+ }
+ }
+ private @Singular List<String> things;
+ private @Singular("widget") List<String> widgets;
+ private @Singular List<String> items;
+ @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix(final List<String> things, final List<String> widgets, final List<String> items) {
+ super();
+ this.things = things;
+ this.widgets = widgets;
+ this.items = items;
+ }
+ 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
new file mode 100644
index 00000000..c6e163cb
--- /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 BuilderSingularRedirectToGuavaWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder<String> dangerMice;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys;
+ @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder() {
+ super();
+ }
+ 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDangerMice(final java.lang.Iterable<? extends String> dangerMice) {
+ if ((this.dangerMice == null))
+ this.dangerMice = com.google.common.collect.ImmutableSet.builder();
+ this.dangerMice.addAll(dangerMice);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDangerMice() {
+ this.dangerMice = null;
+ return this;
+ }
+ 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withThings(final java.util.Map<? extends Integer, ? extends Number> things) {
+ if ((this.things == null))
+ this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder();
+ this.things.putAll(things);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearThings() {
+ this.things = null;
+ return this;
+ }
+ 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder withDoohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) {
+ if ((this.doohickeys == null))
+ this.doohickeys = com.google.common.collect.ImmutableList.builder();
+ this.doohickeys.addAll(doohickeys);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDoohickeys() {
+ this.doohickeys = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefix build() {
+ java.util.Set<String> dangerMice = ((this.dangerMice == null) ? com.google.common.collect.ImmutableSet.<String>of() : this.dangerMice.build());
+ java.util.NavigableMap<Integer, Number> things = ((this.things == null) ? com.google.common.collect.ImmutableSortedMap.<Integer, Number>of() : this.things.build());
+ java.util.Collection<Class<?>> doohickeys = ((this.doohickeys == null) ? com.google.common.collect.ImmutableList.<Class<?>>of() : this.doohickeys.build());
+ return new BuilderSingularRedirectToGuavaWithSetterPrefix(dangerMice, things, doohickeys);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderSingularRedirectToGuavaWithSetterPrefix.BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(dangerMice=" + this.dangerMice) + ", things=") + this.things) + ", doohickeys=") + this.doohickeys) + ")");
+ }
+ }
+ private @Singular Set<String> dangerMice;
+ private @Singular NavigableMap<Integer, Number> things;
+ private @Singular Collection<Class<?>> doohickeys;
+ @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefix(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) {
+ super();
+ this.dangerMice = dangerMice;
+ this.things = things;
+ this.doohickeys = doohickeys;
+ }
+ 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
new file mode 100644
index 00000000..905e9190
--- /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 BuilderSingularSetsWithSetterPrefix<T> {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsWithSetterPrefixBuilder<T> {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<T> dangerMice;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> octopodes;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawSet;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> stringSet;
+ @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMouse(final T dangerMouse) {
+ if ((this.dangerMice == null))
+ this.dangerMice = new java.util.ArrayList<T>();
+ this.dangerMice.add(dangerMouse);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMice(final java.util.Collection<? extends T> dangerMice) {
+ if ((this.dangerMice == null))
+ this.dangerMice = new java.util.ArrayList<T>();
+ this.dangerMice.addAll(dangerMice);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearDangerMice() {
+ if ((this.dangerMice != null))
+ this.dangerMice.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopus(final Number octopus) {
+ if ((this.octopodes == null))
+ this.octopodes = new java.util.ArrayList<Number>();
+ this.octopodes.add(octopus);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopodes(final java.util.Collection<? extends Number> octopodes) {
+ if ((this.octopodes == null))
+ this.octopodes = new java.util.ArrayList<Number>();
+ this.octopodes.addAll(octopodes);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearOctopodes() {
+ if ((this.octopodes != null))
+ this.octopodes.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withRawSet(final java.lang.Object rawSet) {
+ if ((this.rawSet == null))
+ this.rawSet = new java.util.ArrayList<java.lang.Object>();
+ this.rawSet.add(rawSet);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withRawSet(final java.util.Collection<?> rawSet) {
+ if ((this.rawSet == null))
+ this.rawSet = new java.util.ArrayList<java.lang.Object>();
+ this.rawSet.addAll(rawSet);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearRawSet() {
+ if ((this.rawSet != null))
+ this.rawSet.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(final String stringSet) {
+ if ((this.stringSet == null))
+ this.stringSet = new java.util.ArrayList<String>();
+ this.stringSet.add(stringSet);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(final java.util.Collection<? extends String> stringSet) {
+ if ((this.stringSet == null))
+ this.stringSet = new java.util.ArrayList<String>();
+ this.stringSet.addAll(stringSet);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearStringSet() {
+ if ((this.stringSet != null))
+ this.stringSet.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix<T> build() {
+ java.util.Set<T> 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<T>(((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<Number> octopodes = new java.util.TreeSet<Number>();
+ if ((this.octopodes != null))
+ octopodes.addAll(this.octopodes);
+ octopodes = java.util.Collections.unmodifiableSortedSet(octopodes);
+ java.util.Set<java.lang.Object> 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<java.lang.Object>(((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<String> 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<String>(((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 BuilderSingularSetsWithSetterPrefix<T>(dangerMice, octopodes, rawSet, stringSet);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((((("BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder(dangerMice=" + this.dangerMice) + ", octopodes=") + this.octopodes) + ", rawSet=") + this.rawSet) + ", stringSet=") + this.stringSet) + ")");
+ }
+ }
+ private @Singular Set<T> dangerMice;
+ private @Singular SortedSet<? extends Number> octopodes;
+ private @SuppressWarnings("all") @Singular("rawSet") Set rawSet;
+ private @Singular("stringSet") Set<String> stringSet;
+ @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) {
+ super();
+ this.dangerMice = dangerMice;
+ this.octopodes = octopodes;
+ this.rawSet = rawSet;
+ this.stringSet = stringSet;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>BuilderSingularSetsWithSetterPrefixBuilder<T> builder() {
+ return new BuilderSingularSetsWithSetterPrefixBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java
new file mode 100644
index 00000000..ef2d02a1
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java
@@ -0,0 +1,60 @@
+import lombok.Singular;
+@lombok.Builder(toBuilder = true,setterPrefix = "with") class BuilderSingularToBuilderWithNullWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> elems;
+ @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElem(final String elem) {
+ if ((this.elems == null))
+ this.elems = new java.util.ArrayList<String>();
+ this.elems.add(elem);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
+ if ((this.elems == null))
+ this.elems = new java.util.ArrayList<String>();
+ this.elems.addAll(elems);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder clearElems() {
+ if ((this.elems != null))
+ this.elems.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.elems));
+ }
+ return new BuilderSingularToBuilderWithNullWithSetterPrefix(elems);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(elems=" + this.elems) + ")");
+ }
+ }
+ private @Singular java.util.List<String> elems;
+ public static void test() {
+ new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder();
+ }
+ @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix(final java.util.List<String> elems) {
+ super();
+ this.elems = elems;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder() {
+ return new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() {
+ final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder();
+ if ((this.elems != null))
+ builder.withElems(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..bbb10087
--- /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 BuilderSingularWildcardListsWithToBuilderWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> objects;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> numbers;
+ @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObject(final java.lang.Object object) {
+ if ((this.objects == null))
+ this.objects = new java.util.ArrayList<java.lang.Object>();
+ this.objects.add(object);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withObjects(final java.util.Collection<?> objects) {
+ if ((this.objects == null))
+ this.objects = new java.util.ArrayList<java.lang.Object>();
+ this.objects.addAll(objects);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearObjects() {
+ if ((this.objects != null))
+ this.objects.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumber(final Number number) {
+ if ((this.numbers == null))
+ this.numbers = new java.util.ArrayList<Number>();
+ this.numbers.add(number);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder withNumbers(final java.util.Collection<? extends Number> numbers) {
+ if ((this.numbers == null))
+ this.numbers = new java.util.ArrayList<Number>();
+ this.numbers.addAll(numbers);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearNumbers() {
+ if ((this.numbers != null))
+ this.numbers.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefix build() {
+ java.util.List<java.lang.Object> 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<java.lang.Object>(this.objects));
+ }
+ java.util.Collection<Number> 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<Number>(this.numbers));
+ }
+ return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(objects, numbers);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((("BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(objects=" + this.objects) + ", numbers=") + this.numbers) + ")");
+ }
+ }
+ private @Singular List<?> objects;
+ private @Singular Collection<? extends Number> numbers;
+ @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(final List<?> objects, final Collection<? extends Number> numbers) {
+ super();
+ this.objects = objects;
+ this.numbers = numbers;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder() {
+ return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() {
+ final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder();
+ 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/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java
new file mode 100644
index 00000000..f3218f27
--- /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 BuilderSingularWithPrefixesWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> elems;
+ @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder withElem(final String elem) {
+ if ((this.elems == null))
+ this.elems = new java.util.ArrayList<String>();
+ this.elems.add(elem);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
+ if ((this.elems == null))
+ this.elems = new java.util.ArrayList<String>();
+ this.elems.addAll(elems);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder clearElems() {
+ if ((this.elems != null))
+ this.elems.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.elems));
+ }
+ return new BuilderSingularWithPrefixesWithSetterPrefix(elems);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems) + ")");
+ }
+ }
+ private @Singular java.util.List<String> _elems;
+ @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix(final java.util.List<String> elems) {
+ super();
+ this._elems = elems;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder builder() {
+ return new BuilderSingularWithPrefixesWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java
new file mode 100644
index 00000000..db44aa12
--- /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 BuilderTypeAnnosWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") List<String> foo;
+ @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder withFoo(final @TA List<String> foo) {
+ this.foo = foo;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix build() {
+ return new BuilderTypeAnnosWithSetterPrefix(foo);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder(foo=" + this.foo) + ")");
+ }
+ }
+ private @TA @TB List<String> foo;
+ @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix(final @TA List<String> foo) {
+ super();
+ this.foo = foo;
+ }
+ 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
new file mode 100644
index 00000000..065c93fe
--- /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 BuilderAndValueWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderAndValueWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefix build() {
+ return new BuilderAndValueWithSetterPrefix();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return "BuilderAndValueWithSetterPrefix.BuilderAndValueWithSetterPrefixBuilder()";
+ }
+ }
+ private final int zero = 0;
+ @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefix() {
+ super();
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefixBuilder builder() {
+ return new BuilderAndValueWithSetterPrefixBuilder();
+ }
+ 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 BuilderAndValueWithSetterPrefix)))
+ return false;
+ final BuilderAndValueWithSetterPrefix other = (BuilderAndValueWithSetterPrefix) 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 (("BuilderAndValueWithSetterPrefix(zero=" + this.getZero()) + ")");
+ }
+}
+@lombok.Builder(setterPrefix = "with") @lombok.Data class BuilderAndDataWithSetterPrefix {
+ public static @java.lang.SuppressWarnings("all") class BuilderAndDataWithSetterPrefixBuilder {
+ @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefix build() {
+ return new BuilderAndDataWithSetterPrefix();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return "BuilderAndDataWithSetterPrefix.BuilderAndDataWithSetterPrefixBuilder()";
+ }
+ }
+ private final int zero = 0;
+ @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefix() {
+ super();
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder builder() {
+ return new BuilderAndDataWithSetterPrefixBuilder();
+ }
+ 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 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;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof BuilderAndDataWithSetterPrefix);
+ }
+ 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 (("BuilderAndDataWithSetterPrefix(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..d9c10e5b
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java
@@ -0,0 +1,47 @@
+@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") BuilderWithAccessorsWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withPlower(final int plower) {
+ this.plower = plower;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withUpper(final int upper) {
+ this.upper = upper;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withFoo(final int foo) {
+ this.foo = foo;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder with_bar(final int _bar) {
+ this._bar = _bar;
+ return this;
+ }
+ 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 (((((((("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") 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") BuilderWithAccessorsWithSetterPrefixBuilder builder() {
+ return new BuilderWithAccessorsWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java
new file mode 100644
index 00000000..248c77ad
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java
@@ -0,0 +1,33 @@
+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") BuilderWithBadNamesWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder withBuild(final String build) {
+ this.build = build;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder withToString(final String toString) {
+ this.toString = toString;
+ return this;
+ }
+ 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 (((("BuilderWithBadNamesWithSetterPrefix.BuilderWithBadNamesWithSetterPrefixBuilder(build=" + this.build) + ", toString=") + this.toString) + ")");
+ }
+ }
+ String build;
+ 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") BuilderWithBadNamesWithSetterPrefixBuilder builder() {
+ return new BuilderWithBadNamesWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java
new file mode 100644
index 00000000..83fa2e4e
--- /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 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<String> strings;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Integer> numbers;
+ @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder() {
+ super();
+ }
+ 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") BuilderWithDeprecatedWithSetterPrefixBuilder withDep2(final int dep2) {
+ this.dep2 = dep2;
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withString(final String string) {
+ if ((this.strings == null))
+ this.strings = new java.util.ArrayList<String>();
+ this.strings.add(string);
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withStrings(final java.util.Collection<? extends String> strings) {
+ if ((this.strings == null))
+ this.strings = new java.util.ArrayList<String>();
+ this.strings.addAll(strings);
+ return this;
+ }
+ 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") 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") BuilderWithDeprecatedWithSetterPrefixBuilder withNumbers(final java.lang.Iterable<? extends Integer> 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") BuilderWithDeprecatedWithSetterPrefixBuilder clearNumbers() {
+ this.numbers = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefix build() {
+ java.util.List<String> 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<String>(this.strings));
+ }
+ com.google.common.collect.ImmutableList<Integer> numbers = ((this.numbers == null) ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build());
+ return new BuilderWithDeprecatedWithSetterPrefix(dep1, dep2, strings, numbers);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ 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<String> strings;
+ @Singular @Deprecated ImmutableList<Integer> numbers;
+ @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefix(final String dep1, final int dep2, final java.util.List<String> strings, final ImmutableList<Integer> numbers) {
+ super();
+ this.dep1 = dep1;
+ this.dep2 = dep2;
+ this.strings = strings;
+ this.numbers = numbers;
+ }
+ 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
new file mode 100644
index 00000000..8da2f012
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java
@@ -0,0 +1,36 @@
+import lombok.Builder;
+class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> {
+ public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z extends Number> {
+ 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") BuilderWithExistingBuilderClassWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg1(final Z arg1) {
+ this.arg1 = arg1;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg3(final String arg3) {
+ this.arg3 = arg3;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> build() {
+ return BuilderWithExistingBuilderClassWithSetterPrefix.<Z>staticMethod(arg1, arg2, arg3);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder(arg1=" + this.arg1) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ")");
+ }
+ }
+ BuilderWithExistingBuilderClassWithSetterPrefix() {
+ super();
+ }
+ public static @Builder(setterPrefix = "with") <Z extends Number>BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) {
+ return null;
+ }
+ public static @java.lang.SuppressWarnings("all") <Z extends Number>BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> builder() {
+ return new BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java
new file mode 100644
index 00000000..30043dd9
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java
@@ -0,0 +1,27 @@
+import lombok.Builder;
+@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") BuilderWithNoBuilderMethodWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder withA(final String a) {
+ this.a = a;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefix build() {
+ return new BuilderWithNoBuilderMethodWithSetterPrefix(a);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderWithNoBuilderMethodWithSetterPrefix.BuilderWithNoBuilderMethodWithSetterPrefixBuilder(a=" + this.a) + ")");
+ }
+ }
+ private String a = "";
+ @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefix(final String a) {
+ super();
+ this.a = 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
new file mode 100644
index 00000000..7f8cb80b
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java
@@ -0,0 +1,34 @@
+@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") BuilderWithNonNullWithSetterPrefixBuilder() {
+ super();
+ }
+ 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");
+ }
+ this.id = id;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefix build() {
+ return new BuilderWithNonNullWithSetterPrefix(id);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder(id=" + this.id) + ")");
+ }
+ }
+ private final @lombok.NonNull String id;
+ @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefix(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") BuilderWithNonNullWithSetterPrefixBuilder builder() {
+ return new BuilderWithNonNullWithSetterPrefixBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java
new file mode 100644
index 00000000..7c5b191d
--- /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 BuilderWithRecursiveGenericsWithSetterPrefix {
+ interface Inter<T, U extends Inter<T, U>> {
+ }
+ public static final @Builder(setterPrefix = "with") @Value class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> {
+ public static @java.lang.SuppressWarnings("all") class TestBuilder<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> {
+ 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<Foo, Bar, Quz> withFoo(final Foo foo) {
+ this.foo = foo;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") TestBuilder<Foo, Bar, Quz> withBar(final Bar bar) {
+ this.bar = bar;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") Test<Foo, Bar, Quz> build() {
+ return new Test<Foo, Bar, Quz>(foo, bar);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((("BuilderWithRecursiveGenericsWithSetterPrefix.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") <Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>>TestBuilder<Foo, Bar, Quz> builder() {
+ return new TestBuilder<Foo, Bar, Quz>();
+ }
+ 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 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;
+ 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 (((("BuilderWithRecursiveGenericsWithSetterPrefix.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")");
+ }
+ }
+ public BuilderWithRecursiveGenericsWithSetterPrefix() {
+ 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..6f3906d9
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java
@@ -0,0 +1,124 @@
+import java.util.List;
+import lombok.Builder;
+@Builder(toBuilder = true,setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilderWithSetterPrefix<T> {
+ public static @java.lang.SuppressWarnings("all") class BuilderWithToBuilderWithSetterPrefixBuilder<T> {
+ 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<T> bars;
+ @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withOne(final String one) {
+ this.one = one;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withTwo(final String two) {
+ this.two = two;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withFoo(final T foo) {
+ this.foo = foo;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withBar(final T bar) {
+ if ((this.bars == null))
+ this.bars = new java.util.ArrayList<T>();
+ this.bars.add(bar);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withBars(final java.util.Collection<? extends T> bars) {
+ if ((this.bars == null))
+ this.bars = new java.util.ArrayList<T>();
+ this.bars.addAll(bars);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> clearBars() {
+ if ((this.bars != null))
+ this.bars.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefix<T> build() {
+ java.util.List<T> 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<T>(this.bars));
+ }
+ return new BuilderWithToBuilderWithSetterPrefix<T>(one, two, foo, bars);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ 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<T> bars;
+ public static <K>K rrr(BuilderWithToBuilderWithSetterPrefix<K> x) {
+ return x.foo;
+ }
+ @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefix(final String one, final String two, final T foo, final List<T> bars) {
+ super();
+ this.mOne = one;
+ this.mTwo = two;
+ this.foo = foo;
+ this.bars = bars;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>BuilderWithToBuilderWithSetterPrefixBuilder<T> builder() {
+ return new BuilderWithToBuilderWithSetterPrefixBuilder<T>();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> toBuilder() {
+ final BuilderWithToBuilderWithSetterPrefixBuilder<T> builder = new BuilderWithToBuilderWithSetterPrefixBuilder<T>().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilderWithSetterPrefix.<T>rrr(this));
+ if ((this.bars != null))
+ builder.withBars(this.bars);
+ return builder;
+ }
+}
+
+@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilderWithSetterPrefix<T> {
+ public static @java.lang.SuppressWarnings("all") class ConstructorWithToBuilderWithSetterPrefixBuilder<T> {
+ private @java.lang.SuppressWarnings("all") String mOne;
+ private @java.lang.SuppressWarnings("all") T baz;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList<T> bars;
+ @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> withMOne(final String mOne) {
+ this.mOne = mOne;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> withBaz(final T baz) {
+ this.baz = baz;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> withBars(final com.google.common.collect.ImmutableList<T> bars) {
+ this.bars = bars;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefix<T> build() {
+ return new ConstructorWithToBuilderWithSetterPrefix<T>(mOne, baz, bars);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ 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<T> bars;
+ public @Builder(toBuilder = true,setterPrefix = "with") ConstructorWithToBuilderWithSetterPrefix(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) {
+ super();
+ }
+ public static @java.lang.SuppressWarnings("all") <T>ConstructorWithToBuilderWithSetterPrefixBuilder<T> builder() {
+ return new ConstructorWithToBuilderWithSetterPrefixBuilder<T>();
+ }
+ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> toBuilder() {
+ return new ConstructorWithToBuilderWithSetterPrefixBuilder<T>().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..6fa302e5
--- /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 BuilderWithTolerateWithSetterPrefix {
+ public static class BuilderWithTolerateWithSetterPrefixBuilder {
+ private @java.lang.SuppressWarnings("all") int value;
+ public @Tolerate BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) {
+ return this.withValue(Integer.parseInt(s));
+ }
+ @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder withValue(final int value) {
+ this.value = value;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefix build() {
+ return new BuilderWithTolerateWithSetterPrefix(value);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderWithTolerateWithSetterPrefix.BuilderWithTolerateWithSetterPrefixBuilder(value=" + this.value) + ")");
+ }
+ }
+ private final int value;
+ public static void main(String[] args) {
+ BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build();
+ }
+ @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefix(final int value) {
+ super();
+ this.value = value;
+ }
+ 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
new file mode 100644
index 00000000..19ab7af1
--- /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 BuilderSimpleWithSetterPrefix<T> {
+ 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..ef8cb2e3
--- /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 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
new file mode 100644
index 00000000..af02adb6
--- /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 BuilderSingularGuavaListsSetsWithSetterPrefix<T> {
+ @Singular private ImmutableList<T> cards;
+ @Singular private ImmutableCollection<? extends Number> frogs;
+ @SuppressWarnings("all") @Singular("rawSet") private ImmutableSet rawSet;
+ @Singular private ImmutableSortedSet<String> passes;
+ @Singular private ImmutableTable<? extends Number, ? extends Number, String> users;
+}
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<K, V> {
+ @Singular private ImmutableMap<K, V> battleaxes;
+ @Singular private ImmutableSortedMap<Integer, ? extends V> 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..fd53d97f
--- /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 BuilderSingularListsWithSetterPrefix<T> {
+ @Singular private List<T> children;
+ @Singular private Collection<? extends Number> 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..728ad59a
--- /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 BuilderSingularMapsWithSetterPrefix<K, V> {
+ @Singular private Map<K, V> women;
+ @Singular private SortedMap<K, ? extends Number> men;
+ @SuppressWarnings("all") @Singular("rawMap") private Map rawMap;
+ @Singular("stringMap") private Map<String, V> stringMap;
+}
diff --git a/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java
new file mode 100644
index 00000000..fa55c553
--- /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 BuilderSingularNoAutoWithSetterPrefix {
+ @Singular private List<String> things;
+ @Singular("widget") private List<String> widgets;
+ @Singular private List<String> items;
+}
diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java
new file mode 100644
index 00000000..7281141d
--- /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 BuilderSingularRedirectToGuavaWithSetterPrefix {
+ @Singular private Set<String> dangerMice;
+ @Singular private NavigableMap<Integer, Number> things;
+ @Singular private Collection<Class<?>> doohickeys;
+}
diff --git a/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java
new file mode 100644
index 00000000..d2824109
--- /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 BuilderSingularSetsWithSetterPrefix<T> {
+ @Singular private Set<T> dangerMice;
+ @Singular private SortedSet<? extends Number> octopodes;
+ @SuppressWarnings("all") @Singular("rawSet") private Set rawSet;
+ @Singular("stringSet") private Set<String> stringSet;
+}
diff --git a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java
new file mode 100644
index 00000000..454cac97
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java
@@ -0,0 +1,10 @@
+import lombok.Singular;
+
+@lombok.Builder(toBuilder = true, setterPrefix = "with")
+class BuilderSingularToBuilderWithNullWithSetterPrefix {
+ @Singular private java.util.List<String> elems;
+
+ public static void test() {
+ new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder();
+ }
+}
diff --git a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java
new file mode 100644
index 00000000..cea10bab
--- /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 BuilderSingularWildcardListsWithToBuilderWithSetterPrefix {
+ @Singular private List<?> objects;
+ @Singular private Collection<? extends Number> numbers;
+}
diff --git a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java
new file mode 100644
index 00000000..1b953668
--- /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 BuilderSingularWithPrefixesWithSetterPrefix {
+ @Singular private java.util.List<String> _elems;
+}
diff --git a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java
new file mode 100644
index 00000000..4adde2a0
--- /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 BuilderTypeAnnosWithSetterPrefix {
+ private @TA @TB List<String> foo;
+}
diff --git a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java
new file mode 100644
index 00000000..530c24d2
--- /dev/null
+++ b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java
@@ -0,0 +1,11 @@
+import java.util.List;
+
+@lombok.Builder(setterPrefix = "with") @lombok.Value
+class BuilderAndValueWithSetterPrefix {
+ private final int zero = 0;
+}
+
+@lombok.Builder(setterPrefix = "with") @lombok.Data
+class BuilderAndDataWithSetterPrefix {
+ 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..4f4ebb18
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java
@@ -0,0 +1,7 @@
+@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix={"p", "_"})
+class BuilderWithAccessorsWithSetterPrefix {
+ 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..69322ee3
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java
@@ -0,0 +1,5 @@
+@lombok.Builder(setterPrefix = "with")
+public class BuilderWithBadNamesWithSetterPrefix {
+ 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..77baccd3
--- /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 BuilderWithDeprecatedWithSetterPrefix {
+ /** @deprecated since always */ String dep1;
+ @Deprecated int dep2;
+ @Singular @Deprecated java.util.List<String> strings;
+ @Singular @Deprecated ImmutableList<Integer> numbers;
+}
diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java
new file mode 100644
index 00000000..e30dd1ff
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java
@@ -0,0 +1,15 @@
+import lombok.Builder;
+
+class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> {
+ @Builder(setterPrefix = "with")
+ public static <Z extends Number> BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) {
+ return null;
+ }
+
+ public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z extends Number> {
+ 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..80197dd3
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java
@@ -0,0 +1,5 @@
+import lombok.Builder;
+@Builder(toBuilder = true, builderMethodName = "",setterPrefix = "with")
+class BuilderWithNoBuilderMethodWithSetterPrefix {
+ 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..8ef1f70e
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java
@@ -0,0 +1,5 @@
+@lombok.Builder(setterPrefix = "with")
+class BuilderWithNonNullWithSetterPrefix {
+ @lombok.NonNull
+ private final String id;
+}
diff --git a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java
new file mode 100644
index 00000000..ce8803c0
--- /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 BuilderWithRecursiveGenericsWithSetterPrefix {
+ interface Inter<T, U extends Inter<T, U>> {}
+
+ @Builder(setterPrefix = "with") @Value public static class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> {
+ 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..3b442b8d
--- /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 BuilderWithToBuilderWithSetterPrefix<T> {
+ private String mOne, mTwo;
+ @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo;
+ @lombok.Singular private List<T> bars;
+ public static <K> K rrr(BuilderWithToBuilderWithSetterPrefix<K> x) {
+ return x.foo;
+ }
+}
+@lombok.experimental.Accessors(prefix = "m")
+class ConstructorWithToBuilderWithSetterPrefix<T> {
+ private String mOne, mTwo;
+ private T foo;
+ @lombok.Singular private com.google.common.collect.ImmutableList<T> bars;
+ @Builder(toBuilder = true, setterPrefix = "with")
+ public ConstructorWithToBuilderWithSetterPrefix(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) {
+ }
+}
diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java
new file mode 100644
index 00000000..5c77e177
--- /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 BuilderWithTolerateWithSetterPrefix {
+ private final int value;
+
+ public static void main(String[] args) {
+ BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build();
+ }
+
+ public static class BuilderWithTolerateWithSetterPrefixBuilder {
+ @Tolerate
+ public BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) {
+ return this.withValue(Integer.parseInt(s));
+ }
+ }
+}
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.
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.
diff --git a/website/templates/features/Builder.html b/website/templates/features/Builder.html
index d22877ea..08ff1ec8 100644
--- a/website/templates/features/Builder.html
+++ b/website/templates/features/Builder.html
@@ -68,10 +68,12 @@
If you want <code>toBuilder()</code> (default: no)
</li><li>
The access level of all generated elements (default: <code>public</code>).
+ </li><li>
+ (discouraged) If you want your builder's 'set' methods to have a prefix, i.e. <code>Person.builder().setName("Jane").build()</code> instead of <code>Person.builder().name("Jane").build()</code> and what it should be.
</li>
</ul>
Example usage where all options are changed from their defaults:<br />
- <code>@Builder(builderClassName = "HelloWorldBuilder", buildMethodName = "execute", builderMethodName = "helloWorld", toBuilder = true, access = AccessLevel.PRIVATE)</code><br />
+ <code>@Builder(builderClassName = "HelloWorldBuilder", buildMethodName = "execute", builderMethodName = "helloWorld", toBuilder = true, access = AccessLevel.PRIVATE, setterPrefix = "set")</code><br />
</p>
</@f.overview>
@@ -132,6 +134,8 @@
If lombok cannot singularize your identifier, or it is ambiguous, lombok will generate an error and force you to explicitly specify the singular name.
</p><p>
The snippet below does not show what lombok generates for a <code>@Singular</code> field/parameter because it is rather complicated. You can view a snippet <a href="builderSingular">here</a>.
+ </p><p>
+ If also using <code>setterPrefix = "with"</code>, the generated names are, for example, <code>withName</code> (add 1 name), <code>withNames</code> (add many names), and <code>clearNames</code> (reset all names).
</p>
</@f.featureSection>
diff --git a/website/templates/order-license-info.html b/website/templates/order-license-info.html
index f5839c0a..46dafd66 100644
--- a/website/templates/order-license-info.html
+++ b/website/templates/order-license-info.html
@@ -9,7 +9,7 @@
<p>
Tidelift offers professional support of open source tools. When you have a Tidelift subscription, they will help you inventory all the various open source tools and libraries you use, give one central location to check compliance, and a single channel for release notes and security advisories. The bulk of the tidelift subscription fee is redistributed to major open source projects, and Project Lombok is one of those 'lifted' projects. Therefore, your Tidelift subscription helps maintain Project Lombok!
</p><p>
- We recommend a <a class="tidelift-link-inline" href="https://tidelift.com/subscription/pkg/maven-org-projectlombok-lombok?utm_source=lombok&utm_medium=referral&utm_campaign=orderdonate">Tidelift subscription</a> to any corporation that uses Project Lombok.
+ We recommend a <a class="tidelift-link-inline" href="https://tidelift.com/subscription/pkg/maven-org-projectlombok-lombok?utm_source=maven-org-projectlombok-lombok&utm_medium=referral&utm_campaign=orderdonate">Tidelift subscription</a> to any corporation that uses Project Lombok.
</div>
<div class="row text-center">
<h2>Order a professional or enterprise license</h2>
diff --git a/website/templates/setup/javac.html b/website/templates/setup/javac.html
index 48b0ebcf..96bd8c2b 100644
--- a/website/templates/setup/javac.html
+++ b/website/templates/setup/javac.html
@@ -11,15 +11,13 @@
<p>
Support for JDK9, if you haven't modularized your own projects yet (no <code>module-info.java</code> yet), is included in lombok starting with version 1.16.20. Just use lombok as normal: <code> javac -cp lombok.jar ...</code>
</p><p>
- Support for JDK9 if you did modularize your own projects (you've written a <code>module-info.java</code> file) is available in the <a href="/download-edge">edge release</a>. To use it: <code>javac -cp lombok.jar -p lombok.jar ...</code><br />
+ Support for JDK9 if you did modularize your own projects (you've written a <code>module-info.java</code> file):<br /><code>javac -cp lombok.jar -p lombok.jar ...</code><br />
Note that you will have to add lombok to your <code>module-info.java</code> file:<pre>
module <em>myapp</em> {
requires static lombok;
}</pre>
</p><p>
The 'static' part ensures that you won't need lombok to be present at runtime.
- </p><p>
- Feedback about JDK9 module-info support can be given at <a href="https://github.com/rzwitserloot/lombok/issues/985">github issue #985</a>.
</p>
</@s.section>
</@s.scaffold>
diff --git a/website/templates/tidelift.html b/website/templates/tidelift.html
index 7f0ab88b..3d020d7a 100644
--- a/website/templates/tidelift.html
+++ b/website/templates/tidelift.html
@@ -14,7 +14,7 @@
</p>
</div>
<div class="row text-center">
- <a class="tideliftb tideliftb1" href="https://tidelift.com/subscription/pkg/maven-org-projectlombok-lombok?utm_source=lombok&utm_medium=referral&utm_campaign=enterprise">LEARN MORE</a> <a class="tideliftb tideliftb2" href="https://tidelift.com/subscription/request-a-demo?utm_source=lombok&utm_medium=referral&utm_campaign=enterprise">REQUEST A DEMO</a>
+ <a class="tideliftb tideliftb1" href="https://tidelift.com/subscription/pkg/maven-org-projectlombok-lombok?utm_source=maven-org-projectlombok-lombok&utm_medium=referral&utm_campaign=enterprise">LEARN MORE</a> <a class="tideliftb tideliftb2" href="https://tidelift.com/subscription/request-a-demo?utm_source=maven-org-projectlombok-lombok&utm_medium=referral&utm_campaign=enterprise">REQUEST A DEMO</a>
</div>
<div class="row text-center">
<h2>The Tidelift Subscription manages your dependencies for you</h2>
diff --git a/website/usageExamples/ToStringExample_post.jpage b/website/usageExamples/ToStringExample_post.jpage
index 67e78f20..9e41b26b 100644
--- a/website/usageExamples/ToStringExample_post.jpage
+++ b/website/usageExamples/ToStringExample_post.jpage
@@ -8,7 +8,7 @@ public class ToStringExample {
private int id;
public String getName() {
- return this.getName();
+ return this.name;
}
public static class Square extends Shape {