mirror of
https://github.com/tiennm99/lombok.git
synced 2026-08-21 08:26:37 +00:00
Fix more copy/paste test errors
This commit is contained in:
@@ -326,9 +326,10 @@ public class JavacSingularsRecipes {
|
||||
private void generatePluralMethod(CheckerFrameworkVersion cfv, boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent, AccessLevel access) {
|
||||
ListBuffer<JCStatement> statements = generatePluralMethodStatements(maker, data, builderType, source);
|
||||
Name name = data.getPluralName();
|
||||
Name prefixedSingularName = builderType.toName(data.getSetterPrefix());
|
||||
name = fluent ? prefixedSingularName : builderType.toName(HandlerUtil.buildAccessorName(
|
||||
getAddMethodName() + "All", name.toString()));
|
||||
|
||||
Name prefixedSingularName = data.getSetterPrefix().isEmpty() ? name : builderType.toName(HandlerUtil.buildAccessorName(data.getSetterPrefix(), data.getPluralName().toString()));
|
||||
name = fluent ? prefixedSingularName
|
||||
: builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName() + "All", name.toString()));
|
||||
JCExpression paramType = getPluralMethodParamType(builderType);
|
||||
paramType = addTypeArgs(getTypeArgumentsCount(), true, builderType, paramType, data.getTypeArgs(), source);
|
||||
long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext());
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
+21
-21
@@ -1,20 +1,20 @@
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
class BuilderSingularSets<T> {
|
||||
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")
|
||||
BuilderSingularSets(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) {
|
||||
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 BuilderSingularSetsBuilder<T> {
|
||||
public static class BuilderSingularSetsWithSetterPrefixBuilder<T> {
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private java.util.ArrayList<T> dangerMice;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@@ -24,78 +24,78 @@ class BuilderSingularSets<T> {
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private java.util.ArrayList<String> stringSet;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
BuilderSingularSetsBuilder() {
|
||||
BuilderSingularSetsWithSetterPrefixBuilder() {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsBuilder<T> withDangerMouse(final T dangerMouse) {
|
||||
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 BuilderSingularSetsBuilder<T> withDangerMice(final java.util.Collection<? extends T> dangerMice) {
|
||||
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 BuilderSingularSetsBuilder<T> clearDangerMice() {
|
||||
public BuilderSingularSetsWithSetterPrefixBuilder<T> clearDangerMice() {
|
||||
if (this.dangerMice != null) this.dangerMice.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsBuilder<T> withOctopus(final Number octopus) {
|
||||
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 BuilderSingularSetsBuilder<T> withOctopodes(final java.util.Collection<? extends Number> octopodes) {
|
||||
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 BuilderSingularSetsBuilder<T> clearOctopodes() {
|
||||
public BuilderSingularSetsWithSetterPrefixBuilder<T> clearOctopodes() {
|
||||
if (this.octopodes != null) this.octopodes.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsBuilder<T> withRawSet(final java.lang.Object rawSet) {
|
||||
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 BuilderSingularSetsBuilder<T> withRawSet(final java.util.Collection<?> rawSet) {
|
||||
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 BuilderSingularSetsBuilder<T> clearRawSet() {
|
||||
public BuilderSingularSetsWithSetterPrefixBuilder<T> clearRawSet() {
|
||||
if (this.rawSet != null) this.rawSet.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsBuilder<T> withStringSet(final String stringSet) {
|
||||
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 BuilderSingularSetsBuilder<T> withStringSet(final java.util.Collection<? extends String> stringSet) {
|
||||
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 BuilderSingularSetsBuilder<T> clearStringSet() {
|
||||
public BuilderSingularSetsWithSetterPrefixBuilder<T> clearStringSet() {
|
||||
if (this.stringSet != null) this.stringSet.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSets<T> build() {
|
||||
public BuilderSingularSetsWithSetterPrefix<T> build() {
|
||||
java.util.Set<T> dangerMice;
|
||||
switch (this.dangerMice == null ? 0 : this.dangerMice.size()) {
|
||||
case 0:
|
||||
@@ -138,16 +138,16 @@ class BuilderSingularSets<T> {
|
||||
stringSet.addAll(this.stringSet);
|
||||
stringSet = java.util.Collections.unmodifiableSet(stringSet);
|
||||
}
|
||||
return new BuilderSingularSets<T>(dangerMice, octopodes, rawSet, stringSet);
|
||||
return new BuilderSingularSetsWithSetterPrefix<T>(dangerMice, octopodes, rawSet, stringSet);
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public java.lang.String toString() {
|
||||
return "BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")";
|
||||
return "BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")";
|
||||
}
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public static <T> BuilderSingularSetsBuilder<T> builder() {
|
||||
return new BuilderSingularSetsBuilder<T>();
|
||||
public static <T> BuilderSingularSetsWithSetterPrefixBuilder<T> builder() {
|
||||
return new BuilderSingularSetsWithSetterPrefixBuilder<T>();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import java.util.List;
|
||||
@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BulderSimpleWithSetterPrefix<T> {
|
||||
@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderSimpleWithSetterPrefix<T> {
|
||||
protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefix<T> {
|
||||
private @java.lang.SuppressWarnings("all") int unprefixed;
|
||||
@java.lang.SuppressWarnings("all") BuilderWithPrefixBuilder() {
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@ class BuilderSingularToBuilderWithNullWithSetterPrefix {
|
||||
@Singular private java.util.List<String> elems;
|
||||
|
||||
public static void test() {
|
||||
new BuilderSingularToBuilderWithNull(null).toBuilder();
|
||||
new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder();
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -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.
|
||||
Reference in New Issue
Block a user