mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-16 10:15:22 +00:00
[singular][issue #2221] the plural builder method now nullchecks its argument with configurable results.
This commit is contained in:
79 files changed
+841
-114
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2019 The Project Lombok Authors.
|
||||
* Copyright (C) 2013-2020 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
|
||||
@@ -23,12 +23,13 @@ package lombok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.core.configuration.CallSuperType;
|
||||
import lombok.core.configuration.CheckerFrameworkVersion;
|
||||
import lombok.core.configuration.ConfigurationKey;
|
||||
import lombok.core.configuration.LogDeclaration;
|
||||
import lombok.core.configuration.FlagUsageType;
|
||||
import lombok.core.configuration.IdentifierName;
|
||||
import lombok.core.configuration.LogDeclaration;
|
||||
import lombok.core.configuration.NullCheckExceptionType;
|
||||
import lombok.core.configuration.TypeName;
|
||||
|
||||
@@ -287,7 +288,19 @@ public class ConfigurationKeys {
|
||||
*
|
||||
* By default or if explicitly set to {@code true}, lombok will attempt to automatically singularize the name of your variable/parameter when using {@code @Singular}; the name is assumed to be written in english, and a plural. If explicitly to {@code false}, you must always specify the singular form; this is especially useful if your identifiers are in a foreign language.
|
||||
*/
|
||||
public static final ConfigurationKey<Boolean> SINGULAR_AUTO = new ConfigurationKey<Boolean>("lombok.singular.auto", "If true (default): Automatically singularize the assumed-to-be-plural name of your variable/parameter when using {@code @Singular}.") {};
|
||||
public static final ConfigurationKey<Boolean> SINGULAR_AUTO = new ConfigurationKey<Boolean>("lombok.singular.auto", "If true (default): Automatically singularize the assumed-to-be-plural name of your variable/parameter when using @Singular.") {};
|
||||
|
||||
/**
|
||||
* lombok configuration: {@code lombok.singular.nullCollections} = one of: [{@code NullPointerException}, {@code IllegalArgumentException}, {@code JDK}, {@code Guava}, or {@code ignore}].
|
||||
*
|
||||
* Lombok generates a 'plural form' method, which takes in a collection and will <em>add</em> each element in it to the {@code @Singular} marked target. What should happen if {@code null} is passed instead of a collection instance?<ul>
|
||||
* <li>If the chosen configuration is {@code NullPointerException} (the default), or {@code IllegalArgumentException}, that exception type is a thrown, with as message <code><em>field-name</em> must not be null</code>.</li>
|
||||
* <li>If the chosen configuration is {@code JDK}, a call to {@code java.util.Objects.requireNonNull} is generated with the fieldname passed along (which throws {@code NullPointerException}).</li>
|
||||
* <li>If the chosen configuration is {@code Guava}, a call to {@code com.google.common.base.Preconditions.checkNotNull} is generated with the fieldname passed along (which throws {@code NullPointerException}).</li>
|
||||
* <li>If the chosen configuration is {@code Ignore}, then no exception occurs, and the call does nothing; it acts as if an empty collection was passed.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final ConfigurationKey<NullCollectionBehavior> SINGULAR_NULL_COLLECTIONS = new ConfigurationKey<NullCollectionBehavior>("lombok.singular.nullCollections", "Lombok generates a method to add all elements in a collection when using @Singular. What should happen if a null ref is passed? default: throw NullPointerException.") {};
|
||||
|
||||
// ##### Standalones #####
|
||||
|
||||
@@ -312,10 +325,14 @@ public class ConfigurationKeys {
|
||||
// ----- NonNull -----
|
||||
|
||||
/**
|
||||
* lombok configuration: {@code lombok.nonNull.exceptionType} = one of: [{@code IllegalArgumentException}, {@code NullPointerException}, or {@code Assertion}].
|
||||
* lombok configuration: {@code lombok.nonNull.exceptionType} = one of: [{@code IllegalArgumentException}, {@code NullPointerException}, {@code JDK}, {@code Guava}, or {@code Assertion}].
|
||||
*
|
||||
* Sets the exception to throw if {@code @NonNull} is applied to a method parameter, and a caller passes in {@code null}. If the chosen configuration is {@code Assertion}, an assertion is generated instead,
|
||||
* which would mean your code throws an {@code AssertionError} if assertions are enabled, and does nothing if assertions are not enabled.
|
||||
* Sets the behavior of the generated nullcheck if {@code @NonNull} is applied to a method parameter, and a caller passes in {@code null}.<ul>
|
||||
* <li>If the chosen configuration is {@code NullPointerException} (the default), or {@code IllegalArgumentException}, that exception type is a thrown, with as message <code><em>field-name</em> is marked non-null but is null</code>.</li>
|
||||
* <li>If the chosen configuration is {@code Assert}, then an {@code assert} statement is generated. This means an {@code AssertionError} will be thrown if assertions are on (VM started with {@code -ea} parameter), and nothing happens if not.</li>
|
||||
* <li>If the chosen configuration is {@code JDK}, a call to {@code java.util.Objects.requireNonNull} is generated with the fieldname passed along (which throws {@code NullPointerException}).</li>
|
||||
* <li>If the chosen configuration is {@code Guava}, a call to {@code com.google.common.base.Preconditions.checkNotNull} is generated with the fieldname passed along (which throws {@code NullPointerException}).</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final ConfigurationKey<NullCheckExceptionType> NON_NULL_EXCEPTION_TYPE = new ConfigurationKey<NullCheckExceptionType>("lombok.nonNull.exceptionType", "The type of the exception to throw if a passed-in argument is null (Default: NullPointerException).") {};
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ import static java.lang.annotation.RetentionPolicy.*;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import lombok.core.LombokImmutableList;
|
||||
import lombok.core.configuration.ExampleValueString;
|
||||
import lombok.core.configuration.NullCheckExceptionType;
|
||||
|
||||
/**
|
||||
* The singular annotation is used together with {@code @Builder} to create single element 'add' methods in the builder for collections.
|
||||
*/
|
||||
@@ -35,4 +39,64 @@ import java.lang.annotation.Target;
|
||||
public @interface Singular {
|
||||
/** @return The singular name of this field. If it's a normal english plural, lombok will figure it out automatically. Otherwise, this parameter is mandatory. */
|
||||
String value() default "";
|
||||
|
||||
NullCollectionBehavior nullBehavior() default NullCollectionBehavior.NULL_POINTER_EXCEPTION;
|
||||
|
||||
@ExampleValueString("[NullPointerException | IllegalArgumentException | JDK | Guava | Ignore]")
|
||||
public enum NullCollectionBehavior {
|
||||
ILLEGAL_ARGUMENT_EXCEPTION {
|
||||
@Override public String getExceptionType() {
|
||||
return NullCheckExceptionType.ILLEGAL_ARGUMENT_EXCEPTION.getExceptionType();
|
||||
}
|
||||
|
||||
@Override public LombokImmutableList<String> getMethod() {
|
||||
return NullCheckExceptionType.ILLEGAL_ARGUMENT_EXCEPTION.getMethod();
|
||||
}
|
||||
},
|
||||
NULL_POINTER_EXCEPTION {
|
||||
@Override public String getExceptionType() {
|
||||
return NullCheckExceptionType.NULL_POINTER_EXCEPTION.getExceptionType();
|
||||
}
|
||||
|
||||
@Override public LombokImmutableList<String> getMethod() {
|
||||
return NullCheckExceptionType.NULL_POINTER_EXCEPTION.getMethod();
|
||||
}
|
||||
},
|
||||
JDK {
|
||||
@Override public String getExceptionType() {
|
||||
return NullCheckExceptionType.JDK.getExceptionType();
|
||||
}
|
||||
|
||||
@Override public LombokImmutableList<String> getMethod() {
|
||||
return NullCheckExceptionType.JDK.getMethod();
|
||||
}
|
||||
},
|
||||
GUAVA {
|
||||
@Override public String getExceptionType() {
|
||||
return NullCheckExceptionType.GUAVA.getExceptionType();
|
||||
}
|
||||
|
||||
@Override public LombokImmutableList<String> getMethod() {
|
||||
return NullCheckExceptionType.GUAVA.getMethod();
|
||||
}
|
||||
},
|
||||
IGNORE {
|
||||
@Override public String getExceptionType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public LombokImmutableList<String> getMethod() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public String toExceptionMessage(String fieldName) {
|
||||
return fieldName + " cannot be null";
|
||||
}
|
||||
|
||||
public abstract String getExceptionType();
|
||||
|
||||
public abstract LombokImmutableList<String> getMethod();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2019 The Project Lombok Authors.
|
||||
* Copyright (C) 2014-2020 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
|
||||
@@ -23,7 +23,7 @@ package lombok.core.configuration;
|
||||
|
||||
import lombok.core.LombokImmutableList;
|
||||
|
||||
@ExampleValueString("[NullPointerException | IllegalArgumentException | Assertion | JDK | GUAVA]")
|
||||
@ExampleValueString("[NullPointerException | IllegalArgumentException | Assertion | JDK | Guava]")
|
||||
public enum NullCheckExceptionType {
|
||||
ILLEGAL_ARGUMENT_EXCEPTION {
|
||||
@Override public String getExceptionType() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2018 The Project Lombok Authors.
|
||||
* Copyright (C) 2013-2020 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
|
||||
@@ -451,11 +451,6 @@ public class HandlerUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* NB: 'notnull' is not part of the pattern because there are lots of @NotNull annotations out there that are crappily named and actually mean
|
||||
something else, such as 'this field must not be null _when saved to the db_ but its perfectly okay to start out as such, and a no-args
|
||||
constructor and the implied starts-out-as-null state that goes with it is in fact mandatory' which happens with javax.validation.constraints.NotNull.
|
||||
Various problems with spring have also been reported. See issue #287, issue #271, and issue #43. */
|
||||
|
||||
public static final String DEFAULT_EXCEPTION_FOR_NON_NULL = "java.lang.NullPointerException";
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,25 +33,31 @@ import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
|
||||
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
|
||||
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
|
||||
import org.eclipse.jdt.internal.compiler.ast.Annotation;
|
||||
import org.eclipse.jdt.internal.compiler.ast.Block;
|
||||
import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
|
||||
import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
|
||||
import org.eclipse.jdt.internal.compiler.ast.Expression;
|
||||
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
|
||||
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.IfStatement;
|
||||
import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
|
||||
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
|
||||
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
|
||||
import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
|
||||
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.Reference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
|
||||
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.Statement;
|
||||
import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
|
||||
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
|
||||
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
|
||||
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
|
||||
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
|
||||
@@ -60,10 +66,12 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
|
||||
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.core.LombokImmutableList;
|
||||
import lombok.core.SpiLoadUtil;
|
||||
import lombok.core.TypeLibrary;
|
||||
import lombok.core.configuration.CheckerFrameworkVersion;
|
||||
import lombok.eclipse.Eclipse;
|
||||
import lombok.eclipse.EclipseNode;
|
||||
|
||||
public class EclipseSingularsRecipes {
|
||||
@@ -126,13 +134,14 @@ public class EclipseSingularsRecipes {
|
||||
private final List<TypeReference> typeArgs;
|
||||
private final String targetFqn;
|
||||
private final EclipseSingularizer singularizer;
|
||||
private final NullCollectionBehavior nullCollectionBehavior;
|
||||
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, NullCollectionBehavior nullCollectionBehavior) {
|
||||
this(annotation, singularName, pluralName, typeArgs, targetFqn, singularizer, source, nullCollectionBehavior, new char[0]);
|
||||
}
|
||||
|
||||
public SingularData(EclipseNode annotation, char[] singularName, char[] pluralName, List<TypeReference> typeArgs, String targetFqn, EclipseSingularizer singularizer, ASTNode source, char[] setterPrefix) {
|
||||
public SingularData(EclipseNode annotation, char[] singularName, char[] pluralName, List<TypeReference> typeArgs, String targetFqn, EclipseSingularizer singularizer, ASTNode source, NullCollectionBehavior nullCollectionBehavior, char[] setterPrefix) {
|
||||
this.annotation = annotation;
|
||||
this.singularName = singularName;
|
||||
this.pluralName = pluralName;
|
||||
@@ -140,6 +149,7 @@ public class EclipseSingularsRecipes {
|
||||
this.targetFqn = targetFqn;
|
||||
this.singularizer = singularizer;
|
||||
this.source = source;
|
||||
this.nullCollectionBehavior = nullCollectionBehavior;
|
||||
this.setterPrefix = setterPrefix;
|
||||
}
|
||||
|
||||
@@ -187,6 +197,10 @@ public class EclipseSingularsRecipes {
|
||||
return singularizer;
|
||||
}
|
||||
|
||||
public NullCollectionBehavior getNullCollectionBehavior() {
|
||||
return nullCollectionBehavior;
|
||||
}
|
||||
|
||||
public String getTargetSimpleType() {
|
||||
int idx = targetFqn.lastIndexOf(".");
|
||||
return idx == -1 ? targetFqn : targetFqn.substring(idx + 1);
|
||||
@@ -423,6 +437,45 @@ public class EclipseSingularsRecipes {
|
||||
}
|
||||
}
|
||||
|
||||
protected void nullBehaviorize(SingularData data, List<Statement> statements) {
|
||||
NullCollectionBehavior behavior = data.getNullCollectionBehavior();
|
||||
|
||||
if (behavior == NullCollectionBehavior.IGNORE) {
|
||||
Expression isNotNull = new EqualExpression(new SingleNameReference(data.getPluralName(), 0L), new NullLiteral(0, 0), OperatorIds.NOT_EQUAL);
|
||||
Block b = new Block(0);
|
||||
b.statements = statements.toArray(new Statement[statements.size()]);
|
||||
statements.clear();
|
||||
statements.add(new IfStatement(isNotNull, b, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
String exceptionTypeStr = behavior.getExceptionType();
|
||||
StringLiteral message = new StringLiteral(behavior.toExceptionMessage(new String(data.getPluralName())).toCharArray(), 0, 0, 0);
|
||||
if (exceptionTypeStr != null) {
|
||||
Expression isNull = new EqualExpression(new SingleNameReference(data.getPluralName(), 0L), new NullLiteral(0, 0), OperatorIds.EQUAL_EQUAL);
|
||||
int partCount = 1;
|
||||
for (int i = 0; i < exceptionTypeStr.length(); i++) if (exceptionTypeStr.charAt(i) == '.') partCount++;
|
||||
long[] ps = new long[partCount];
|
||||
Arrays.fill(ps, 0L);
|
||||
AllocationExpression alloc = new AllocationExpression();
|
||||
alloc.type = new QualifiedTypeReference(Eclipse.fromQualifiedName(exceptionTypeStr), ps);
|
||||
alloc.arguments = new Expression[] {message};
|
||||
Statement t = new ThrowStatement(alloc, 0, 0);
|
||||
statements.add(0, new IfStatement(isNull, t, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
MessageSend invoke = new MessageSend();
|
||||
LombokImmutableList<String> method = behavior.getMethod();
|
||||
char[][] utilityTypeName = new char[method.size() - 1][];
|
||||
for (int i = 0; i < method.size() - 1; i++) utilityTypeName[i] = method.get(i).toCharArray();
|
||||
|
||||
invoke.receiver = new QualifiedNameReference(utilityTypeName, new long[method.size() - 1], 0, 0);
|
||||
invoke.selector = method.get(method.size() - 1).toCharArray();
|
||||
invoke.arguments = new Expression[] {new SingleNameReference(data.getPluralName(), 0L), message};
|
||||
statements.add(0, invoke);
|
||||
}
|
||||
|
||||
protected abstract char[][] getEmptyMakerReceiver(String targetFqn);
|
||||
protected abstract char[] getEmptyMakerSelector(String targetFqn);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ import org.mangosdk.spi.ProviderFor;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Builder.ObtainVia;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.ConfigurationKeys;
|
||||
import lombok.Singular;
|
||||
import lombok.ToString;
|
||||
@@ -992,7 +993,8 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
|
||||
if (!annotationTypeMatches(Singular.class, child)) continue;
|
||||
char[] pluralName = node.getKind() == Kind.FIELD ? removePrefixFromField(node) : ((AbstractVariableDeclaration) node.get()).name;
|
||||
AnnotationValues<Singular> ann = createAnnotation(Singular.class, child);
|
||||
String explicitSingular = ann.getInstance().value();
|
||||
Singular singularInstance = ann.getInstance();
|
||||
String explicitSingular = singularInstance.value();
|
||||
if (explicitSingular.isEmpty()) {
|
||||
if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.SINGULAR_AUTO))) {
|
||||
node.addError("The singular must be specified explicitly (e.g. @Singular(\"task\")) because auto singularization is disabled.");
|
||||
@@ -1034,9 +1036,21 @@ 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, setterPrefix.toCharArray());
|
||||
NullCollectionBehavior behavior = getNullBehaviorFor(ann, singularInstance, node);
|
||||
return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.<TypeReference>emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source, behavior, setterPrefix.toCharArray());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static NullCollectionBehavior getNullBehaviorFor(AnnotationValues<Singular> ann, Singular singularInstance, EclipseNode node) {
|
||||
NullCollectionBehavior behavior;
|
||||
if (ann.isExplicit("nullBehavior")) {
|
||||
behavior = singularInstance.nullBehavior();
|
||||
} else {
|
||||
behavior = node.getAst().readConfiguration(ConfigurationKeys.SINGULAR_NULL_COLLECTIONS);
|
||||
}
|
||||
if (behavior == null) return NullCollectionBehavior.NULL_POINTER_EXCEPTION;
|
||||
return behavior;
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@ import org.mangosdk.spi.ProviderFor;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Builder.ObtainVia;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.ConfigurationKeys;
|
||||
import lombok.Singular;
|
||||
import lombok.ToString;
|
||||
@@ -1000,7 +1001,8 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
|
||||
|
||||
char[] pluralName = node.getKind() == Kind.FIELD ? removePrefixFromField(node) : ((AbstractVariableDeclaration) node.get()).name;
|
||||
AnnotationValues<Singular> ann = createAnnotation(Singular.class, child);
|
||||
String explicitSingular = ann.getInstance().value();
|
||||
Singular singularInstance = ann.getInstance();
|
||||
String explicitSingular = singularInstance.value();
|
||||
if (explicitSingular.isEmpty()) {
|
||||
if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.SINGULAR_AUTO))) {
|
||||
node.addError("The singular must be specified explicitly (e.g. @Singular(\"task\")) because auto singularization is disabled.");
|
||||
@@ -1042,7 +1044,8 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.<TypeReference>emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source);
|
||||
NullCollectionBehavior behavior = HandleBuilder.getNullBehaviorFor(ann, singularInstance, node);
|
||||
return new SingularData(child, singularName, pluralName, typeArgs == null ? Collections.<TypeReference>emptyList() : Arrays.asList(typeArgs), targetFqn, singularizer, source, behavior);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2019 The Project Lombok Authors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -195,6 +195,9 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer {
|
||||
thisDotFieldDotAddAll.receiver = thisDotField;
|
||||
thisDotFieldDotAddAll.selector = (getAddMethodName() + "All").toCharArray();
|
||||
statements.add(thisDotFieldDotAddAll);
|
||||
|
||||
nullBehaviorize(data, statements);
|
||||
|
||||
if (returnStatement != null) statements.add(returnStatement);
|
||||
|
||||
md.statements = statements.toArray(new Statement[0]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2019 The Project Lombok Authors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -173,6 +173,8 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula
|
||||
thisDotFieldDotAddAll.receiver = thisDotField;
|
||||
thisDotFieldDotAddAll.selector = "addAll".toCharArray();
|
||||
statements.add(thisDotFieldDotAddAll);
|
||||
|
||||
nullBehaviorize(data, statements);
|
||||
if (returnStatement != null) statements.add(returnStatement);
|
||||
|
||||
md.statements = statements.toArray(new Statement[0]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2019 The Project Lombok Authors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -305,6 +305,9 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer
|
||||
forEachContent.statements = new Statement[] {addKey, addValue};
|
||||
forEach.action = forEachContent;
|
||||
statements.add(forEach);
|
||||
|
||||
nullBehaviorize(data, statements);
|
||||
|
||||
if (returnStatement != null) statements.add(returnStatement);
|
||||
|
||||
md.statements = statements.toArray(new Statement[0]);
|
||||
|
||||
@@ -61,6 +61,7 @@ import lombok.Builder;
|
||||
import lombok.Builder.ObtainVia;
|
||||
import lombok.ConfigurationKeys;
|
||||
import lombok.Singular;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.ToString;
|
||||
import lombok.core.AST.Kind;
|
||||
import lombok.core.AnnotationValues;
|
||||
@@ -869,8 +870,9 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
|
||||
if (!annotationTypeMatches(Singular.class, child)) continue;
|
||||
Name pluralName = node.getKind() == Kind.FIELD ? removePrefixFromField(node) : ((JCVariableDecl) node.get()).name;
|
||||
AnnotationValues<Singular> ann = createAnnotation(Singular.class, child);
|
||||
Singular singularInstance = ann.getInstance();
|
||||
deleteAnnotationIfNeccessary(child, Singular.class);
|
||||
String explicitSingular = ann.getInstance().value();
|
||||
String explicitSingular = singularInstance.value();
|
||||
if (explicitSingular.isEmpty()) {
|
||||
if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.SINGULAR_AUTO))) {
|
||||
node.addError("The singular must be specified explicitly (e.g. @Singular(\"task\")) because auto singularization is disabled.");
|
||||
@@ -906,9 +908,22 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new SingularData(child, singularName, pluralName, typeArgs, targetFqn, singularizer, setterPrefix);
|
||||
NullCollectionBehavior behavior = getNullBehaviorFor(ann, singularInstance, node);
|
||||
|
||||
return new SingularData(child, singularName, pluralName, typeArgs, targetFqn, singularizer, behavior, setterPrefix);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static NullCollectionBehavior getNullBehaviorFor(AnnotationValues<Singular> ann, Singular singularInstance, JavacNode node) {
|
||||
NullCollectionBehavior behavior;
|
||||
if (ann.isExplicit("nullBehavior")) {
|
||||
behavior = singularInstance.nullBehavior();
|
||||
} else {
|
||||
behavior = node.getAst().readConfiguration(ConfigurationKeys.SINGULAR_NULL_COLLECTIONS);
|
||||
}
|
||||
if (behavior == null) return NullCollectionBehavior.NULL_POINTER_EXCEPTION;
|
||||
return behavior;
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,7 @@ import com.sun.tools.javac.util.Name;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Builder.ObtainVia;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.ConfigurationKeys;
|
||||
import lombok.Singular;
|
||||
import lombok.ToString;
|
||||
@@ -939,8 +940,9 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
|
||||
if (!annotationTypeMatches(Singular.class, child)) continue;
|
||||
Name pluralName = node.getKind() == Kind.FIELD ? removePrefixFromField(node) : ((JCVariableDecl) node.get()).name;
|
||||
AnnotationValues<Singular> ann = createAnnotation(Singular.class, child);
|
||||
Singular singularInstance = ann.getInstance();
|
||||
deleteAnnotationIfNeccessary(child, Singular.class);
|
||||
String explicitSingular = ann.getInstance().value();
|
||||
String explicitSingular = singularInstance.value();
|
||||
if (explicitSingular.isEmpty()) {
|
||||
if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.SINGULAR_AUTO))) {
|
||||
node.addError("The singular must be specified explicitly (e.g. @Singular(\"task\")) because auto singularization is disabled.");
|
||||
@@ -974,7 +976,8 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new SingularData(child, singularName, pluralName, typeArgs, targetFqn, singularizer);
|
||||
NullCollectionBehavior behavior = HandleBuilder.getNullBehaviorFor(ann, singularInstance, node);
|
||||
return new SingularData(child, singularName, pluralName, typeArgs, targetFqn, singularizer, behavior);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -24,16 +24,34 @@ package lombok.javac.handlers;
|
||||
import static lombok.javac.Javac.*;
|
||||
import static lombok.javac.handlers.JavacHandlerUtil.*;
|
||||
|
||||
import com.sun.tools.javac.tree.JCTree.JCBlock;
|
||||
import com.sun.tools.javac.tree.JCTree.JCTypeParameter;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.source.tree.Tree.Kind;
|
||||
import com.sun.tools.javac.code.BoundKind;
|
||||
import com.sun.tools.javac.code.Flags;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
|
||||
import com.sun.tools.javac.tree.JCTree.JCBlock;
|
||||
import com.sun.tools.javac.tree.JCTree.JCExpression;
|
||||
import com.sun.tools.javac.tree.JCTree.JCLiteral;
|
||||
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.JCModifiers;
|
||||
import com.sun.tools.javac.tree.JCTree.JCStatement;
|
||||
import com.sun.tools.javac.tree.JCTree.JCTypeParameter;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.JCWildcard;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.ConfigurationKeys;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
import lombok.core.LombokImmutableList;
|
||||
import lombok.core.SpiLoadUtil;
|
||||
import lombok.core.TypeLibrary;
|
||||
@@ -42,22 +60,6 @@ import lombok.core.handlers.HandlerUtil;
|
||||
import lombok.javac.JavacNode;
|
||||
import lombok.javac.JavacTreeMaker;
|
||||
|
||||
import com.sun.source.tree.Tree.Kind;
|
||||
import com.sun.tools.javac.code.BoundKind;
|
||||
import com.sun.tools.javac.code.Flags;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
|
||||
import com.sun.tools.javac.tree.JCTree.JCExpression;
|
||||
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.JCModifiers;
|
||||
import com.sun.tools.javac.tree.JCTree.JCStatement;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.JCWildcard;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
|
||||
public class JavacSingularsRecipes {
|
||||
public interface ExpressionMaker {
|
||||
JCExpression make();
|
||||
@@ -120,12 +122,13 @@ public class JavacSingularsRecipes {
|
||||
private final String targetFqn;
|
||||
private final JavacSingularizer singularizer;
|
||||
private final String setterPrefix;
|
||||
private final NullCollectionBehavior nullCollectionBehavior;
|
||||
|
||||
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, NullCollectionBehavior nullCollectionBehavior) {
|
||||
this(annotation, singularName, pluralName, typeArgs, targetFqn, singularizer, nullCollectionBehavior, "");
|
||||
}
|
||||
|
||||
public SingularData(JavacNode annotation, Name singularName, Name pluralName, List<JCExpression> typeArgs, String targetFqn, JavacSingularizer singularizer, String setterPrefix) {
|
||||
public SingularData(JavacNode annotation, Name singularName, Name pluralName, List<JCExpression> typeArgs, String targetFqn, JavacSingularizer singularizer, NullCollectionBehavior nullCollectionBehavior, String setterPrefix) {
|
||||
this.annotation = annotation;
|
||||
this.singularName = singularName;
|
||||
this.pluralName = pluralName;
|
||||
@@ -133,6 +136,7 @@ public class JavacSingularsRecipes {
|
||||
this.targetFqn = targetFqn;
|
||||
this.singularizer = singularizer;
|
||||
this.setterPrefix = setterPrefix;
|
||||
this.nullCollectionBehavior = nullCollectionBehavior;
|
||||
}
|
||||
|
||||
public JavacNode getAnnotation() {
|
||||
@@ -163,6 +167,10 @@ public class JavacSingularsRecipes {
|
||||
return singularizer;
|
||||
}
|
||||
|
||||
public NullCollectionBehavior getNullCollectionBehavior() {
|
||||
return nullCollectionBehavior;
|
||||
}
|
||||
|
||||
public String getTargetSimpleType() {
|
||||
int idx = targetFqn.lastIndexOf(".");
|
||||
return idx == -1 ? targetFqn : targetFqn.substring(idx + 1);
|
||||
@@ -320,6 +328,7 @@ 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();
|
||||
String setterPrefix = data.getSetterPrefix();
|
||||
if (setterPrefix.isEmpty() && !fluent) setterPrefix = getAddMethodName() + "All";
|
||||
@@ -329,13 +338,40 @@ public class JavacSingularsRecipes {
|
||||
long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext());
|
||||
JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null);
|
||||
statements.prepend(createConstructBuilderVarIfNeeded(maker, data, builderType, source));
|
||||
|
||||
NullCollectionBehavior behavior = data.getNullCollectionBehavior();
|
||||
|
||||
if (behavior == NullCollectionBehavior.IGNORE) {
|
||||
JCExpression incomingIsNotNull = maker.Binary(CTC_NOT_EQUAL, maker.Ident(data.getPluralName()), maker.Literal(CTC_BOT, null));
|
||||
JCStatement onNotNull = maker.Block(0, statements.toList());
|
||||
statements = new ListBuffer<JCStatement>();
|
||||
statements.add(maker.If(incomingIsNotNull, onNotNull, null));
|
||||
} else {
|
||||
JCLiteral message = maker.Literal(behavior.toExceptionMessage(data.getPluralName().toString()));
|
||||
if (behavior.getExceptionType() != null) {
|
||||
JCExpression incomingIsNull = maker.Binary(CTC_EQUAL, maker.Ident(data.getPluralName()), maker.Literal(CTC_BOT, null));
|
||||
JCExpression exType = genTypeRef(builderType, behavior.getExceptionType());
|
||||
JCExpression exception = maker.NewClass(null, List.<JCExpression>nil(), exType, List.<JCExpression>of(message), null);
|
||||
JCStatement onNull = maker.Throw(exception);
|
||||
statements.prepend(maker.If(incomingIsNull, onNull, null));
|
||||
} else {
|
||||
LombokImmutableList<String> method = behavior.getMethod();
|
||||
JCExpression invoke = maker.Apply(List.<JCExpression>nil(), chainDots(builderType, method), List.of(maker.Ident(data.getPluralName()), message));
|
||||
statements.prepend(maker.Exec(invoke));
|
||||
}
|
||||
}
|
||||
|
||||
finishAndInjectMethod(cfv, maker, returnType, returnStatement, data, builderType, source, deprecate, statements, name, List.of(param), access);
|
||||
}
|
||||
|
||||
protected ListBuffer<JCStatement> generatePluralMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source) {
|
||||
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
|
||||
|
||||
JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), getAddMethodName() + "All");
|
||||
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, List.<JCExpression>of(maker.Ident(data.getPluralName())));
|
||||
return new ListBuffer<JCStatement>().append(maker.Exec(invokeAdd));
|
||||
statements.append(maker.Exec(invokeAdd));
|
||||
|
||||
return statements;
|
||||
}
|
||||
|
||||
protected abstract JCExpression getPluralMethodParamType(JavacNode builderType);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DirectoryRunner extends Runner {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract boolean expectChanges();
|
||||
public abstract boolean expectChanges();
|
||||
}
|
||||
|
||||
private static final FileFilter JAVA_FILE_FILTER = new FileFilter() {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class BuilderDefaultsWarnings {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return this;
|
||||
|
||||
@@ -36,6 +36,7 @@ class BuilderSingularAnnotatedTypes {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
|
||||
if (foos == null) throw new java.lang.NullPointerException("foos cannot be null");
|
||||
if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
this.foos.addAll(foos);
|
||||
return this;
|
||||
@@ -63,6 +64,7 @@ class BuilderSingularAnnotatedTypes {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
|
||||
if (bars == null) throw new java.lang.NullPointerException("bars cannot be 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>();
|
||||
|
||||
+2
@@ -36,6 +36,7 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
|
||||
if (foos == null) throw new java.lang.NullPointerException("foos cannot be null");
|
||||
if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
this.foos.addAll(foos);
|
||||
return this;
|
||||
@@ -63,6 +64,7 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
|
||||
if (bars == null) throw new java.lang.NullPointerException("bars cannot be 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>();
|
||||
|
||||
@@ -41,6 +41,7 @@ class BuilderSingularGuavaListsSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> cards(final java.lang.Iterable<? extends T> cards) {
|
||||
if (cards == null) throw new java.lang.NullPointerException("cards cannot be null");
|
||||
if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder();
|
||||
this.cards.addAll(cards);
|
||||
return this;
|
||||
@@ -58,6 +59,7 @@ class BuilderSingularGuavaListsSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> frogs(final java.lang.Iterable<? extends Number> frogs) {
|
||||
if (frogs == null) throw new java.lang.NullPointerException("frogs cannot be null");
|
||||
if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder();
|
||||
this.frogs.addAll(frogs);
|
||||
return this;
|
||||
@@ -75,6 +77,7 @@ class BuilderSingularGuavaListsSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Iterable<?> rawSet) {
|
||||
if (rawSet == null) throw new java.lang.NullPointerException("rawSet cannot be null");
|
||||
if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder();
|
||||
this.rawSet.addAll(rawSet);
|
||||
return this;
|
||||
@@ -92,6 +95,7 @@ class BuilderSingularGuavaListsSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> passes(final java.lang.Iterable<? extends String> passes) {
|
||||
if (passes == null) throw new java.lang.NullPointerException("passes cannot be null");
|
||||
if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
|
||||
this.passes.addAll(passes);
|
||||
return this;
|
||||
@@ -109,6 +113,7 @@ class BuilderSingularGuavaListsSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> users(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
|
||||
if (users == null) throw new java.lang.NullPointerException("users cannot be null");
|
||||
if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder();
|
||||
this.users.putAll(users);
|
||||
return this;
|
||||
|
||||
@@ -31,6 +31,7 @@ class BuilderSingularGuavaMaps<K, V> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> battleaxes(final java.util.Map<? extends K, ? extends V> battleaxes) {
|
||||
if (battleaxes == null) throw new java.lang.NullPointerException("battleaxes cannot be null");
|
||||
if (this.battleaxes == null) this.battleaxes = com.google.common.collect.ImmutableMap.builder();
|
||||
this.battleaxes.putAll(battleaxes);
|
||||
return this;
|
||||
@@ -48,6 +49,7 @@ class BuilderSingularGuavaMaps<K, V> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> vertices(final java.util.Map<? extends Integer, ? extends V> vertices) {
|
||||
if (vertices == null) throw new java.lang.NullPointerException("vertices cannot be null");
|
||||
if (this.vertices == null) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder();
|
||||
this.vertices.putAll(vertices);
|
||||
return this;
|
||||
@@ -65,6 +67,7 @@ class BuilderSingularGuavaMaps<K, V> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
|
||||
if (rawMap == null) throw new java.lang.NullPointerException("rawMap cannot be null");
|
||||
if (this.rawMap == null) this.rawMap = com.google.common.collect.ImmutableBiMap.builder();
|
||||
this.rawMap.putAll(rawMap);
|
||||
return this;
|
||||
|
||||
@@ -30,6 +30,7 @@ class BuilderSingularLists<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularLists.BuilderSingularListsBuilder<T> children(final java.util.Collection<? extends T> children) {
|
||||
if (children == null) throw new java.lang.NullPointerException("children cannot be null");
|
||||
if (this.children == null) this.children = new java.util.ArrayList<T>();
|
||||
this.children.addAll(children);
|
||||
return this;
|
||||
@@ -47,6 +48,7 @@ class BuilderSingularLists<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularLists.BuilderSingularListsBuilder<T> scarves(final java.util.Collection<? extends Number> scarves) {
|
||||
if (scarves == null) throw new java.lang.NullPointerException("scarves cannot be null");
|
||||
if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>();
|
||||
this.scarves.addAll(scarves);
|
||||
return this;
|
||||
@@ -64,6 +66,7 @@ class BuilderSingularLists<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularLists.BuilderSingularListsBuilder<T> rawList(final java.util.Collection<?> rawList) {
|
||||
if (rawList == null) throw new java.lang.NullPointerException("rawList cannot be null");
|
||||
if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawList.addAll(rawList);
|
||||
return this;
|
||||
|
||||
@@ -46,6 +46,7 @@ class BuilderSingularMaps<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> women(java.util.Map<? extends K, ? extends V> women) {
|
||||
if (women == null) throw new NullPointerException("women cannot be null");
|
||||
if (this.women$key == null) {
|
||||
this.women$key = new java.util.ArrayList<K>();
|
||||
this.women$value = new java.util.ArrayList<V>();
|
||||
@@ -76,6 +77,7 @@ class BuilderSingularMaps<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> men(java.util.Map<? extends K, ? extends Number> men) {
|
||||
if (men == null) throw new NullPointerException("men cannot be null");
|
||||
if (this.men$key == null) {
|
||||
this.men$key = new java.util.ArrayList<K>();
|
||||
this.men$value = new java.util.ArrayList<Number>();
|
||||
@@ -106,6 +108,7 @@ class BuilderSingularMaps<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> rawMap(java.util.Map<?, ?> rawMap) {
|
||||
if (rawMap == null) throw new NullPointerException("rawMap cannot be null");
|
||||
if (this.rawMap$key == null) {
|
||||
this.rawMap$key = new java.util.ArrayList<Object>();
|
||||
this.rawMap$value = new java.util.ArrayList<Object>();
|
||||
@@ -136,6 +139,7 @@ class BuilderSingularMaps<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> stringMap(java.util.Map<? extends String, ? extends V> stringMap) {
|
||||
if (stringMap == null) throw new NullPointerException("stringMap cannot be null");
|
||||
if (this.stringMap$key == null) {
|
||||
this.stringMap$key = new java.util.ArrayList<String>();
|
||||
this.stringMap$value = new java.util.ArrayList<V>();
|
||||
|
||||
@@ -46,13 +46,15 @@ class BuilderSingularMapsWithSetterPrefix<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsWithSetterPrefix.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());
|
||||
if (women != null) {
|
||||
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;
|
||||
}
|
||||
@@ -76,13 +78,15 @@ class BuilderSingularMapsWithSetterPrefix<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsWithSetterPrefix.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());
|
||||
if (men != null) {
|
||||
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;
|
||||
}
|
||||
@@ -106,13 +110,15 @@ class BuilderSingularMapsWithSetterPrefix<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsWithSetterPrefix.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());
|
||||
if (rawMap != null) {
|
||||
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;
|
||||
}
|
||||
@@ -136,13 +142,15 @@ class BuilderSingularMapsWithSetterPrefix<K, V> {
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsWithSetterPrefix.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());
|
||||
if (stringMap != null) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class BuilderSingularNoAuto {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder things(final java.util.Collection<? extends String> things) {
|
||||
if (things == null) throw new java.lang.NullPointerException("things cannot be null");
|
||||
if (this.things == null) this.things = new java.util.ArrayList<String>();
|
||||
this.things.addAll(things);
|
||||
return this;
|
||||
@@ -45,6 +46,7 @@ class BuilderSingularNoAuto {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder widgets(final java.util.Collection<? extends String> widgets) {
|
||||
if (widgets == null) throw new java.lang.NullPointerException("widgets cannot be null");
|
||||
if (this.widgets == null) this.widgets = new java.util.ArrayList<String>();
|
||||
this.widgets.addAll(widgets);
|
||||
return this;
|
||||
@@ -62,6 +64,7 @@ class BuilderSingularNoAuto {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return this;
|
||||
|
||||
@@ -28,6 +28,7 @@ class BuilderSingularNoAutoWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection<? extends String> things) {
|
||||
if (things == null) throw new java.lang.NullPointerException("things cannot be null");
|
||||
if (this.things == null) this.things = new java.util.ArrayList<String>();
|
||||
this.things.addAll(things);
|
||||
return this;
|
||||
@@ -45,6 +46,7 @@ class BuilderSingularNoAutoWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection<? extends String> widgets) {
|
||||
if (widgets == null) throw new java.lang.NullPointerException("widgets cannot be null");
|
||||
if (this.widgets == null) this.widgets = new java.util.ArrayList<String>();
|
||||
this.widgets.addAll(widgets);
|
||||
return this;
|
||||
@@ -62,6 +64,7 @@ class BuilderSingularNoAutoWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return this;
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
class BuilderSingularNullBehavior1 {
|
||||
private List<String> names;
|
||||
private List<String> locations;
|
||||
private List<String> whatevers;
|
||||
private List<String> doohickeys;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
BuilderSingularNullBehavior1(final List<String> names, final List<String> locations, final List<String> whatevers, final List<String> doohickeys) {
|
||||
this.names = names;
|
||||
this.locations = locations;
|
||||
this.whatevers = whatevers;
|
||||
this.doohickeys = doohickeys;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public static class BuilderSingularNullBehavior1Builder {
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private java.util.ArrayList<String> names;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private java.util.ArrayList<String> locations;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private java.util.ArrayList<String> whatevers;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private java.util.ArrayList<String> doohickeys;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
BuilderSingularNullBehavior1Builder() {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder name(final String name) {
|
||||
if (this.names == null) this.names = new java.util.ArrayList<String>();
|
||||
this.names.add(name);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder names(final java.util.Collection<? extends String> names) {
|
||||
if (names == null) throw new java.lang.NullPointerException("names cannot be null");
|
||||
if (this.names == null) this.names = new java.util.ArrayList<String>();
|
||||
this.names.addAll(names);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearNames() {
|
||||
if (this.names != null) this.names.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder location(final String location) {
|
||||
if (this.locations == null) this.locations = new java.util.ArrayList<String>();
|
||||
this.locations.add(location);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder locations(final java.util.Collection<? extends String> locations) {
|
||||
java.util.Objects.requireNonNull(locations, "locations cannot be null");
|
||||
if (this.locations == null) this.locations = new java.util.ArrayList<String>();
|
||||
this.locations.addAll(locations);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearLocations() {
|
||||
if (this.locations != null) this.locations.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder whatever(final String whatever) {
|
||||
if (this.whatevers == null) this.whatevers = new java.util.ArrayList<String>();
|
||||
this.whatevers.add(whatever);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder whatevers(final java.util.Collection<? extends String> whatevers) {
|
||||
com.google.common.base.Preconditions.checkNotNull(whatevers, "whatevers cannot be null");
|
||||
if (this.whatevers == null) this.whatevers = new java.util.ArrayList<String>();
|
||||
this.whatevers.addAll(whatevers);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearWhatevers() {
|
||||
if (this.whatevers != null) this.whatevers.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder doohickey(final String doohickey) {
|
||||
if (this.doohickeys == null) this.doohickeys = new java.util.ArrayList<String>();
|
||||
this.doohickeys.add(doohickey);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder doohickeys(final java.util.Collection<? extends String> doohickeys) {
|
||||
if (doohickeys != null) {
|
||||
if (this.doohickeys == null) this.doohickeys = new java.util.ArrayList<String>();
|
||||
this.doohickeys.addAll(doohickeys);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearDoohickeys() {
|
||||
if (this.doohickeys != null) this.doohickeys.clear();
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularNullBehavior1 build() {
|
||||
java.util.List<String> names;
|
||||
switch (this.names == null ? 0 : this.names.size()) {
|
||||
case 0:
|
||||
names = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1:
|
||||
names = java.util.Collections.singletonList(this.names.get(0));
|
||||
break;
|
||||
default:
|
||||
names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.names));
|
||||
}
|
||||
java.util.List<String> locations;
|
||||
switch (this.locations == null ? 0 : this.locations.size()) {
|
||||
case 0:
|
||||
locations = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1:
|
||||
locations = java.util.Collections.singletonList(this.locations.get(0));
|
||||
break;
|
||||
default:
|
||||
locations = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.locations));
|
||||
}
|
||||
java.util.List<String> whatevers;
|
||||
switch (this.whatevers == null ? 0 : this.whatevers.size()) {
|
||||
case 0:
|
||||
whatevers = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1:
|
||||
whatevers = java.util.Collections.singletonList(this.whatevers.get(0));
|
||||
break;
|
||||
default:
|
||||
whatevers = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.whatevers));
|
||||
}
|
||||
java.util.List<String> doohickeys;
|
||||
switch (this.doohickeys == null ? 0 : this.doohickeys.size()) {
|
||||
case 0:
|
||||
doohickeys = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1:
|
||||
doohickeys = java.util.Collections.singletonList(this.doohickeys.get(0));
|
||||
break;
|
||||
default:
|
||||
doohickeys = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.doohickeys));
|
||||
}
|
||||
return new BuilderSingularNullBehavior1(names, locations, whatevers, doohickeys);
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public java.lang.String toString() {
|
||||
return "BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder(names=" + this.names + ", locations=" + this.locations + ", whatevers=" + this.whatevers + ", doohickeys=" + this.doohickeys + ")";
|
||||
}
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public static BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder builder() {
|
||||
return new BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ class BuilderSingularRedirectToGuava {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder dangerMice(final java.lang.Iterable<? extends String> dangerMice) {
|
||||
if (dangerMice == null) throw new java.lang.NullPointerException("dangerMice cannot be null");
|
||||
if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder();
|
||||
this.dangerMice.addAll(dangerMice);
|
||||
return this;
|
||||
@@ -47,6 +48,7 @@ class BuilderSingularRedirectToGuava {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder things(final java.util.Map<? extends Integer, ? extends Number> things) {
|
||||
if (things == null) throw new java.lang.NullPointerException("things cannot be null");
|
||||
if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder();
|
||||
this.things.putAll(things);
|
||||
return this;
|
||||
@@ -64,6 +66,7 @@ class BuilderSingularRedirectToGuava {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder doohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) {
|
||||
if (doohickeys == null) throw new java.lang.NullPointerException("doohickeys cannot be null");
|
||||
if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder();
|
||||
this.doohickeys.addAll(doohickeys);
|
||||
return this;
|
||||
|
||||
@@ -34,6 +34,7 @@ class BuilderSingularSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSets.BuilderSingularSetsBuilder<T> dangerMice(final java.util.Collection<? extends T> dangerMice) {
|
||||
if (dangerMice == null) throw new java.lang.NullPointerException("dangerMice cannot be null");
|
||||
if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList<T>();
|
||||
this.dangerMice.addAll(dangerMice);
|
||||
return this;
|
||||
@@ -51,6 +52,7 @@ class BuilderSingularSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSets.BuilderSingularSetsBuilder<T> octopodes(final java.util.Collection<? extends Number> octopodes) {
|
||||
if (octopodes == null) throw new java.lang.NullPointerException("octopodes cannot be null");
|
||||
if (this.octopodes == null) this.octopodes = new java.util.ArrayList<Number>();
|
||||
this.octopodes.addAll(octopodes);
|
||||
return this;
|
||||
@@ -68,6 +70,7 @@ class BuilderSingularSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSets.BuilderSingularSetsBuilder<T> rawSet(final java.util.Collection<?> rawSet) {
|
||||
if (rawSet == null) throw new java.lang.NullPointerException("rawSet cannot be null");
|
||||
if (this.rawSet == null) this.rawSet = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawSet.addAll(rawSet);
|
||||
return this;
|
||||
@@ -85,6 +88,7 @@ class BuilderSingularSets<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSets.BuilderSingularSetsBuilder<T> stringSet(final java.util.Collection<? extends String> stringSet) {
|
||||
if (stringSet == null) throw new java.lang.NullPointerException("stringSet cannot be null");
|
||||
if (this.stringSet == null) this.stringSet = new java.util.ArrayList<String>();
|
||||
this.stringSet.addAll(stringSet);
|
||||
return this;
|
||||
|
||||
@@ -34,6 +34,7 @@ class BuilderSingularSetsWithSetterPrefix<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMice(final java.util.Collection<? extends T> dangerMice) {
|
||||
if (dangerMice == null) throw new java.lang.NullPointerException("dangerMice cannot be null");
|
||||
if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList<T>();
|
||||
this.dangerMice.addAll(dangerMice);
|
||||
return this;
|
||||
@@ -51,6 +52,7 @@ class BuilderSingularSetsWithSetterPrefix<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopodes(final java.util.Collection<? extends Number> octopodes) {
|
||||
if (octopodes == null) throw new java.lang.NullPointerException("octopodes cannot be null");
|
||||
if (this.octopodes == null) this.octopodes = new java.util.ArrayList<Number>();
|
||||
this.octopodes.addAll(octopodes);
|
||||
return this;
|
||||
@@ -68,6 +70,7 @@ class BuilderSingularSetsWithSetterPrefix<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withRawSet(final java.util.Collection<?> rawSet) {
|
||||
if (rawSet == null) throw new java.lang.NullPointerException("rawSet cannot be null");
|
||||
if (this.rawSet == null) this.rawSet = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawSet.addAll(rawSet);
|
||||
return this;
|
||||
@@ -85,6 +88,7 @@ class BuilderSingularSetsWithSetterPrefix<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(final java.util.Collection<? extends String> stringSet) {
|
||||
if (stringSet == null) throw new java.lang.NullPointerException("stringSet cannot be null");
|
||||
if (this.stringSet == null) this.stringSet = new java.util.ArrayList<String>();
|
||||
this.stringSet.addAll(stringSet);
|
||||
return this;
|
||||
|
||||
@@ -22,6 +22,7 @@ class BuilderSingularToBuilderWithNull {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder elems(final java.util.Collection<? extends String> elems) {
|
||||
if (elems == null) throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if (this.elems == null) this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
return this;
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ class BuilderSingularToBuilderWithNullWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
|
||||
if (elems == null) throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if (this.elems == null) this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
return this;
|
||||
|
||||
@@ -25,6 +25,7 @@ class BuilderSingularWildcardListsWithToBuilder {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder objects(final java.util.Collection<?> objects) {
|
||||
if (objects == null) throw new java.lang.NullPointerException("objects cannot be null");
|
||||
if (this.objects == null) this.objects = new java.util.ArrayList<java.lang.Object>();
|
||||
this.objects.addAll(objects);
|
||||
return this;
|
||||
@@ -42,6 +43,7 @@ class BuilderSingularWildcardListsWithToBuilder {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder numbers(final java.util.Collection<? extends Number> numbers) {
|
||||
if (numbers == null) throw new java.lang.NullPointerException("numbers cannot be null");
|
||||
if (this.numbers == null) this.numbers = new java.util.ArrayList<Number>();
|
||||
this.numbers.addAll(numbers);
|
||||
return this;
|
||||
|
||||
@@ -19,6 +19,7 @@ class BuilderSingularWithPrefixes {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder elems(final java.util.Collection<? extends String> elems) {
|
||||
if (elems == null) throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if (this.elems == null) this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
return this;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ class BuilderSingularWithPrefixesWithSetterPrefix {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
|
||||
if (elems == null) throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if (this.elems == null) this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
return this;
|
||||
|
||||
@@ -56,6 +56,7 @@ public class BuilderWithDeprecated {
|
||||
@java.lang.Deprecated
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderWithDeprecated.BuilderWithDeprecatedBuilder strings(final java.util.Collection<? extends String> strings) {
|
||||
if (strings == null) throw new java.lang.NullPointerException("strings cannot be null");
|
||||
if (this.strings == null) this.strings = new java.util.ArrayList<String>();
|
||||
this.strings.addAll(strings);
|
||||
return this;
|
||||
@@ -76,6 +77,7 @@ public class BuilderWithDeprecated {
|
||||
@java.lang.Deprecated
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderWithDeprecated.BuilderWithDeprecatedBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) {
|
||||
if (numbers == null) throw new java.lang.NullPointerException("numbers cannot be null");
|
||||
if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder();
|
||||
this.numbers.addAll(numbers);
|
||||
return this;
|
||||
|
||||
@@ -50,6 +50,7 @@ class BuilderWithToBuilder<T> {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> bars(final java.util.Collection<? extends T> bars) {
|
||||
if (bars == null) throw new java.lang.NullPointerException("bars cannot be null");
|
||||
if (this.bars == null) this.bars = new java.util.ArrayList<T>();
|
||||
this.bars.addAll(bars);
|
||||
return this;
|
||||
|
||||
@@ -62,6 +62,7 @@ class CheckerFrameworkBuilder {
|
||||
@org.checkerframework.checker.builder.qual.ReturnsReceiver
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) {
|
||||
if (names == null) throw new java.lang.NullPointerException("names cannot be null");
|
||||
if (this.names == null) this.names = new java.util.ArrayList<String>();
|
||||
this.names.addAll(names);
|
||||
return this;
|
||||
|
||||
@@ -58,6 +58,7 @@ class CheckerFrameworkSuperBuilder {
|
||||
@org.checkerframework.checker.builder.qual.ReturnsReceiver
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B names(final java.util.Collection<? extends String> names) {
|
||||
if (names == null) throw new java.lang.NullPointerException("names cannot be null");
|
||||
if (this.names == null) this.names = new java.util.ArrayList<String>();
|
||||
this.names.addAll(names);
|
||||
return self();
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SuperBuilderBasic {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return self();
|
||||
|
||||
@@ -69,6 +69,7 @@ public class SuperBuilderBasicToBuilder {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return self();
|
||||
|
||||
@@ -32,6 +32,7 @@ class SuperBuilderSingularAnnotatedTypes {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
|
||||
if (foos == null) throw new java.lang.NullPointerException("foos cannot be null");
|
||||
if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
this.foos.addAll(foos);
|
||||
return self();
|
||||
@@ -59,6 +60,7 @@ class SuperBuilderSingularAnnotatedTypes {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
|
||||
if (bars == null) throw new java.lang.NullPointerException("bars cannot be 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>();
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SuperBuilderWithCustomBuilderMethod {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return self();
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SuperBuilderWithGenerics {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return self();
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SuperBuilderWithGenerics2 {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return self();
|
||||
|
||||
@@ -42,6 +42,7 @@ public class SuperBuilderWithGenericsAndToBuilder {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Map<? extends Integer, ? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items$key == null) {
|
||||
this.items$key = new java.util.ArrayList<Integer>();
|
||||
this.items$value = new java.util.ArrayList<String>();
|
||||
|
||||
@@ -32,6 +32,7 @@ class SuperBuilderWithPrefixes {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public B items(final java.util.Collection<? extends String> items) {
|
||||
if (items == null) throw new java.lang.NullPointerException("items cannot be null");
|
||||
if (this.items == null) this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
return self();
|
||||
|
||||
@@ -23,6 +23,8 @@ public @Builder class BuilderDefaultsWarnings {
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -25,6 +25,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
|
||||
if ((foos == null))
|
||||
throw new java.lang.NullPointerException("foos cannot be null");
|
||||
if ((this.foos == null))
|
||||
this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
this.foos.addAll(foos);
|
||||
@@ -54,6 +56,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
|
||||
if ((bars == null))
|
||||
throw new java.lang.NullPointerException("bars cannot be null");
|
||||
if ((this.bars$key == null))
|
||||
{
|
||||
this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
|
||||
@@ -25,6 +25,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
|
||||
if ((foos == null))
|
||||
throw new java.lang.NullPointerException("foos cannot be null");
|
||||
if ((this.foos == null))
|
||||
this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
this.foos.addAll(foos);
|
||||
@@ -54,6 +56,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
|
||||
if ((bars == null))
|
||||
throw new java.lang.NullPointerException("bars cannot be null");
|
||||
if ((this.bars$key == null))
|
||||
{
|
||||
this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
|
||||
@@ -21,6 +21,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> cards(final java.lang.Iterable<? extends T> cards) {
|
||||
if ((cards == null))
|
||||
throw new java.lang.NullPointerException("cards cannot be null");
|
||||
if ((this.cards == null))
|
||||
this.cards = com.google.common.collect.ImmutableList.builder();
|
||||
this.cards.addAll(cards);
|
||||
@@ -37,6 +39,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> frogs(final java.lang.Iterable<? extends Number> frogs) {
|
||||
if ((frogs == null))
|
||||
throw new java.lang.NullPointerException("frogs cannot be null");
|
||||
if ((this.frogs == null))
|
||||
this.frogs = com.google.common.collect.ImmutableList.builder();
|
||||
this.frogs.addAll(frogs);
|
||||
@@ -53,6 +57,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Iterable<?> rawSet) {
|
||||
if ((rawSet == null))
|
||||
throw new java.lang.NullPointerException("rawSet cannot be null");
|
||||
if ((this.rawSet == null))
|
||||
this.rawSet = com.google.common.collect.ImmutableSet.builder();
|
||||
this.rawSet.addAll(rawSet);
|
||||
@@ -69,6 +75,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> passes(final java.lang.Iterable<? extends String> passes) {
|
||||
if ((passes == null))
|
||||
throw new java.lang.NullPointerException("passes cannot be null");
|
||||
if ((this.passes == null))
|
||||
this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
|
||||
this.passes.addAll(passes);
|
||||
@@ -85,6 +93,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> users(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
|
||||
if ((users == null))
|
||||
throw new java.lang.NullPointerException("users cannot be null");
|
||||
if ((this.users == null))
|
||||
this.users = com.google.common.collect.ImmutableTable.builder();
|
||||
this.users.putAll(users);
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> battleaxes(final java.util.Map<? extends K, ? extends V> battleaxes) {
|
||||
if ((battleaxes == null))
|
||||
throw new java.lang.NullPointerException("battleaxes cannot be null");
|
||||
if ((this.battleaxes == null))
|
||||
this.battleaxes = com.google.common.collect.ImmutableMap.builder();
|
||||
this.battleaxes.putAll(battleaxes);
|
||||
@@ -33,6 +35,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> vertices(final java.util.Map<? extends Integer, ? extends V> vertices) {
|
||||
if ((vertices == null))
|
||||
throw new java.lang.NullPointerException("vertices cannot be null");
|
||||
if ((this.vertices == null))
|
||||
this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder();
|
||||
this.vertices.putAll(vertices);
|
||||
@@ -49,6 +53,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
|
||||
if ((rawMap == null))
|
||||
throw new java.lang.NullPointerException("rawMap cannot be null");
|
||||
if ((this.rawMap == null))
|
||||
this.rawMap = com.google.common.collect.ImmutableBiMap.builder();
|
||||
this.rawMap.putAll(rawMap);
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularLists.BuilderSingularListsBuilder<T> children(final java.util.Collection<? extends T> children) {
|
||||
if ((children == null))
|
||||
throw new java.lang.NullPointerException("children cannot be null");
|
||||
if ((this.children == null))
|
||||
this.children = new java.util.ArrayList<T>();
|
||||
this.children.addAll(children);
|
||||
@@ -34,6 +36,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularLists.BuilderSingularListsBuilder<T> scarves(final java.util.Collection<? extends Number> scarves) {
|
||||
if ((scarves == null))
|
||||
throw new java.lang.NullPointerException("scarves cannot be null");
|
||||
if ((this.scarves == null))
|
||||
this.scarves = new java.util.ArrayList<Number>();
|
||||
this.scarves.addAll(scarves);
|
||||
@@ -51,6 +55,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularLists.BuilderSingularListsBuilder<T> rawList(final java.util.Collection<?> rawList) {
|
||||
if ((rawList == null))
|
||||
throw new java.lang.NullPointerException("rawList cannot be null");
|
||||
if ((this.rawList == null))
|
||||
this.rawList = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawList.addAll(rawList);
|
||||
|
||||
@@ -25,6 +25,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> women(final java.util.Map<? extends K, ? extends V> women) {
|
||||
if ((women == null))
|
||||
throw new java.lang.NullPointerException("women cannot be null");
|
||||
if ((this.women$key == null))
|
||||
{
|
||||
this.women$key = new java.util.ArrayList<K>();
|
||||
@@ -56,6 +58,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> men(final java.util.Map<? extends K, ? extends Number> men) {
|
||||
if ((men == null))
|
||||
throw new java.lang.NullPointerException("men cannot be null");
|
||||
if ((this.men$key == null))
|
||||
{
|
||||
this.men$key = new java.util.ArrayList<K>();
|
||||
@@ -87,6 +91,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
|
||||
if ((rawMap == null))
|
||||
throw new java.lang.NullPointerException("rawMap cannot be null");
|
||||
if ((this.rawMap$key == null))
|
||||
{
|
||||
this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
|
||||
@@ -118,6 +124,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMaps.BuilderSingularMapsBuilder<K, V> stringMap(final java.util.Map<? extends String, ? extends V> stringMap) {
|
||||
if ((stringMap == null))
|
||||
throw new java.lang.NullPointerException("stringMap cannot be null");
|
||||
if ((this.stringMap$key == null))
|
||||
{
|
||||
this.stringMap$key = new java.util.ArrayList<String>();
|
||||
|
||||
@@ -25,16 +25,19 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> withWomen(final java.util.Map<? extends K, ? extends V> women) {
|
||||
if ((this.women$key == null))
|
||||
if ((women != null))
|
||||
{
|
||||
this.women$key = new java.util.ArrayList<K>();
|
||||
this.women$value = new java.util.ArrayList<V>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
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") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearWomen() {
|
||||
@@ -56,16 +59,19 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> withMen(final java.util.Map<? extends K, ? extends Number> men) {
|
||||
if ((this.men$key == null))
|
||||
if ((men != null))
|
||||
{
|
||||
this.men$key = new java.util.ArrayList<K>();
|
||||
this.men$value = new java.util.ArrayList<Number>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
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") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearMen() {
|
||||
@@ -87,16 +93,19 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> withRawMap(final java.util.Map<?, ?> rawMap) {
|
||||
if ((this.rawMap$key == null))
|
||||
if ((rawMap != null))
|
||||
{
|
||||
this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawMap$value = new java.util.ArrayList<java.lang.Object>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
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") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearRawMap() {
|
||||
@@ -118,16 +127,19 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> withStringMap(final java.util.Map<? extends String, ? extends V> stringMap) {
|
||||
if ((this.stringMap$key == null))
|
||||
if ((stringMap != null))
|
||||
{
|
||||
this.stringMap$key = new java.util.ArrayList<String>();
|
||||
this.stringMap$value = new java.util.ArrayList<V>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
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") BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearStringMap() {
|
||||
@@ -206,4 +218,4 @@ import lombok.Singular;
|
||||
public static @java.lang.SuppressWarnings("all") <K, V>BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V> builder() {
|
||||
return new BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder<K, V>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNoAuto.BuilderSingularNoAutoBuilder things(final java.util.Collection<? extends String> things) {
|
||||
if ((things == null))
|
||||
throw new java.lang.NullPointerException("things cannot be null");
|
||||
if ((this.things == null))
|
||||
this.things = new java.util.ArrayList<String>();
|
||||
this.things.addAll(things);
|
||||
@@ -32,6 +34,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNoAuto.BuilderSingularNoAutoBuilder widgets(final java.util.Collection<? extends String> widgets) {
|
||||
if ((widgets == null))
|
||||
throw new java.lang.NullPointerException("widgets cannot be null");
|
||||
if ((this.widgets == null))
|
||||
this.widgets = new java.util.ArrayList<String>();
|
||||
this.widgets.addAll(widgets);
|
||||
@@ -49,6 +53,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNoAuto.BuilderSingularNoAutoBuilder items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -15,6 +15,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection<? extends String> things) {
|
||||
if ((things == null))
|
||||
throw new java.lang.NullPointerException("things cannot be null");
|
||||
if ((this.things == null))
|
||||
this.things = new java.util.ArrayList<String>();
|
||||
this.things.addAll(things);
|
||||
@@ -32,6 +34,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection<? extends String> widgets) {
|
||||
if ((widgets == null))
|
||||
throw new java.lang.NullPointerException("widgets cannot be null");
|
||||
if ((this.widgets == null))
|
||||
this.widgets = new java.util.ArrayList<String>();
|
||||
this.widgets.addAll(widgets);
|
||||
@@ -49,6 +53,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import lombok.Singular;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
@lombok.Builder class BuilderSingularNullBehavior1 {
|
||||
public static @java.lang.SuppressWarnings("all") class BuilderSingularNullBehavior1Builder {
|
||||
private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> names;
|
||||
private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> locations;
|
||||
private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> whatevers;
|
||||
private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> doohickeys;
|
||||
@java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1Builder() {
|
||||
super();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder name(final String name) {
|
||||
if ((this.names == null))
|
||||
this.names = new java.util.ArrayList<String>();
|
||||
this.names.add(name);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder names(final java.util.Collection<? extends String> names) {
|
||||
if ((names == null))
|
||||
throw new java.lang.NullPointerException("names cannot be null");
|
||||
if ((this.names == null))
|
||||
this.names = new java.util.ArrayList<String>();
|
||||
this.names.addAll(names);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearNames() {
|
||||
if ((this.names != null))
|
||||
this.names.clear();
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder location(final String location) {
|
||||
if ((this.locations == null))
|
||||
this.locations = new java.util.ArrayList<String>();
|
||||
this.locations.add(location);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder locations(final java.util.Collection<? extends String> locations) {
|
||||
java.util.Objects.requireNonNull(locations, "locations cannot be null");
|
||||
if ((this.locations == null))
|
||||
this.locations = new java.util.ArrayList<String>();
|
||||
this.locations.addAll(locations);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearLocations() {
|
||||
if ((this.locations != null))
|
||||
this.locations.clear();
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder whatever(final String whatever) {
|
||||
if ((this.whatevers == null))
|
||||
this.whatevers = new java.util.ArrayList<String>();
|
||||
this.whatevers.add(whatever);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder whatevers(final java.util.Collection<? extends String> whatevers) {
|
||||
com.google.common.base.Preconditions.checkNotNull(whatevers, "whatevers cannot be null");
|
||||
if ((this.whatevers == null))
|
||||
this.whatevers = new java.util.ArrayList<String>();
|
||||
this.whatevers.addAll(whatevers);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearWhatevers() {
|
||||
if ((this.whatevers != null))
|
||||
this.whatevers.clear();
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder doohickey(final String doohickey) {
|
||||
if ((this.doohickeys == null))
|
||||
this.doohickeys = new java.util.ArrayList<String>();
|
||||
this.doohickeys.add(doohickey);
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder doohickeys(final java.util.Collection<? extends String> doohickeys) {
|
||||
if ((doohickeys != null))
|
||||
{
|
||||
if ((this.doohickeys == null))
|
||||
this.doohickeys = new java.util.ArrayList<String>();
|
||||
this.doohickeys.addAll(doohickeys);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder clearDoohickeys() {
|
||||
if ((this.doohickeys != null))
|
||||
this.doohickeys.clear();
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1 build() {
|
||||
java.util.List<String> names;
|
||||
switch (((this.names == null) ? 0 : this.names.size())) {
|
||||
case 0 :
|
||||
names = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1 :
|
||||
names = java.util.Collections.singletonList(this.names.get(0));
|
||||
break;
|
||||
default :
|
||||
names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.names));
|
||||
}
|
||||
java.util.List<String> locations;
|
||||
switch (((this.locations == null) ? 0 : this.locations.size())) {
|
||||
case 0 :
|
||||
locations = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1 :
|
||||
locations = java.util.Collections.singletonList(this.locations.get(0));
|
||||
break;
|
||||
default :
|
||||
locations = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.locations));
|
||||
}
|
||||
java.util.List<String> whatevers;
|
||||
switch (((this.whatevers == null) ? 0 : this.whatevers.size())) {
|
||||
case 0 :
|
||||
whatevers = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1 :
|
||||
whatevers = java.util.Collections.singletonList(this.whatevers.get(0));
|
||||
break;
|
||||
default :
|
||||
whatevers = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.whatevers));
|
||||
}
|
||||
java.util.List<String> doohickeys;
|
||||
switch (((this.doohickeys == null) ? 0 : this.doohickeys.size())) {
|
||||
case 0 :
|
||||
doohickeys = java.util.Collections.emptyList();
|
||||
break;
|
||||
case 1 :
|
||||
doohickeys = java.util.Collections.singletonList(this.doohickeys.get(0));
|
||||
break;
|
||||
default :
|
||||
doohickeys = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.doohickeys));
|
||||
}
|
||||
return new BuilderSingularNullBehavior1(names, locations, whatevers, doohickeys);
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
|
||||
return (((((((("BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder(names=" + this.names) + ", locations=") + this.locations) + ", whatevers=") + this.whatevers) + ", doohickeys=") + this.doohickeys) + ")");
|
||||
}
|
||||
}
|
||||
private @Singular List<String> names;
|
||||
private @Singular(nullBehavior = Singular.NullCollectionBehavior.JDK) List<String> locations;
|
||||
private @Singular(nullBehavior = NullCollectionBehavior.GUAVA) List<String> whatevers;
|
||||
private @Singular(nullBehavior = lombok.Singular.NullCollectionBehavior.IGNORE) List<String> doohickeys;
|
||||
@java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1(final List<String> names, final List<String> locations, final List<String> whatevers, final List<String> doohickeys) {
|
||||
super();
|
||||
this.names = names;
|
||||
this.locations = locations;
|
||||
this.whatevers = whatevers;
|
||||
this.doohickeys = doohickeys;
|
||||
}
|
||||
public static @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder builder() {
|
||||
return new BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder dangerMice(final java.lang.Iterable<? extends String> dangerMice) {
|
||||
if ((dangerMice == null))
|
||||
throw new java.lang.NullPointerException("dangerMice cannot be null");
|
||||
if ((this.dangerMice == null))
|
||||
this.dangerMice = com.google.common.collect.ImmutableSet.builder();
|
||||
this.dangerMice.addAll(dangerMice);
|
||||
@@ -33,6 +35,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder things(final java.util.Map<? extends Integer, ? extends Number> things) {
|
||||
if ((things == null))
|
||||
throw new java.lang.NullPointerException("things cannot be null");
|
||||
if ((this.things == null))
|
||||
this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder();
|
||||
this.things.putAll(things);
|
||||
@@ -49,6 +53,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder doohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) {
|
||||
if ((doohickeys == null))
|
||||
throw new java.lang.NullPointerException("doohickeys cannot be null");
|
||||
if ((this.doohickeys == null))
|
||||
this.doohickeys = com.google.common.collect.ImmutableList.builder();
|
||||
this.doohickeys.addAll(doohickeys);
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSets.BuilderSingularSetsBuilder<T> dangerMice(final java.util.Collection<? extends T> dangerMice) {
|
||||
if ((dangerMice == null))
|
||||
throw new java.lang.NullPointerException("dangerMice cannot be null");
|
||||
if ((this.dangerMice == null))
|
||||
this.dangerMice = new java.util.ArrayList<T>();
|
||||
this.dangerMice.addAll(dangerMice);
|
||||
@@ -34,6 +36,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSets.BuilderSingularSetsBuilder<T> octopodes(final java.util.Collection<? extends Number> octopodes) {
|
||||
if ((octopodes == null))
|
||||
throw new java.lang.NullPointerException("octopodes cannot be null");
|
||||
if ((this.octopodes == null))
|
||||
this.octopodes = new java.util.ArrayList<Number>();
|
||||
this.octopodes.addAll(octopodes);
|
||||
@@ -51,6 +55,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSets.BuilderSingularSetsBuilder<T> rawSet(final java.util.Collection<?> rawSet) {
|
||||
if ((rawSet == null))
|
||||
throw new java.lang.NullPointerException("rawSet cannot be null");
|
||||
if ((this.rawSet == null))
|
||||
this.rawSet = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawSet.addAll(rawSet);
|
||||
@@ -68,6 +74,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSets.BuilderSingularSetsBuilder<T> stringSet(final java.util.Collection<? extends String> stringSet) {
|
||||
if ((stringSet == null))
|
||||
throw new java.lang.NullPointerException("stringSet cannot be null");
|
||||
if ((this.stringSet == null))
|
||||
this.stringSet = new java.util.ArrayList<String>();
|
||||
this.stringSet.addAll(stringSet);
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMice(final java.util.Collection<? extends T> dangerMice) {
|
||||
if ((dangerMice == null))
|
||||
throw new java.lang.NullPointerException("dangerMice cannot be null");
|
||||
if ((this.dangerMice == null))
|
||||
this.dangerMice = new java.util.ArrayList<T>();
|
||||
this.dangerMice.addAll(dangerMice);
|
||||
@@ -34,6 +36,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopodes(final java.util.Collection<? extends Number> octopodes) {
|
||||
if ((octopodes == null))
|
||||
throw new java.lang.NullPointerException("octopodes cannot be null");
|
||||
if ((this.octopodes == null))
|
||||
this.octopodes = new java.util.ArrayList<Number>();
|
||||
this.octopodes.addAll(octopodes);
|
||||
@@ -51,6 +55,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withRawSet(final java.util.Collection<?> rawSet) {
|
||||
if ((rawSet == null))
|
||||
throw new java.lang.NullPointerException("rawSet cannot be null");
|
||||
if ((this.rawSet == null))
|
||||
this.rawSet = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawSet.addAll(rawSet);
|
||||
@@ -68,6 +74,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(final java.util.Collection<? extends String> stringSet) {
|
||||
if ((stringSet == null))
|
||||
throw new java.lang.NullPointerException("stringSet cannot be null");
|
||||
if ((this.stringSet == null))
|
||||
this.stringSet = new java.util.ArrayList<String>();
|
||||
this.stringSet.addAll(stringSet);
|
||||
|
||||
@@ -12,6 +12,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder elems(final java.util.Collection<? extends String> elems) {
|
||||
if ((elems == null))
|
||||
throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if ((this.elems == null))
|
||||
this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
|
||||
if ((elems == null))
|
||||
throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if ((this.elems == null))
|
||||
this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
|
||||
@@ -15,6 +15,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder objects(final java.util.Collection<?> objects) {
|
||||
if ((objects == null))
|
||||
throw new java.lang.NullPointerException("objects cannot be null");
|
||||
if ((this.objects == null))
|
||||
this.objects = new java.util.ArrayList<java.lang.Object>();
|
||||
this.objects.addAll(objects);
|
||||
@@ -32,6 +34,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder numbers(final java.util.Collection<? extends Number> numbers) {
|
||||
if ((numbers == null))
|
||||
throw new java.lang.NullPointerException("numbers cannot be null");
|
||||
if ((this.numbers == null))
|
||||
this.numbers = new java.util.ArrayList<Number>();
|
||||
this.numbers.addAll(numbers);
|
||||
|
||||
@@ -12,6 +12,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder elems(final java.util.Collection<? extends String> elems) {
|
||||
if ((elems == null))
|
||||
throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if ((this.elems == null))
|
||||
this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
|
||||
@@ -12,6 +12,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder withElems(final java.util.Collection<? extends String> elems) {
|
||||
if ((elems == null))
|
||||
throw new java.lang.NullPointerException("elems cannot be null");
|
||||
if ((this.elems == null))
|
||||
this.elems = new java.util.ArrayList<String>();
|
||||
this.elems.addAll(elems);
|
||||
|
||||
@@ -25,6 +25,8 @@ public @Builder class BuilderWithDeprecated {
|
||||
return this;
|
||||
}
|
||||
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecated.BuilderWithDeprecatedBuilder strings(final java.util.Collection<? extends String> strings) {
|
||||
if ((strings == null))
|
||||
throw new java.lang.NullPointerException("strings cannot be null");
|
||||
if ((this.strings == null))
|
||||
this.strings = new java.util.ArrayList<String>();
|
||||
this.strings.addAll(strings);
|
||||
@@ -42,6 +44,8 @@ public @Builder class BuilderWithDeprecated {
|
||||
return this;
|
||||
}
|
||||
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecated.BuilderWithDeprecatedBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) {
|
||||
if ((numbers == null))
|
||||
throw new java.lang.NullPointerException("numbers cannot be null");
|
||||
if ((this.numbers == null))
|
||||
this.numbers = com.google.common.collect.ImmutableList.builder();
|
||||
this.numbers.addAll(numbers);
|
||||
|
||||
@@ -28,6 +28,8 @@ import lombok.Builder;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> bars(final java.util.Collection<? extends T> bars) {
|
||||
if ((bars == null))
|
||||
throw new java.lang.NullPointerException("bars cannot be null");
|
||||
if ((this.bars == null))
|
||||
this.bars = new java.util.ArrayList<T>();
|
||||
this.bars.addAll(bars);
|
||||
|
||||
@@ -31,6 +31,8 @@ import lombok.Singular;
|
||||
return this;
|
||||
}
|
||||
public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) {
|
||||
if ((names == null))
|
||||
throw new java.lang.NullPointerException("names cannot be null");
|
||||
if ((this.names == null))
|
||||
this.names = new java.util.ArrayList<String>();
|
||||
this.names.addAll(names);
|
||||
|
||||
@@ -32,6 +32,8 @@ class CheckerFrameworkSuperBuilder {
|
||||
return self();
|
||||
}
|
||||
public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B names(final java.util.Collection<? extends String> names) {
|
||||
if ((names == null))
|
||||
throw new java.lang.NullPointerException("names cannot be null");
|
||||
if ((this.names == null))
|
||||
this.names = new java.util.ArrayList<String>();
|
||||
this.names.addAll(names);
|
||||
|
||||
@@ -44,8 +44,8 @@ public @Builder class I2335_BuilderMultipleObtainVia {
|
||||
return new I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder toBuilder() {
|
||||
String theString = this.getTheString();
|
||||
Long theLong = this.getTheLong();
|
||||
final String theString = this.getTheString();
|
||||
final Long theLong = this.getTheLong();
|
||||
return new I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder().theString(theString).theLong(theLong);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public class SuperBuilderBasic {
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -46,6 +46,8 @@ public class SuperBuilderBasicToBuilder {
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -27,6 +27,8 @@ import lombok.Singular;
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
|
||||
if ((foos == null))
|
||||
throw new java.lang.NullPointerException("foos cannot be null");
|
||||
if ((this.foos == null))
|
||||
this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
this.foos.addAll(foos);
|
||||
@@ -56,6 +58,8 @@ import lombok.Singular;
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
|
||||
if ((bars == null))
|
||||
throw new java.lang.NullPointerException("bars cannot be null");
|
||||
if ((this.bars$key == null))
|
||||
{
|
||||
this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
|
||||
|
||||
@@ -20,6 +20,8 @@ public class SuperBuilderWithCustomBuilderMethod {
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -20,6 +20,8 @@ public class SuperBuilderWithGenerics {
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -20,6 +20,8 @@ public class SuperBuilderWithGenerics2 {
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -33,6 +33,8 @@ public class SuperBuilderWithGenericsAndToBuilder {
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Map<? extends Integer, ? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items$key == null))
|
||||
{
|
||||
this.items$key = new java.util.ArrayList<Integer>();
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
return self();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
|
||||
if ((items == null))
|
||||
throw new java.lang.NullPointerException("items cannot be null");
|
||||
if ((this.items == null))
|
||||
this.items = new java.util.ArrayList<String>();
|
||||
this.items.addAll(items);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//FORMAT: javaLangAsFQN = skip
|
||||
//FORMAT: generated = skip
|
||||
//FORMAT: finalParams = skip
|
||||
//CONF: lombok.singular.nullCollections = ignore
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.Singular;
|
||||
import lombok.Singular.NullCollectionBehavior;
|
||||
|
||||
@lombok.Builder
|
||||
class BuilderSingularNullBehavior1 {
|
||||
@Singular private List<String> names;
|
||||
@Singular(nullBehavior = Singular.NullCollectionBehavior.JDK) private List<String> locations;
|
||||
@Singular(nullBehavior = NullCollectionBehavior.GUAVA) private List<String> whatevers;
|
||||
@Singular(nullBehavior = lombok.Singular.NullCollectionBehavior.IGNORE) private List<String> doohickeys;
|
||||
}
|
||||
Reference in new issue
Block a user