aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/changelog.markdown2
-rw-r--r--src/core/lombok/ConfigurationKeys.java9
-rw-r--r--src/core/lombok/NonNull.java2
-rw-r--r--src/core/lombok/core/TypeLibrary.java6
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java34
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java60
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java14
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java11
-rw-r--r--src/core/lombok/eclipse/handlers/HandleGetter.java11
-rw-r--r--src/core/lombok/eclipse/handlers/HandleNonNull.java21
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSetter.java7
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSuperBuilder.java18
-rw-r--r--src/core/lombok/eclipse/handlers/HandleWither.java7
-rw-r--r--src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java10
-rw-r--r--src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java11
-rw-r--r--src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java16
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java11
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java14
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java7
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java7
-rw-r--r--src/core/lombok/javac/handlers/HandleSuperBuilder.java10
-rw-r--r--src/core/lombok/javac/handlers/HandleWither.java7
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java130
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java6
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java6
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java11
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java4
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java124
-rw-r--r--test/transform/resource/after-delombok/BuilderTypeAnnos.java45
-rw-r--r--test/transform/resource/after-delombok/ConstructorsTypeAnnos.java18
-rw-r--r--test/transform/resource/after-delombok/GetterTypeAnnos.java19
-rw-r--r--test/transform/resource/after-delombok/SetterTypeAnnos.java18
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java137
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderWithNonNull.java10
-rw-r--r--test/transform/resource/after-delombok/WitherTypeAnnos.java21
-rw-r--r--test/transform/resource/after-ecj/BuilderDefaultsWarnings.java4
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java121
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java20
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java12
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularLists.java12
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularMaps.java16
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularNoAuto.java12
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java12
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularSets.java16
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java4
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java4
-rw-r--r--test/transform/resource/after-ecj/BuilderTypeAnnos.java33
-rw-r--r--test/transform/resource/after-ecj/BuilderWithDeprecated.java8
-rw-r--r--test/transform/resource/after-ecj/BuilderWithToBuilder.java4
-rw-r--r--test/transform/resource/after-ecj/ConstructorsTypeAnnos.java14
-rw-r--r--test/transform/resource/after-ecj/GetterTypeAnnos.java17
-rw-r--r--test/transform/resource/after-ecj/SetterTypeAnnos.java17
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderBasic.java4
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java131
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java4
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderWithGenerics.java4
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java4
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderWithNonNull.java4
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java4
-rw-r--r--test/transform/resource/after-ecj/WitherTypeAnnos.java18
-rw-r--r--test/transform/resource/before/BuilderSingularAnnotatedTypes.java14
-rw-r--r--test/transform/resource/before/BuilderTypeAnnos.java14
-rw-r--r--test/transform/resource/before/ConstructorsTypeAnnos.java14
-rw-r--r--test/transform/resource/before/GetterTypeAnnos.java15
-rw-r--r--test/transform/resource/before/SetterTypeAnnos.java15
-rw-r--r--test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java14
-rw-r--r--test/transform/resource/before/WitherTypeAnnos.java18
-rw-r--r--website/templates/features/Builder.html2
-rw-r--r--website/templates/features/Data.html2
-rw-r--r--website/templates/features/GetterSetter.html4
-rw-r--r--website/templates/features/Value.html2
-rw-r--r--website/templates/features/constructor.html2
-rw-r--r--website/templates/features/experimental/SuperBuilder.html2
-rw-r--r--website/templates/features/experimental/Wither.html2
74 files changed, 1295 insertions, 168 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 04c9a052..220e0dc0 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -4,6 +4,8 @@ Lombok Changelog
### v1.18.3 "Edgy Guinea Pig"
* PLATFORM: Support for Eclipse Photon. [Issue #1831](https://github.com/rzwitserloot/lombok/issues/1831)
* FEATURE: The `@FieldNameConstants` feature has been completely redesigned. [Issue #1774](https://github.com/rzwitserloot/lombok/issues/1774) [FieldNameConstants documentation](https://projectlombok.org/features/experimental/FieldNameConstants)
+* FEATURE: Lombok's `@NonNull` annotation can now be used on types (annotation on types has been introduced in JDK 8). `@Builder`'s `@Singular` annotation now properly deals with annotations on the generics type on the collection: `@Singular List<@NonNull String> names;` now does the right thing.
+* BREAKING CHANGE: Lombok will now always copy specific annotations around (from field to getter, from field to builder 'setter', etcetera): A specific curated list of known annotations where that is the right thing to do (generally, `@NonNull` style annotations from various libraries), as well as any annotations you explicitly list in the `lombok.copyableAnnotations` config key in your `lombok.config` file. Also, lombok is more consistent about copying these annotations. (Previous behaviour: Lombok used to copy any annotation whose simple name was `NonNull`, `Nullable`, or `CheckForNull`). [Issue #1570](https://github.com/rzwitserloot/lombok/issues/1570) and [Issue #1634](https://github.com/rzwitserloot/lombok/issues/1634)
* BUGFIX: When using lombok to compile modularized (`module-info.java`-style) code, if the module name has dots in it, it wouldn't work. [Issue #1808](https://github.com/rzwitserloot/lombok/issues/1808)
* BUGFIX: Errors about lombok not reading a module providing `org.mapstruct.ap.spi` when trying to use lombok in jigsaw-mode on JDK 11. [Issue #1806](https://github.com/rzwitserloot/lombok/issues/1806)
* BUGFIX: Fix NetBeans compile on save. [Issue #1770](https://github.com/rzwitserloot/lombok/issues/1770)
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index 184ded27..2cca27fa 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -27,6 +27,7 @@ import lombok.core.configuration.CallSuperType;
import lombok.core.configuration.ConfigurationKey;
import lombok.core.configuration.FlagUsageType;
import lombok.core.configuration.NullCheckExceptionType;
+import lombok.core.configuration.TypeName;
/**
* A container class containing all lombok configuration keys that do not belong to a specific annotation.
@@ -563,4 +564,12 @@ public class ConfigurationKeys {
* If set to {@code true}, no further {@code lombok.config} files will be checked.
*/
public static final ConfigurationKey<Boolean> STOP_BUBBLING = new ConfigurationKey<Boolean>("config.stopBubbling", "Tell the configuration system it should stop looking for other configuration files (default: false).") {};
+
+ /**
+ * lombok configuration: {@code lombok.copyableAnnotations} += &lt;TypeName: fully-qualified annotation class name&gt;.
+ *
+ * Copy these annotations to getters, setters, withers, builder-setters, etc.
+ */
+ public static final ConfigurationKey<List<TypeName>> COPYABLE_ANNOTATIONS = new ConfigurationKey<List<TypeName>>("lombok.copyableAnnotations", "Copy these annotations to getters, setters, withers, builder-setters, etc.") {};
+
}
diff --git a/src/core/lombok/NonNull.java b/src/core/lombok/NonNull.java
index 58538583..caf6ed05 100644
--- a/src/core/lombok/NonNull.java
+++ b/src/core/lombok/NonNull.java
@@ -41,7 +41,7 @@ import java.lang.annotation.Target;
* this annotation will <strong>be deleted</strong> from the lombok package. If the need to update an import statement scares
* you, you should use your own annotation named {@code @NonNull} instead of this one.
*/
-@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
@Retention(RetentionPolicy.CLASS)
@Documented
public @interface NonNull {
diff --git a/src/core/lombok/core/TypeLibrary.java b/src/core/lombok/core/TypeLibrary.java
index cdaf7a70..ceaf5f90 100644
--- a/src/core/lombok/core/TypeLibrary.java
+++ b/src/core/lombok/core/TypeLibrary.java
@@ -45,6 +45,12 @@ public class TypeLibrary {
qualified = null;
}
+ public TypeLibrary(TypeLibrary parent) {
+ unqualifiedToQualifiedMap = new HashMap<String, String>();
+ unqualified = null;
+ qualified = null;
+ }
+
public void lock() {
this.locked = true;
}
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index 0d64c550..296b70b4 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.regex.Pattern;
import lombok.AllArgsConstructor;
import lombok.ConfigurationKeys;
@@ -77,6 +76,33 @@ public class HandlerUtil {
return 43;
}
+ public static final List<String> NONNULL_ANNOTATIONS, BASE_COPYABLE_ANNOTATIONS;
+ static {
+ NONNULL_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] {
+ "lombok.NonNull",
+ "javax.annotation.Nonnull",
+ "edu.umd.cs.findbugs.annotations.NonNull",
+ "org.jetbrains.annotations.NotNull",
+ "android.support.annotation.NonNull",
+ "org.eclipse.jdt.annotation.NonNull",
+ }));
+ BASE_COPYABLE_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] {
+ "lombok.NonNull",
+ "javax.annotation.Nonnull",
+ "edu.umd.cs.findbugs.annotations.NonNull",
+ "org.jetbrains.annotations.NotNull",
+ "android.support.annotation.NonNull",
+ "org.eclipse.jdt.annotation.NonNull",
+ "javax.annotation.Nullable",
+ "javax.annotation.CheckForNull",
+ "edu.umd.cs.findbugs.annotations.UnknownNullness",
+ "edu.umd.cs.findbugs.annotations.Nullable",
+ "org.jetbrains.annotations.Nullable",
+ "android.support.annotation.Nullable",
+ "org.eclipse.jdt.annotation.Nullable",
+ }));
+ }
+
/** Checks if the given name is a valid identifier.
*
* If it is, this returns {@code true} and does nothing else.
@@ -222,12 +248,6 @@ public class HandlerUtil {
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. */
- /** Matches the simple part of any annotation that lombok considers as indicative of NonNull status. */
- public static final Pattern NON_NULL_PATTERN = Pattern.compile("^(?:nonnull)$", Pattern.CASE_INSENSITIVE);
-
- /** Matches the simple part of any annotation that lombok considers as indicative of Nullable status. */
- public static final Pattern NULLABLE_PATTERN = Pattern.compile("^(?:nullable|checkfornull)$", Pattern.CASE_INSENSITIVE);
-
public static final String DEFAULT_EXCEPTION_FOR_NON_NULL = "java.lang.NullPointerException";
/**
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 1e29764a..5d582aad 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -48,6 +48,7 @@ import lombok.core.AnnotationValues;
import lombok.core.AnnotationValues.AnnotationValue;
import lombok.core.TypeResolver;
import lombok.core.configuration.NullCheckExceptionType;
+import lombok.core.configuration.TypeName;
import lombok.core.debug.ProblemReporter;
import lombok.core.handlers.HandlerUtil;
import lombok.eclipse.Eclipse;
@@ -448,6 +449,24 @@ public class EclipseHandlerUtil {
return out;
}
+ public static Annotation[] getTypeUseAnnotations(TypeReference from) {
+ Annotation[][] a;
+ try {
+ a = (Annotation[][]) reflect(TYPE_REFERENCE__ANNOTATIONS, from);
+ } catch (Exception e) {
+ return null;
+ }
+ if (a == null) return null;
+ Annotation[] b = a[a.length - 1];
+ return b.length == 0 ? null : b;
+ }
+
+ public static void removeTypeUseAnnotations(TypeReference from) {
+ try {
+ reflectSet(TYPE_REFERENCE__ANNOTATIONS, from, null);
+ } catch (Exception ignore) {}
+ }
+
public static TypeReference namePlusTypeParamsToTypeReference(char[] typeName, TypeParameter[] params, long p) {
if (params != null && params.length > 0) {
TypeReference[] refs = new TypeReference[params.length];
@@ -672,6 +691,47 @@ public class EclipseHandlerUtil {
}
}
+ public static boolean hasNonNullAnnotations(EclipseNode node) {
+ AbstractVariableDeclaration avd = (AbstractVariableDeclaration) node.get();
+ if (avd.annotations == null) return false;
+ for (Annotation annotation : avd.annotations) {
+ TypeReference typeRef = annotation.type;
+ if (typeRef != null && typeRef.getTypeName() != null) {
+ for (String bn : NONNULL_ANNOTATIONS) if (typeMatches(bn, node, typeRef)) return true;
+ }
+ }
+ return false;
+ }
+
+ private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0];
+
+ /**
+ * Searches the given field node for annotations and returns each one that is 'copyable' (either via configuration or from the base list).
+ */
+ public static Annotation[] findCopyableAnnotations(EclipseNode node) {
+ AbstractVariableDeclaration avd = (AbstractVariableDeclaration) node.get();
+ if (avd.annotations == null) return EMPTY_ANNOTATIONS_ARRAY;
+ List<Annotation> result = new ArrayList<Annotation>();
+ List<TypeName> configuredCopyable = node.getAst().readConfiguration(ConfigurationKeys.COPYABLE_ANNOTATIONS);
+
+ for (Annotation annotation : avd.annotations) {
+ TypeReference typeRef = annotation.type;
+ boolean match = false;
+ if (typeRef != null && typeRef.getTypeName() != null) {
+ for (TypeName cn : configuredCopyable) if (typeMatches(cn.toString(), node, typeRef)) {
+ result.add(annotation);
+ match = true;
+ break;
+ }
+ if (!match) for (String bn : BASE_COPYABLE_ANNOTATIONS) if (typeMatches(bn, node, typeRef)) {
+ result.add(annotation);
+ break;
+ }
+ }
+ }
+ return result.toArray(EMPTY_ANNOTATIONS_ARRAY);
+ }
+
/**
* Checks if the provided annotation type is likely to be the intended type for the given annotation node.
*
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index 3b10483d..f6e0a175 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -106,6 +106,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
}
public static class BuilderFieldData {
+ Annotation[] annotations;
TypeReference type;
char[] rawName;
char[] name;
@@ -199,9 +200,12 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
EclipseNode isDefault = findAnnotation(Builder.Default.class, fieldNode);
boolean isFinal = ((fd.modifiers & ClassFileConstants.AccFinal) != 0) || (valuePresent && !hasAnnotation(NonFinal.class, fieldNode));
+ Annotation[] copyableAnnotations = findCopyableAnnotations(fieldNode);
+
BuilderFieldData bfd = new BuilderFieldData();
bfd.rawName = fieldNode.getName().toCharArray();
bfd.name = removePrefixFromField(fieldNode);
+ bfd.annotations = copyAnnotations(fd, copyableAnnotations);
bfd.type = fd.type;
bfd.singularData = getSingularData(fieldNode, ast);
bfd.originalFieldNode = fieldNode;
@@ -374,8 +378,12 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
if (param.getKind() != Kind.ARGUMENT) continue;
BuilderFieldData bfd = new BuilderFieldData();
Argument arg = (Argument) param.get();
+
+ Annotation[] copyableAnnotations = findCopyableAnnotations(param);
+
bfd.rawName = arg.name;
bfd.name = arg.name;
+ bfd.annotations = copyAnnotations(arg, copyableAnnotations);
bfd.type = arg.type;
bfd.singularData = getSingularData(param, ast);
bfd.originalFieldNode = param;
@@ -744,13 +752,13 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
public void makeSetterMethodsForBuilder(EclipseNode builderType, BuilderFieldData bfd, EclipseNode sourceNode, boolean fluent, boolean chain) {
boolean deprecate = isFieldDeprecated(bfd.originalFieldNode);
if (bfd.singularData == null || bfd.singularData.getSingularizer() == null) {
- makeSimpleSetterMethodForBuilder(builderType, deprecate, bfd.createdFields.get(0), bfd.nameOfSetFlag, sourceNode, fluent, chain);
+ makeSimpleSetterMethodForBuilder(builderType, deprecate, bfd.createdFields.get(0), bfd.nameOfSetFlag, sourceNode, fluent, chain, bfd.annotations);
} else {
bfd.singularData.getSingularizer().generateMethods(bfd.singularData, deprecate, builderType, fluent, chain);
}
}
- private void makeSimpleSetterMethodForBuilder(EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] nameOfSetFlag, EclipseNode sourceNode, boolean fluent, boolean chain) {
+ private void makeSimpleSetterMethodForBuilder(EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] nameOfSetFlag, EclipseNode sourceNode, boolean fluent, boolean chain, Annotation[] annotations) {
TypeDeclaration td = (TypeDeclaration) builderType.get();
AbstractMethodDeclaration[] existing = td.methods;
if (existing == null) existing = EMPTY;
@@ -767,7 +775,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
String setterName = fluent ? fieldNode.getName() : HandlerUtil.buildAccessorName("set", fieldNode.getName());
MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, nameOfSetFlag, chain, ClassFileConstants.AccPublic,
- sourceNode, Collections.<Annotation>emptyList(), Collections.<Annotation>emptyList());
+ sourceNode, Collections.<Annotation>emptyList(), annotations != null ? Arrays.asList(copyAnnotations(sourceNode.get(), annotations)) : Collections.<Annotation>emptyList());
injectMethod(builderType, setter);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 6c7b4caf..cb07115a 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -139,7 +139,7 @@ public class HandleConstructor {
FieldDeclaration fieldDecl = (FieldDeclaration) child.get();
if (!filterField(fieldDecl)) continue;
boolean isFinal = (fieldDecl.modifiers & ClassFileConstants.AccFinal) != 0;
- boolean isNonNull = nullMarked && findAnnotations(fieldDecl, NON_NULL_PATTERN).length != 0;
+ boolean isNonNull = nullMarked && hasNonNullAnnotations(child);
if ((isFinal || isNonNull) && fieldDecl.initialization == null) fields.add(child);
}
return fields;
@@ -403,13 +403,12 @@ public class HandleConstructor {
assigns.add(assignment);
long fieldPos = (((long) field.sourceStart) << 32) | field.sourceEnd;
Argument parameter = new Argument(fieldName, fieldPos, copyType(field.type, source), Modifier.FINAL);
- Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
- Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
- if (nonNulls.length != 0) {
+ Annotation[] copyableAnnotations = findCopyableAnnotations(fieldNode);
+ if (hasNonNullAnnotations(fieldNode)) {
Statement nullCheck = generateNullCheck(parameter, sourceNode);
if (nullCheck != null) nullChecks.add(nullCheck);
}
- parameter.annotations = copyAnnotations(source, nonNulls, nullables);
+ parameter.annotations = copyAnnotations(source, copyableAnnotations);
params.add(parameter);
}
@@ -546,7 +545,7 @@ public class HandleConstructor {
assigns.add(nameRef);
Argument parameter = new Argument(field.name, fieldPos, copyType(field.type, source), Modifier.FINAL);
- parameter.annotations = copyAnnotations(source, findAnnotations(field, NON_NULL_PATTERN), findAnnotations(field, NULLABLE_PATTERN));
+ parameter.annotations = copyAnnotations(source, findCopyableAnnotations(fieldNode));
params.add(parameter);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java
index d0c2cc23..7d3fe62f 100644
--- a/src/core/lombok/eclipse/handlers/HandleGetter.java
+++ b/src/core/lombok/eclipse/handlers/HandleGetter.java
@@ -236,8 +236,6 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
}
public MethodDeclaration createGetter(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, boolean lazy, List<Annotation> onMethod) {
- FieldDeclaration field = (FieldDeclaration) fieldNode.get();
-
// Remember the type; lazy will change it;
TypeReference returnType = copyType(((FieldDeclaration) fieldNode.get()).type, source);
@@ -271,11 +269,10 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
}
method.annotations = copyAnnotations(source,
- onMethod.toArray(new Annotation[0]),
- findAnnotations(field, NON_NULL_PATTERN),
- findAnnotations(field, NULLABLE_PATTERN),
- findDelegatesAndMarkAsHandled(fieldNode),
- deprecated);
+ onMethod.toArray(new Annotation[0]),
+ findCopyableAnnotations(fieldNode),
+ findDelegatesAndMarkAsHandled(fieldNode),
+ deprecated);
}
method.traverse(new SetGeneratedByVisitor(source), parent.scope);
diff --git a/src/core/lombok/eclipse/handlers/HandleNonNull.java b/src/core/lombok/eclipse/handlers/HandleNonNull.java
index d09993ed..ebc62909 100644
--- a/src/core/lombok/eclipse/handlers/HandleNonNull.java
+++ b/src/core/lombok/eclipse/handlers/HandleNonNull.java
@@ -58,7 +58,26 @@ import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseAnnotationHandler.class)
@HandlerPriority(value = 512) // 2^9; onParameter=@__(@NonNull) has to run first.
public class HandleNonNull extends EclipseAnnotationHandler<NonNull> {
+ public static final HandleNonNull INSTANCE = new HandleNonNull();
+
+ public void fix(EclipseNode method) {
+ for (EclipseNode m : method.down()) {
+ if (m.getKind() != Kind.ARGUMENT) continue;
+ for (EclipseNode c : m.down()) {
+ if (c.getKind() == Kind.ANNOTATION) {
+ if (annotationTypeMatches(NonNull.class, c)) {
+ handle0((Annotation) c.get(), c, true);
+ }
+ }
+ }
+ }
+ }
+
@Override public void handle(AnnotationValues<NonNull> annotation, Annotation ast, EclipseNode annotationNode) {
+ handle0(ast, annotationNode, false);
+ }
+
+ private void handle0(Annotation ast, EclipseNode annotationNode, boolean force) {
handleFlagUsage(annotationNode, ConfigurationKeys.NON_NULL_FLAG_USAGE, "@NonNull");
if (annotationNode.up().getKind() == Kind.FIELD) {
@@ -88,7 +107,7 @@ public class HandleNonNull extends EclipseAnnotationHandler<NonNull> {
return;
}
- if (isGenerated(declaration)) return;
+ if (!force && isGenerated(declaration)) return;
if (declaration.isAbstract()) {
// This used to be a warning, but as @NonNull also has a documentary purpose, better to not warn about this. Since 1.16.7
diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java
index d4df0deb..529a7d19 100644
--- a/src/core/lombok/eclipse/handlers/HandleSetter.java
+++ b/src/core/lombok/eclipse/handlers/HandleSetter.java
@@ -236,10 +236,9 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
method.bodyStart = method.declarationSourceStart = method.sourceStart = source.sourceStart;
method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
- Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
- Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
+ Annotation[] copyableAnnotations = findCopyableAnnotations(fieldNode);
List<Statement> statements = new ArrayList<Statement>(5);
- if (nonNulls.length == 0) {
+ if (!hasNonNullAnnotations(fieldNode)) {
statements.add(assignment);
} else {
Statement nullCheck = generateNullCheck(field, sourceNode);
@@ -255,7 +254,7 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
statements.add(returnStatement);
}
method.statements = statements.toArray(new Statement[0]);
- param.annotations = copyAnnotations(source, nonNulls, nullables, onParam.toArray(new Annotation[0]));
+ param.annotations = copyAnnotations(source, copyableAnnotations, onParam.toArray(new Annotation[0]));
method.traverse(new SetGeneratedByVisitor(source), parent.scope);
return method;
diff --git a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
index 8f353cce..97e38904 100644
--- a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
@@ -156,9 +156,12 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
EclipseNode isDefault = findAnnotation(Builder.Default.class, fieldNode);
boolean isFinal = ((fd.modifiers & ClassFileConstants.AccFinal) != 0) || (valuePresent && !hasAnnotation(NonFinal.class, fieldNode));
+ Annotation[] copyableAnnotations = findCopyableAnnotations(fieldNode);
+
BuilderFieldData bfd = new BuilderFieldData();
bfd.rawName = fieldNode.getName().toCharArray();
bfd.name = removePrefixFromField(fieldNode);
+ bfd.annotations = copyAnnotations(fd, copyableAnnotations);
bfd.type = fd.type;
bfd.singularData = getSingularData(fieldNode, ast);
bfd.originalFieldNode = fieldNode;
@@ -516,12 +519,9 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
statements.add(assignment);
}
- Annotation[] nonNulls = findAnnotations((FieldDeclaration)fieldNode.originalFieldNode.get(), NON_NULL_PATTERN);
- if (nonNulls.length != 0) {
- Statement nullCheck = generateNullCheck((FieldDeclaration)fieldNode.originalFieldNode.get(), sourceNode);
- if (nullCheck != null) {
- statements.add(nullCheck);
- }
+ if (hasNonNullAnnotations(fieldNode.originalFieldNode)) {
+ Statement nullCheck = generateNullCheck((FieldDeclaration) fieldNode.originalFieldNode.get(), sourceNode);
+ if (nullCheck != null) statements.add(nullCheck);
}
}
@@ -851,13 +851,13 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
};
if (bfd.singularData == null || bfd.singularData.getSingularizer() == null) {
- generateSimpleSetterMethodForBuilder(builderType, deprecate, bfd.createdFields.get(0), bfd.nameOfSetFlag, returnTypeMaker.make(), returnStatementMaker.make(), sourceNode);
+ generateSimpleSetterMethodForBuilder(builderType, deprecate, bfd.createdFields.get(0), bfd.nameOfSetFlag, returnTypeMaker.make(), returnStatementMaker.make(), sourceNode, bfd.annotations);
} else {
bfd.singularData.getSingularizer().generateMethods(bfd.singularData, deprecate, builderType, true, returnTypeMaker, returnStatementMaker);
}
}
- private void generateSimpleSetterMethodForBuilder(EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] nameOfSetFlag, TypeReference returnType, Statement returnStatement, EclipseNode sourceNode) {
+ private void generateSimpleSetterMethodForBuilder(EclipseNode builderType, boolean deprecate, EclipseNode fieldNode, char[] nameOfSetFlag, TypeReference returnType, Statement returnStatement, EclipseNode sourceNode, Annotation[] annosOnParam) {
TypeDeclaration td = (TypeDeclaration) builderType.get();
AbstractMethodDeclaration[] existing = td.methods;
if (existing == null) existing = EMPTY_METHODS;
@@ -874,7 +874,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
String setterName = fieldNode.getName();
MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, nameOfSetFlag, returnType, returnStatement, ClassFileConstants.AccPublic,
- sourceNode, Collections.<Annotation>emptyList(), Collections.<Annotation>emptyList());
+ sourceNode, Collections.<Annotation>emptyList(), annosOnParam != null ? Arrays.asList(copyAnnotations(sourceNode.get(), annosOnParam)) : Collections.<Annotation>emptyList());
injectMethod(builderType, setter);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleWither.java b/src/core/lombok/eclipse/handlers/HandleWither.java
index c035fc26..a99789a6 100644
--- a/src/core/lombok/eclipse/handlers/HandleWither.java
+++ b/src/core/lombok/eclipse/handlers/HandleWither.java
@@ -240,8 +240,7 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
method.typeParameters = null;
method.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
- Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
- Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
+ Annotation[] copyableAnnotations = findCopyableAnnotations(fieldNode);
if (!makeAbstract) {
List<Expression> args = new ArrayList<Expression>();
@@ -277,7 +276,7 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
List<Statement> statements = new ArrayList<Statement>(5);
- if (nonNulls.length > 0) {
+ if (hasNonNullAnnotations(fieldNode)) {
Statement nullCheck = generateNullCheck(field, sourceNode);
if (nullCheck != null) statements.add(nullCheck);
}
@@ -285,7 +284,7 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
method.statements = statements.toArray(new Statement[0]);
}
- param.annotations = copyAnnotations(source, nonNulls, nullables, onParam.toArray(new Annotation[0]));
+ param.annotations = copyAnnotations(source, copyableAnnotations, onParam.toArray(new Annotation[0]));
method.traverse(new SetGeneratedByVisitor(source), parent.scope);
return method;
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
index f1687c9c..17fc5e09 100644
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
@@ -32,6 +32,7 @@ import lombok.core.GuavaTypeMap;
import lombok.core.LombokImmutableList;
import lombok.core.handlers.HandlerUtil;
import lombok.eclipse.EclipseNode;
+import lombok.eclipse.handlers.HandleNonNull;
import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.eclipse.handlers.EclipseSingularsRecipes.StatementMaker;
@@ -150,14 +151,17 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer {
md.arguments = new Argument[suffixes.size()];
for (int i = 0; i < suffixes.size(); i++) {
TypeReference tr = cloneParamType(i, data.getTypeArgs(), builderType);
- md.arguments[i] = new Argument(names[i], 0, tr, 0);
+ Annotation[] typeUseAnns = getTypeUseAnnotations(tr);
+ removeTypeUseAnnotations(tr);
+ md.arguments[i] = new Argument(names[i], 0, tr, ClassFileConstants.AccFinal);
+ md.arguments[i].annotations = typeUseAnns;
}
md.returnType = returnType;
md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName(getAddMethodName(), new String(data.getSingularName())).toCharArray();
md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null;
data.setGeneratedByRecursive(md);
- injectMethod(builderType, md);
+ HandleNonNull.INSTANCE.fix(injectMethod(builderType, md));
}
void generatePluralMethod(boolean deprecate, TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType, boolean fluent) {
@@ -182,7 +186,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer {
TypeReference paramType;
paramType = new QualifiedTypeReference(fromQualifiedName(getAddAllTypeName()), NULL_POSS);
paramType = addTypeArgs(getTypeArgumentsCount(), true, builderType, paramType, data.getTypeArgs());
- Argument param = new Argument(data.getPluralName(), 0, paramType, 0);
+ Argument param = new Argument(data.getPluralName(), 0, paramType, ClassFileConstants.AccFinal);
md.arguments = new Argument[] {param};
md.returnType = returnType;
md.selector = fluent ? data.getPluralName() : HandlerUtil.buildAccessorName(getAddMethodName() + "All", new String(data.getPluralName())).toCharArray();
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java
index 5f86a4dc..c7315790 100644
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java
@@ -30,6 +30,7 @@ import java.util.List;
import lombok.core.handlers.HandlerUtil;
import lombok.eclipse.EclipseNode;
+import lombok.eclipse.handlers.HandleNonNull;
import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.eclipse.handlers.EclipseSingularsRecipes.StatementMaker;
import lombok.eclipse.handlers.EclipseSingularsRecipes.TypeReferenceMaker;
@@ -138,14 +139,18 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula
md.statements = statements.toArray(new Statement[statements.size()]);
TypeReference paramType = cloneParamType(0, data.getTypeArgs(), builderType);
- Argument param = new Argument(data.getSingularName(), 0, paramType, 0);
+ Annotation[] typeUseAnns = getTypeUseAnnotations(paramType);
+ removeTypeUseAnnotations(paramType);
+ Argument param = new Argument(data.getSingularName(), 0, paramType, ClassFileConstants.AccFinal);
+ param.annotations = typeUseAnns;
md.arguments = new Argument[] {param};
md.returnType = returnType;
md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName("add", new String(data.getSingularName())).toCharArray();
md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null;
data.setGeneratedByRecursive(md);
- injectMethod(builderType, md);
+
+ HandleNonNull.INSTANCE.fix(injectMethod(builderType, md));
}
void generatePluralMethod(boolean deprecate, TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType, boolean fluent) {
@@ -169,7 +174,7 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula
TypeReference paramType = new QualifiedTypeReference(TypeConstants.JAVA_UTIL_COLLECTION, NULL_POSS);
paramType = addTypeArgs(1, true, builderType, paramType, data.getTypeArgs());
- Argument param = new Argument(data.getPluralName(), 0, paramType, 0);
+ Argument param = new Argument(data.getPluralName(), 0, paramType, ClassFileConstants.AccFinal);
md.arguments = new Argument[] {param};
md.returnType = returnType;
md.selector = fluent ? data.getPluralName() : HandlerUtil.buildAccessorName("addAll", new String(data.getPluralName())).toCharArray();
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
index 69c2186a..174cd5fc 100644
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
@@ -59,6 +59,7 @@ import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.eclipse.handlers.EclipseSingularsRecipes.StatementMaker;
import lombok.eclipse.handlers.EclipseSingularsRecipes.TypeReferenceMaker;
+import lombok.eclipse.handlers.HandleNonNull;
@ProviderFor(EclipseSingularizer.class)
public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer {
@@ -214,16 +215,23 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer
md.statements = statements.toArray(new Statement[statements.size()]);
TypeReference keyParamType = cloneParamType(0, data.getTypeArgs(), builderType);
- Argument keyParam = new Argument(keyParamName, 0, keyParamType, 0);
TypeReference valueParamType = cloneParamType(1, data.getTypeArgs(), builderType);
- Argument valueParam = new Argument(valueParamName, 0, valueParamType, 0);
+ Annotation[] typeUseAnnsKey = getTypeUseAnnotations(keyParamType);
+ Annotation[] typeUseAnnsValue = getTypeUseAnnotations(valueParamType);
+
+ removeTypeUseAnnotations(keyParamType);
+ removeTypeUseAnnotations(valueParamType);
+ Argument keyParam = new Argument(keyParamName, 0, keyParamType, ClassFileConstants.AccFinal);
+ Argument valueParam = new Argument(valueParamName, 0, valueParamType, ClassFileConstants.AccFinal);
+ keyParam.annotations = typeUseAnnsKey;
+ valueParam.annotations = typeUseAnnsValue;
md.arguments = new Argument[] {keyParam, valueParam};
md.returnType = returnType;
md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName("put", new String(data.getSingularName())).toCharArray();
md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null;
data.setGeneratedByRecursive(md);
- injectMethod(builderType, md);
+ HandleNonNull.INSTANCE.fix(injectMethod(builderType, md));
}
private void generatePluralMethod(boolean deprecate, TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType, boolean fluent) {
@@ -280,7 +288,7 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer
TypeReference paramType = new QualifiedTypeReference(JAVA_UTIL_MAP, NULL_POSS);
paramType = addTypeArgs(2, true, builderType, paramType, data.getTypeArgs());
- Argument param = new Argument(data.getPluralName(), 0, paramType, 0);
+ Argument param = new Argument(data.getPluralName(), 0, paramType, ClassFileConstants.AccFinal);
md.arguments = new Argument[] {param};
md.returnType = returnType;
md.selector = fluent ? data.getPluralName() : HandlerUtil.buildAccessorName("putAll", new String(data.getPluralName())).toCharArray();
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index 201b5048..bf260644 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -85,6 +85,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
}
public static class BuilderFieldData {
+ List<JCAnnotation> annotations;
JCExpression type;
Name rawName;
Name name;
@@ -148,9 +149,11 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
JCVariableDecl fd = (JCVariableDecl) fieldNode.get();
JavacNode isDefault = findAnnotation(Builder.Default.class, fieldNode, false);
boolean isFinal = (fd.mods.flags & Flags.FINAL) != 0 || (valuePresent && !hasAnnotation(NonFinal.class, fieldNode));
+
BuilderFieldData bfd = new BuilderFieldData();
bfd.rawName = fd.name;
bfd.name = removePrefixFromField(fieldNode);
+ bfd.annotations = findCopyableAnnotations(fieldNode);
bfd.type = fd.vartype;
bfd.singularData = getSingularData(fieldNode);
bfd.originalFieldNode = fieldNode;
@@ -326,9 +329,11 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
for (JavacNode param : fillParametersFrom.down()) {
if (param.getKind() != Kind.ARGUMENT) continue;
BuilderFieldData bfd = new BuilderFieldData();
+
JCVariableDecl raw = (JCVariableDecl) param.get();
bfd.name = raw.name;
bfd.rawName = raw.name;
+ bfd.annotations = findCopyableAnnotations(param);
bfd.type = raw.vartype;
bfd.singularData = getSingularData(param);
bfd.originalFieldNode = param;
@@ -678,13 +683,13 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
public void makeSetterMethodsForBuilder(JavacNode builderType, BuilderFieldData fieldNode, JavacNode source, boolean fluent, boolean chain) {
boolean deprecate = isFieldDeprecated(fieldNode.originalFieldNode);
if (fieldNode.singularData == null || fieldNode.singularData.getSingularizer() == null) {
- makeSimpleSetterMethodForBuilder(builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.nameOfSetFlag, source, fluent, chain);
+ makeSimpleSetterMethodForBuilder(builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.nameOfSetFlag, source, fluent, chain, fieldNode.annotations);
} else {
fieldNode.singularData.getSingularizer().generateMethods(fieldNode.singularData, deprecate, builderType, source.get(), fluent, chain);
}
}
- private void makeSimpleSetterMethodForBuilder(JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name nameOfSetFlag, JavacNode source, boolean fluent, boolean chain) {
+ private void makeSimpleSetterMethodForBuilder(JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name nameOfSetFlag, JavacNode source, boolean fluent, boolean chain, List<JCAnnotation> annosOnParam) {
Name fieldName = ((JCVariableDecl) fieldNode.get()).name;
for (JavacNode child : builderType.down()) {
@@ -698,7 +703,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
JavacTreeMaker maker = fieldNode.getTreeMaker();
- JCMethodDecl newMethod = HandleSetter.createSetter(Flags.PUBLIC, deprecate, fieldNode, maker, setterName, nameOfSetFlag, chain, source, List.<JCAnnotation>nil(), List.<JCAnnotation>nil());
+ JCMethodDecl newMethod = HandleSetter.createSetter(Flags.PUBLIC, deprecate, fieldNode, maker, setterName, nameOfSetFlag, chain, source, List.<JCAnnotation>nil(), annosOnParam);
injectMethod(builderType, newMethod);
}
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index 76caaffe..3c434d40 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -127,7 +127,7 @@ public class HandleConstructor {
//Skip static fields.
if ((fieldFlags & Flags.STATIC) != 0) continue;
boolean isFinal = (fieldFlags & Flags.FINAL) != 0;
- boolean isNonNull = nullMarked && !findAnnotations(child, NON_NULL_PATTERN).isEmpty();
+ boolean isNonNull = nullMarked && hasNonNullAnnotations(child);
if ((isFinal || isNonNull) && fieldDecl.init == null) fields.append(child);
}
return fields.toList();
@@ -329,12 +329,11 @@ public class HandleConstructor {
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
Name fieldName = removePrefixFromField(fieldNode);
Name rawName = field.name;
- List<JCAnnotation> nonNulls = findAnnotations(fieldNode, NON_NULL_PATTERN);
- List<JCAnnotation> nullables = findAnnotations(fieldNode, NULLABLE_PATTERN);
+ List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(fieldNode);
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, typeNode.getContext());
- JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, nonNulls.appendList(nullables)), fieldName, field.vartype, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, copyableAnnotations), fieldName, field.vartype, null);
params.append(param);
- if (!nonNulls.isEmpty()) {
+ if (hasNonNullAnnotations(fieldNode)) {
JCStatement nullCheck = generateNullCheck(maker, fieldNode, param, source);
if (nullCheck != null) nullChecks.append(nullCheck);
}
@@ -471,10 +470,9 @@ public class HandleConstructor {
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
Name fieldName = removePrefixFromField(fieldNode);
JCExpression pType = cloneType(maker, field.vartype, source, typeNode.getContext());
- List<JCAnnotation> nonNulls = findAnnotations(fieldNode, NON_NULL_PATTERN);
- List<JCAnnotation> nullables = findAnnotations(fieldNode, NULLABLE_PATTERN);
+ List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(fieldNode);
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, typeNode.getContext());
- JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, nonNulls.appendList(nullables)), fieldName, pType, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, copyableAnnotations), fieldName, pType, null);
params.append(param);
args.append(maker.Ident(fieldName));
}
diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java
index 4fc6155c..7a178f66 100644
--- a/src/core/lombok/javac/handlers/HandleGetter.java
+++ b/src/core/lombok/javac/handlers/HandleGetter.java
@@ -243,12 +243,9 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
List<JCExpression> throwsClauses = List.nil();
JCExpression annotationMethodDefaultValue = null;
- List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN);
- List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN);
-
+ List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(field);
List<JCAnnotation> delegates = findDelegatesAndRemoveFromField(field);
-
- List<JCAnnotation> annsOnMethod = copyAnnotations(onMethod).appendList(nonNulls).appendList(nullables);
+ List<JCAnnotation> annsOnMethod = copyAnnotations(onMethod).appendList(copyableAnnotations);
if (isFieldDeprecated(field)) {
annsOnMethod = annsOnMethod.prepend(treeMaker.Annotation(genJavaLangTypeRef(field, "Deprecated"), List.<JCExpression>nil()));
}
diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java
index 0ddaa7d7..28f5318d 100644
--- a/src/core/lombok/javac/handlers/HandleSetter.java
+++ b/src/core/lombok/javac/handlers/HandleSetter.java
@@ -226,16 +226,15 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> {
JCAssign assign = treeMaker.Assign(fieldRef, treeMaker.Ident(fieldDecl.name));
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
- List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN);
- List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN);
+ List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(field);
Name methodName = field.toName(setterName);
- List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables);
+ List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(copyableAnnotations);
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext());
JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
- if (nonNulls.isEmpty()) {
+ if (!hasNonNullAnnotations(field)) {
statements.append(treeMaker.Exec(assign));
} else {
JCStatement nullCheck = generateNullCheck(treeMaker, field, source);
diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
index a440c9be..c84988ea 100644
--- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
@@ -131,6 +131,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
BuilderFieldData bfd = new BuilderFieldData();
bfd.rawName = fd.name;
bfd.name = removePrefixFromField(fieldNode);
+ bfd.annotations = findCopyableAnnotations(fieldNode);
bfd.type = fd.vartype;
bfd.singularData = getSingularData(fieldNode);
bfd.originalFieldNode = fieldNode;
@@ -451,8 +452,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
statements.append(assign);
}
- List<JCAnnotation> nonNulls = findAnnotations(bfd.originalFieldNode, NON_NULL_PATTERN);
- if (!nonNulls.isEmpty()) {
+ if (hasNonNullAnnotations(bfd.originalFieldNode)) {
JCStatement nullCheck = generateNullCheck(maker, bfd.originalFieldNode, source);
if (nullCheck != null) statements.append(nullCheck);
}
@@ -797,13 +797,13 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
}};
if (fieldNode.singularData == null || fieldNode.singularData.getSingularizer() == null) {
- generateSimpleSetterMethodForBuilder(builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.nameOfSetFlag, source, true, returnTypeMaker.make(), returnStatementMaker.make());
+ generateSimpleSetterMethodForBuilder(builderType, deprecate, fieldNode.createdFields.get(0), fieldNode.nameOfSetFlag, source, true, returnTypeMaker.make(), returnStatementMaker.make(), fieldNode.annotations);
} else {
fieldNode.singularData.getSingularizer().generateMethods(fieldNode.singularData, deprecate, builderType, source.get(), true, returnTypeMaker, returnStatementMaker);
}
}
- private void generateSimpleSetterMethodForBuilder(JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name nameOfSetFlag, JavacNode source, boolean fluent, JCExpression returnType, JCStatement returnStatement) {
+ private void generateSimpleSetterMethodForBuilder(JavacNode builderType, boolean deprecate, JavacNode fieldNode, Name nameOfSetFlag, JavacNode source, boolean fluent, JCExpression returnType, JCStatement returnStatement, List<JCAnnotation> annosOnParam) {
Name fieldName = ((JCVariableDecl) fieldNode.get()).name;
for (JavacNode child : builderType.down()) {
@@ -817,7 +817,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
JavacTreeMaker maker = fieldNode.getTreeMaker();
- JCMethodDecl newMethod = HandleSetter.createSetter(Flags.PUBLIC, deprecate, fieldNode, maker, setterName, nameOfSetFlag, returnType, returnStatement, source, List.<JCAnnotation>nil(), List.<JCAnnotation>nil());
+ JCMethodDecl newMethod = HandleSetter.createSetter(Flags.PUBLIC, deprecate, fieldNode, maker, setterName, nameOfSetFlag, returnType, returnStatement, source, List.<JCAnnotation>nil(), annosOnParam);
injectMethod(builderType, newMethod);
}
diff --git a/src/core/lombok/javac/handlers/HandleWither.java b/src/core/lombok/javac/handlers/HandleWither.java
index 87f3c16a..33c4dec2 100644
--- a/src/core/lombok/javac/handlers/HandleWither.java
+++ b/src/core/lombok/javac/handlers/HandleWither.java
@@ -222,8 +222,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
JCVariableDecl fieldDecl = (JCVariableDecl) field.get();
- List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN);
- List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN);
+ List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(field);
Name methodName = field.toName(witherName);
@@ -231,7 +230,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
JCBlock methodBody = null;
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext());
- List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables);
+ List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(copyableAnnotations);
JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
@@ -264,7 +263,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
JCConditional conditional = maker.Conditional(identityCheck, maker.Ident(field.toName("this")), newClass);
JCReturn returnStatement = maker.Return(conditional);
- if (nonNulls.isEmpty()) {
+ if (!hasNonNullAnnotations(field)) {
statements.append(returnStatement);
} else {
JCStatement nullCheck = generateNullCheck(maker, field, source);
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 92c642d4..e4e40095 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -27,6 +27,7 @@ import static lombok.javac.Javac.*;
import static lombok.javac.JavacAugments.JCTree_generatedNode;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -49,6 +50,7 @@ import lombok.core.LombokImmutableList;
import lombok.core.AnnotationValues.AnnotationValue;
import lombok.core.TypeResolver;
import lombok.core.configuration.NullCheckExceptionType;
+import lombok.core.configuration.TypeName;
import lombok.core.handlers.HandlerUtil;
import lombok.delombok.LombokOptionsFactory;
import lombok.experimental.Accessors;
@@ -1038,6 +1040,57 @@ public class JavacHandlerUtil {
return (field.mods.flags & Flags.ENUM) != 0;
}
+ static class JCAnnotatedTypeReflect {
+ private static Class<?> TYPE;
+ private static Constructor<?> CONSTRUCTOR;
+ private static Field ANNOTATIONS, UNDERLYING_TYPE;
+
+ private static void init(Class<?> in) {
+ if (TYPE != null) return;
+ if (!in.getName().equals("com.sun.tools.javac.tree.JCTree$JCAnnotatedType")) return;
+ try {
+ CONSTRUCTOR = in.getDeclaredConstructor(List.class, JCExpression.class);
+ CONSTRUCTOR.setAccessible(true);
+ ANNOTATIONS = in.getDeclaredField("annotations");
+ UNDERLYING_TYPE = in.getDeclaredField("underlyingType");
+ TYPE = in;
+ } catch (Exception ignore) {}
+ }
+
+ static boolean is(JCTree obj) {
+ if (obj == null) return false;
+ init(obj.getClass());
+ return obj.getClass() == TYPE;
+ }
+
+ @SuppressWarnings("unchecked")
+ static List<JCAnnotation> getAnnotations(JCTree obj) {
+ init(obj.getClass());
+ try {
+ return (List<JCAnnotation>) ANNOTATIONS.get(obj);
+ } catch (Exception e) {
+ return List.nil();
+ }
+ }
+
+ static JCExpression getUnderlyingType(JCTree obj) {
+ init(obj.getClass());
+ try {
+ return (JCExpression) UNDERLYING_TYPE.get(obj);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ static JCExpression create(List<JCAnnotation> annotations, JCExpression underlyingType) {
+ try {
+ return (JCExpression) CONSTRUCTOR.newInstance(annotations, underlyingType);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ }
+
// jdk9 support, types have changed, names stay the same
static class ClassSymbolMembersField {
private static final Field membersField;
@@ -1335,6 +1388,63 @@ public class JavacHandlerUtil {
return result.toList();
}
+ public static boolean hasNonNullAnnotations(JavacNode node) {
+ for (JavacNode child : node.down()) {
+ if (child.getKind() == Kind.ANNOTATION) {
+ JCAnnotation annotation = (JCAnnotation) child.get();
+ for (String nn : NONNULL_ANNOTATIONS) if (typeMatches(nn, node, annotation.annotationType)) return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Searches the given field node for annotations and returns each one that is 'copyable' (either via configuration or from the base list).
+ */
+ public static List<JCAnnotation> findCopyableAnnotations(JavacNode node) {
+ JCAnnotation anno = null;
+ String annoName = null;
+ for (JavacNode child : node.down()) {
+ if (child.getKind() == Kind.ANNOTATION) {
+ if (anno != null) {
+ annoName = "";
+ break;
+ }
+ JCAnnotation annotation = (JCAnnotation) child.get();
+ annoName = annotation.annotationType.toString();
+ anno = annotation;
+ }
+ }
+
+ if (annoName == null) return List.nil();
+
+ java.util.List<TypeName> configuredCopyable = node.getAst().readConfiguration(ConfigurationKeys.COPYABLE_ANNOTATIONS);
+
+ if (!annoName.isEmpty()) {
+ for (TypeName cn : configuredCopyable) if (typeMatches(cn.toString(), node, anno.annotationType)) return List.of(anno);
+ for (String bn : BASE_COPYABLE_ANNOTATIONS) if (typeMatches(bn, node, anno.annotationType)) return List.of(anno);
+ }
+
+ ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>();
+ for (JavacNode child : node.down()) {
+ if (child.getKind() == Kind.ANNOTATION) {
+ JCAnnotation annotation = (JCAnnotation) child.get();
+ boolean match = false;
+ for (TypeName cn : configuredCopyable) if (typeMatches(cn.toString(), node, annotation.annotationType)) {
+ result.append(annotation);
+ match = true;
+ break;
+ }
+ if (!match) for (String bn : BASE_COPYABLE_ANNOTATIONS) if (typeMatches(bn, node, annotation.annotationType)) {
+ result.append(annotation);
+ break;
+ }
+ }
+ }
+ return result.toList();
+ }
+
/**
* Generates a new statement that checks if the given variable is null, and if so, throws a configured exception with the
* variable name as message.
@@ -1512,6 +1622,16 @@ public class JavacHandlerUtil {
return out.toList();
}
+ public static List<JCAnnotation> getTypeUseAnnotations(JCExpression from) {
+ if (!JCAnnotatedTypeReflect.is(from)) return List.nil();
+ return JCAnnotatedTypeReflect.getAnnotations(from);
+ }
+
+ public static JCExpression removeTypeUseAnnotations(JCExpression from) {
+ if (!JCAnnotatedTypeReflect.is(from)) return from;
+ return JCAnnotatedTypeReflect.getUnderlyingType(from);
+ }
+
public static JCExpression namePlusTypeParamsToTypeReference(JavacTreeMaker maker, Name typeName, List<JCTypeParameter> params) {
if (params.isEmpty()) {
return maker.Ident(typeName);
@@ -1592,7 +1712,7 @@ public class JavacHandlerUtil {
}
/**
- * Creates a full clone of a given javac AST type node. Every part is cloned (every identifier, every select, every wildcard, every type apply).
+ * Creates a full clone of a given javac AST type node. Every part is cloned (every identifier, every select, every wildcard, every type apply, every type_use annotation).
*
* If there's any node in the tree that we don't know how to clone, that part isn't cloned. However, we wouldn't know what could possibly show up that we
* can't currently clone; that's just a safeguard.
@@ -1654,6 +1774,12 @@ public class JavacHandlerUtil {
return maker.Wildcard(newKind, newInner);
}
+ if (JCAnnotatedTypeReflect.is(in)) {
+ JCExpression underlyingType = cloneType0(maker, JCAnnotatedTypeReflect.getUnderlyingType(in));
+ List<JCAnnotation> anns = copyAnnotations(JCAnnotatedTypeReflect.getAnnotations(in));
+ return JCAnnotatedTypeReflect.create(anns, underlyingType);
+ }
+
// This is somewhat unsafe, but it's better than outright throwing an exception here. Returning null will just cause an exception down the pipeline.
return (JCExpression) in;
}
@@ -1829,7 +1955,7 @@ public class JavacHandlerUtil {
public static boolean isDirectDescendantOfObject(JavacNode typeNode) {
if (!(typeNode.get() instanceof JCClassDecl)) throw new IllegalArgumentException("not a type node");
- JCTree extending = Javac.getExtendsClause((JCClassDecl)typeNode.get());
+ JCTree extending = Javac.getExtendsClause((JCClassDecl) typeNode.get());
if (extending == null) return true;
String p = extending.toString();
return p.equals("Object") || p.equals("java.lang.Object");
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
index ffaf6674..74010d52 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
@@ -39,6 +39,7 @@ import lombok.javac.handlers.JavacSingularsRecipes.StatementMaker;
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.JCMethodDecl;
@@ -125,7 +126,10 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer {
ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
for (int i = 0; i < suffixes.size(); i++) {
JCExpression pt = cloneParamType(i, maker, data.getTypeArgs(), builderType, source);
- JCVariableDecl p = maker.VarDef(maker.Modifiers(paramFlags), names[i], pt, null);
+ List<JCAnnotation> typeUseAnns = getTypeUseAnnotations(pt);
+ pt = removeTypeUseAnnotations(pt);
+ JCModifiers paramMods = typeUseAnns.isEmpty() ? maker.Modifiers(paramFlags) : maker.Modifiers(paramFlags, typeUseAnns);
+ JCVariableDecl p = maker.VarDef(paramMods, names[i], pt, null);
params.append(p);
}
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
index 39e53ebb..26ff8ba6 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
@@ -36,6 +36,7 @@ import lombok.javac.handlers.JavacSingularsRecipes.StatementMaker;
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.JCMethodDecl;
@@ -124,7 +125,10 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext());
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("add", name.toString()));
JCExpression paramType = cloneParamType(0, maker, data.getTypeArgs(), builderType, source);
- JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getSingularName(), paramType, null);
+ List<JCAnnotation> typeUseAnns = getTypeUseAnnotations(paramType);
+ paramType = removeTypeUseAnnotations(paramType);
+ JCModifiers paramMods = typeUseAnns.isEmpty() ? maker.Modifiers(paramFlags) : maker.Modifiers(paramFlags, typeUseAnns);
+ JCVariableDecl param = maker.VarDef(paramMods, data.getSingularName(), paramType, null);
JCMethodDecl method = maker.MethodDef(mods, name, returnType, typeParams, List.of(param), thrown, body, null);
injectMethod(builderType, method);
}
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
index 34350f40..a009b88c 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
@@ -40,6 +40,7 @@ import org.mangosdk.spi.ProviderFor;
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.JCMethodDecl;
@@ -165,8 +166,14 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("put", name.toString()));
JCExpression paramTypeKey = cloneParamType(0, maker, data.getTypeArgs(), builderType, source);
JCExpression paramTypeValue = cloneParamType(1, maker, data.getTypeArgs(), builderType, source);
- JCVariableDecl paramKey = maker.VarDef(maker.Modifiers(paramFlags), keyName, paramTypeKey, null);
- JCVariableDecl paramValue = maker.VarDef(maker.Modifiers(paramFlags), valueName, paramTypeValue, null);
+ List<JCAnnotation> typeUseAnnsKey = getTypeUseAnnotations(paramTypeKey);
+ List<JCAnnotation> typeUseAnnsValue = getTypeUseAnnotations(paramTypeValue);
+ paramTypeKey = removeTypeUseAnnotations(paramTypeKey);
+ paramTypeValue = removeTypeUseAnnotations(paramTypeValue);
+ JCModifiers paramModsKey = typeUseAnnsKey.isEmpty() ? maker.Modifiers(paramFlags) : maker.Modifiers(paramFlags, typeUseAnnsKey);
+ JCModifiers paramModsValue = typeUseAnnsValue.isEmpty() ? maker.Modifiers(paramFlags) : maker.Modifiers(paramFlags, typeUseAnnsValue);
+ JCVariableDecl paramKey = maker.VarDef(paramModsKey, keyName, paramTypeKey, null);
+ JCVariableDecl paramValue = maker.VarDef(paramModsValue, valueName, paramTypeValue, null);
JCMethodDecl method = maker.MethodDef(mods, name, returnType, typeParams, List.of(paramKey, paramValue), thrown, body, null);
injectMethod(builderType, method);
}
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java
index 5dbe3e2d..5b3c453e 100644
--- a/src/utils/lombok/eclipse/Eclipse.java
+++ b/src/utils/lombok/eclipse/Eclipse.java
@@ -31,11 +31,11 @@ import lombok.core.ClassLiteral;
import lombok.core.FieldSelect;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
import org.eclipse.jdt.internal.compiler.ast.Clinit;
import org.eclipse.jdt.internal.compiler.ast.Expression;
-import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Literal;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
@@ -139,7 +139,7 @@ public class Eclipse {
*
* Only the simple name is checked - the package and any containing class are ignored.
*/
- public static Annotation[] findAnnotations(FieldDeclaration field, Pattern namePattern) {
+ public static Annotation[] findAnnotations(AbstractVariableDeclaration field, Pattern namePattern) {
List<Annotation> result = new ArrayList<Annotation>();
if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY;
for (Annotation annotation : field.annotations) {
diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..93825659
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
@@ -0,0 +1,124 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {
+}
+class BuilderSingularAnnotatedTypes {
+ private Set<@MyAnnotation @NonNull String> foos;
+ private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) {
+ this.foos = foos;
+ this.bars = bars;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularAnnotatedTypesBuilder {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> foos;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularAnnotatedTypesBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder foo(@MyAnnotation @NonNull final String foo) {
+ if (foo == null) {
+ throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ }
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.addAll(foos);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder clearFoos() {
+ if (this.foos != null) this.foos.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
+ if (barKey == null) {
+ throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ }
+ if (barValue == null) {
+ throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ }
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ this.bars$key.add(barKey);
+ this.bars$value.add(barValue);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ for (final java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder clearBars() {
+ if (this.bars$key != null) {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypes build() {
+ java.util.Set<@MyAnnotation @NonNull String> foos;
+ switch (this.foos == null ? 0 : this.foos.size()) {
+ case 0:
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1:
+ foos = java.util.Collections.singleton(this.foos.get(0));
+ break;
+ default:
+ foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(this.foos.size() < 1073741824 ? 1 + this.foos.size() + (this.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ foos.addAll(this.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ switch (this.bars$key == null ? 0 : this.bars$key.size()) {
+ case 0:
+ bars = java.util.Collections.emptyMap();
+ break;
+ case 1:
+ bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0));
+ break;
+ default:
+ bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(this.bars$key.size() < 1073741824 ? 1 + this.bars$key.size() + (this.bars$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ for (int $i = 0; $i < this.bars$key.size(); $i++) bars.put(this.bars$key.get($i), (@MyAnnotation @NonNull Integer) this.bars$value.get($i));
+ bars = java.util.Collections.unmodifiableMap(bars);
+ }
+ return new BuilderSingularAnnotatedTypes(foos, bars);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderSingularAnnotatedTypesBuilder builder() {
+ return new BuilderSingularAnnotatedTypesBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnos.java b/test/transform/resource/after-delombok/BuilderTypeAnnos.java
new file mode 100644
index 00000000..8a31762a
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderTypeAnnos.java
@@ -0,0 +1,45 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class BuilderTypeAnnos {
+ @TA
+ @TB
+ private List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ BuilderTypeAnnos(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderTypeAnnosBuilder {
+ @java.lang.SuppressWarnings("all")
+ private List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ BuilderTypeAnnosBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderTypeAnnosBuilder foo(@TA final List<String> foo) {
+ this.foo = foo;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderTypeAnnos build() {
+ return new BuilderTypeAnnos(foo);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderTypeAnnosBuilder builder() {
+ return new BuilderTypeAnnosBuilder();
+ }
+}
+
diff --git a/test/transform/resource/after-delombok/ConstructorsTypeAnnos.java b/test/transform/resource/after-delombok/ConstructorsTypeAnnos.java
new file mode 100644
index 00000000..2d59681c
--- /dev/null
+++ b/test/transform/resource/after-delombok/ConstructorsTypeAnnos.java
@@ -0,0 +1,18 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class ConstructorsTypeAnnos {
+ @TA
+ @TB
+ List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ public ConstructorsTypeAnnos(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+}
diff --git a/test/transform/resource/after-delombok/GetterTypeAnnos.java b/test/transform/resource/after-delombok/GetterTypeAnnos.java
new file mode 100644
index 00000000..4a22c822
--- /dev/null
+++ b/test/transform/resource/after-delombok/GetterTypeAnnos.java
@@ -0,0 +1,19 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class GetterTypeAnnos {
+ @TA
+ @TB
+ List<String> foo;
+ @TA
+ @java.lang.SuppressWarnings("all")
+ public List<String> getFoo() {
+ return this.foo;
+ }
+}
diff --git a/test/transform/resource/after-delombok/SetterTypeAnnos.java b/test/transform/resource/after-delombok/SetterTypeAnnos.java
new file mode 100644
index 00000000..77ddf9ce
--- /dev/null
+++ b/test/transform/resource/after-delombok/SetterTypeAnnos.java
@@ -0,0 +1,18 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class SetterTypeAnnos {
+ @TA
+ @TB
+ List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ public void setFoo(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+}
diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..1baf81aa
--- /dev/null
+++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
@@ -0,0 +1,137 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {
+}
+class SuperBuilderSingularAnnotatedTypes {
+ private Set<@MyAnnotation @NonNull String> foos;
+ private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ @java.lang.SuppressWarnings("all")
+ public static abstract class SuperBuilderSingularAnnotatedTypesBuilder<C extends SuperBuilderSingularAnnotatedTypes, B extends SuperBuilderSingularAnnotatedTypesBuilder<C, B>> {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> foos;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @java.lang.SuppressWarnings("all")
+ public abstract C build();
+ @java.lang.SuppressWarnings("all")
+ public B foo(@MyAnnotation @NonNull final String foo) {
+ if (foo == null) {
+ throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ }
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.addAll(foos);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B clearFoos() {
+ if (this.foos != null) this.foos.clear();
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
+ if (barKey == null) {
+ throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ }
+ if (barValue == null) {
+ throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ }
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ this.bars$key.add(barKey);
+ this.bars$value.add(barValue);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ for (final java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B clearBars() {
+ if (this.bars$key != null) {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return self();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "SuperBuilderSingularAnnotatedTypes.SuperBuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class SuperBuilderSingularAnnotatedTypesBuilderImpl extends SuperBuilderSingularAnnotatedTypesBuilder<SuperBuilderSingularAnnotatedTypes, SuperBuilderSingularAnnotatedTypesBuilderImpl> {
+ @java.lang.SuppressWarnings("all")
+ private SuperBuilderSingularAnnotatedTypesBuilderImpl() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderSingularAnnotatedTypesBuilderImpl self() {
+ return this;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public SuperBuilderSingularAnnotatedTypes build() {
+ return new SuperBuilderSingularAnnotatedTypes(this);
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderSingularAnnotatedTypes(final SuperBuilderSingularAnnotatedTypesBuilder<?, ?> b) {
+ java.util.Set<@MyAnnotation @NonNull String> foos;
+ switch (b.foos == null ? 0 : b.foos.size()) {
+ case 0:
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1:
+ foos = java.util.Collections.singleton(b.foos.get(0));
+ break;
+ default:
+ foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(b.foos.size() < 1073741824 ? 1 + b.foos.size() + (b.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ foos.addAll(b.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ this.foos = foos;
+ java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ switch (b.bars$key == null ? 0 : b.bars$key.size()) {
+ case 0:
+ bars = java.util.Collections.emptyMap();
+ break;
+ case 1:
+ bars = java.util.Collections.singletonMap(b.bars$key.get(0), b.bars$value.get(0));
+ break;
+ default:
+ bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(b.bars$key.size() < 1073741824 ? 1 + b.bars$key.size() + (b.bars$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ for (int $i = 0; $i < b.bars$key.size(); $i++) bars.put(b.bars$key.get($i), (@MyAnnotation @NonNull Integer) b.bars$value.get($i));
+ bars = java.util.Collections.unmodifiableMap(bars);
+ }
+ this.bars = bars;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static SuperBuilderSingularAnnotatedTypesBuilder<?, ?> builder() {
+ return new SuperBuilderSingularAnnotatedTypesBuilderImpl();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
index 5eba938f..cac5482b 100644
--- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
+++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
@@ -18,7 +18,10 @@ public class SuperBuilderWithNonNull {
@java.lang.SuppressWarnings("all")
public abstract C build();
@java.lang.SuppressWarnings("all")
- public B nonNullParentField(final String nonNullParentField) {
+ public B nonNullParentField(@lombok.NonNull final String nonNullParentField) {
+ if (nonNullParentField == null) {
+ throw new java.lang.NullPointerException("nonNullParentField is marked @NonNull but is null");
+ }
this.nonNullParentField = nonNullParentField;
nonNullParentField$set = true;
return self();
@@ -72,7 +75,10 @@ public class SuperBuilderWithNonNull {
@java.lang.SuppressWarnings("all")
public abstract C build();
@java.lang.SuppressWarnings("all")
- public B nonNullChildField(final String nonNullChildField) {
+ public B nonNullChildField(@lombok.NonNull final String nonNullChildField) {
+ if (nonNullChildField == null) {
+ throw new java.lang.NullPointerException("nonNullChildField is marked @NonNull but is null");
+ }
this.nonNullChildField = nonNullChildField;
return self();
}
diff --git a/test/transform/resource/after-delombok/WitherTypeAnnos.java b/test/transform/resource/after-delombok/WitherTypeAnnos.java
new file mode 100644
index 00000000..b57438af
--- /dev/null
+++ b/test/transform/resource/after-delombok/WitherTypeAnnos.java
@@ -0,0 +1,21 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class WitherTypeAnnos {
+ @TA
+ @TB
+ final List<String> foo;
+ WitherTypeAnnos(@TA @TB List<String> foo) {
+ this.foo = foo;
+ }
+ @java.lang.SuppressWarnings("all")
+ public WitherTypeAnnos withFoo(@TA final List<String> foo) {
+ return this.foo == foo ? this : new WitherTypeAnnos(foo);
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java b/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java
index 236632d0..1078f452 100644
--- a/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java
+++ b/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java
@@ -16,13 +16,13 @@ public @Builder class BuilderDefaultsWarnings {
this.z = z;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderDefaultsWarningsBuilder item(String item) {
+ public @java.lang.SuppressWarnings("all") BuilderDefaultsWarningsBuilder item(final String item) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(item);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderDefaultsWarningsBuilder items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") BuilderDefaultsWarningsBuilder items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..26023e1a
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java
@@ -0,0 +1,121 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+import lombok.Singular;
+@Target(ElementType.TYPE_USE) @interface MyAnnotation {
+}
+@lombok.Builder class BuilderSingularAnnotatedTypes {
+ public static @java.lang.SuppressWarnings("all") class BuilderSingularAnnotatedTypesBuilder {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> foos;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
+ @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder foo(final @MyAnnotation @NonNull String foo) {
+ if ((foo == null))
+ {
+ throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ }
+ if ((this.foos == null))
+ this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
+ if ((this.foos == null))
+ this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.addAll(foos);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearFoos() {
+ if ((this.foos != null))
+ this.foos.clear();
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder bar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull Integer barValue) {
+ if ((barKey == null))
+ {
+ throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ }
+ if ((barValue == null))
+ {
+ throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ }
+ if ((this.bars$key == null))
+ {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ this.bars$key.add(barKey);
+ this.bars$value.add(barValue);
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
+ if ((this.bars$key == null))
+ {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ for (java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet())
+ {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearBars() {
+ if ((this.bars$key != null))
+ {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes build() {
+ java.util.Set<@MyAnnotation @NonNull String> foos;
+ switch (((this.foos == null) ? 0 : this.foos.size())) {
+ case 0 :
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1 :
+ foos = java.util.Collections.singleton(this.foos.get(0));
+ break;
+ default :
+ foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(((this.foos.size() < 0x40000000) ? ((1 + this.foos.size()) + ((this.foos.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
+ foos.addAll(this.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ switch (((this.bars$key == null) ? 0 : this.bars$key.size())) {
+ case 0 :
+ bars = java.util.Collections.emptyMap();
+ break;
+ case 1 :
+ bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0));
+ break;
+ default :
+ bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(((this.bars$key.size() < 0x40000000) ? ((1 + this.bars$key.size()) + ((this.bars$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
+ for (int $i = 0;; ($i < this.bars$key.size()); $i ++)
+ bars.put(this.bars$key.get($i), this.bars$value.get($i));
+ bars = java.util.Collections.unmodifiableMap(bars);
+ }
+ return new BuilderSingularAnnotatedTypes(foos, bars);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")");
+ }
+ }
+ private @Singular Set<@MyAnnotation @NonNull String> foos;
+ private @Singular Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) {
+ super();
+ this.foos = foos;
+ this.bars = bars;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder builder() {
+ return new BuilderSingularAnnotatedTypesBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java
index 12c2b293..9b50d33b 100644
--- a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java
+++ b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java
@@ -14,13 +14,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> card(T card) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> card(final T card) {
if ((this.cards == null))
this.cards = com.google.common.collect.ImmutableList.builder();
this.cards.add(card);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> cards(java.lang.Iterable<? extends T> cards) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> cards(final java.lang.Iterable<? extends T> cards) {
if ((this.cards == null))
this.cards = com.google.common.collect.ImmutableList.builder();
this.cards.addAll(cards);
@@ -30,13 +30,13 @@ import lombok.Singular;
this.cards = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> frog(Number frog) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> frog(final Number frog) {
if ((this.frogs == null))
this.frogs = com.google.common.collect.ImmutableList.builder();
this.frogs.add(frog);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> frogs(java.lang.Iterable<? extends Number> frogs) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> frogs(final java.lang.Iterable<? extends Number> frogs) {
if ((this.frogs == null))
this.frogs = com.google.common.collect.ImmutableList.builder();
this.frogs.addAll(frogs);
@@ -46,13 +46,13 @@ import lombok.Singular;
this.frogs = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> rawSet(java.lang.Object rawSet) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Object rawSet) {
if ((this.rawSet == null))
this.rawSet = com.google.common.collect.ImmutableSet.builder();
this.rawSet.add(rawSet);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> rawSet(java.lang.Iterable<?> rawSet) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Iterable<?> rawSet) {
if ((this.rawSet == null))
this.rawSet = com.google.common.collect.ImmutableSet.builder();
this.rawSet.addAll(rawSet);
@@ -62,13 +62,13 @@ import lombok.Singular;
this.rawSet = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> pass(String pass) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> pass(final String pass) {
if ((this.passes == null))
this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
this.passes.add(pass);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> passes(java.lang.Iterable<? extends String> passes) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> passes(final java.lang.Iterable<? extends String> passes) {
if ((this.passes == null))
this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
this.passes.addAll(passes);
@@ -78,13 +78,13 @@ import lombok.Singular;
this.passes = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> user(Number rowKey, Number columnKey, String value) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> user(final Number rowKey, final Number columnKey, final String value) {
if ((this.users == null))
this.users = com.google.common.collect.ImmutableTable.builder();
this.users.put(rowKey, columnKey, value);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> users(com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> users(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
if ((this.users == null))
this.users = com.google.common.collect.ImmutableTable.builder();
this.users.putAll(users);
diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java
index 44533ac1..1dc04a07 100644
--- a/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java
+++ b/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java
@@ -10,13 +10,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> battleaxe(K key, V value) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> battleaxe(final K key, final V value) {
if ((this.battleaxes == null))
this.battleaxes = com.google.common.collect.ImmutableMap.builder();
this.battleaxes.put(key, value);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> battleaxes(java.util.Map<? extends K, ? extends V> battleaxes) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> battleaxes(final java.util.Map<? extends K, ? extends V> battleaxes) {
if ((this.battleaxes == null))
this.battleaxes = com.google.common.collect.ImmutableMap.builder();
this.battleaxes.putAll(battleaxes);
@@ -26,13 +26,13 @@ import lombok.Singular;
this.battleaxes = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> vertex(Integer key, V value) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> vertex(final Integer key, final V value) {
if ((this.vertices == null))
this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder();
this.vertices.put(key, value);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> vertices(java.util.Map<? extends Integer, ? extends V> vertices) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> vertices(final java.util.Map<? extends Integer, ? extends V> vertices) {
if ((this.vertices == null))
this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder();
this.vertices.putAll(vertices);
@@ -42,13 +42,13 @@ import lombok.Singular;
this.vertices = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> rawMap(java.lang.Object key, java.lang.Object value) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.lang.Object key, final java.lang.Object value) {
if ((this.rawMap == null))
this.rawMap = com.google.common.collect.ImmutableBiMap.builder();
this.rawMap.put(key, value);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> rawMap(java.util.Map<?, ?> rawMap) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
if ((this.rawMap == null))
this.rawMap = com.google.common.collect.ImmutableBiMap.builder();
this.rawMap.putAll(rawMap);
diff --git a/test/transform/resource/after-ecj/BuilderSingularLists.java b/test/transform/resource/after-ecj/BuilderSingularLists.java
index 3e093e1a..5bb13bad 100644
--- a/test/transform/resource/after-ecj/BuilderSingularLists.java
+++ b/test/transform/resource/after-ecj/BuilderSingularLists.java
@@ -10,13 +10,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularListsBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> child(T child) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> child(final T child) {
if ((this.children == null))
this.children = new java.util.ArrayList<T>();
this.children.add(child);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> children(java.util.Collection<? extends T> children) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> children(final java.util.Collection<? extends T> children) {
if ((this.children == null))
this.children = new java.util.ArrayList<T>();
this.children.addAll(children);
@@ -27,13 +27,13 @@ import lombok.Singular;
this.children.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> scarf(Number scarf) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> scarf(final Number scarf) {
if ((this.scarves == null))
this.scarves = new java.util.ArrayList<Number>();
this.scarves.add(scarf);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> scarves(java.util.Collection<? extends Number> scarves) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> scarves(final java.util.Collection<? extends Number> scarves) {
if ((this.scarves == null))
this.scarves = new java.util.ArrayList<Number>();
this.scarves.addAll(scarves);
@@ -44,13 +44,13 @@ import lombok.Singular;
this.scarves.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> rawList(java.lang.Object rawList) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> rawList(final java.lang.Object rawList) {
if ((this.rawList == null))
this.rawList = new java.util.ArrayList<java.lang.Object>();
this.rawList.add(rawList);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> rawList(java.util.Collection<?> rawList) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> rawList(final java.util.Collection<?> rawList) {
if ((this.rawList == null))
this.rawList = new java.util.ArrayList<java.lang.Object>();
this.rawList.addAll(rawList);
diff --git a/test/transform/resource/after-ecj/BuilderSingularMaps.java b/test/transform/resource/after-ecj/BuilderSingularMaps.java
index efcf5ef5..20945a13 100644
--- a/test/transform/resource/after-ecj/BuilderSingularMaps.java
+++ b/test/transform/resource/after-ecj/BuilderSingularMaps.java
@@ -14,7 +14,7 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> woman(K womanKey, V womanValue) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> woman(final K womanKey, final V womanValue) {
if ((this.women$key == null))
{
this.women$key = new java.util.ArrayList<K>();
@@ -24,7 +24,7 @@ import lombok.Singular;
this.women$value.add(womanValue);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> women(java.util.Map<? extends K, ? extends V> women) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> women(final java.util.Map<? extends K, ? extends V> women) {
if ((this.women$key == null))
{
this.women$key = new java.util.ArrayList<K>();
@@ -45,7 +45,7 @@ import lombok.Singular;
}
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> man(K manKey, Number manValue) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> man(final K manKey, final Number manValue) {
if ((this.men$key == null))
{
this.men$key = new java.util.ArrayList<K>();
@@ -55,7 +55,7 @@ import lombok.Singular;
this.men$value.add(manValue);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> men(java.util.Map<? extends K, ? extends Number> men) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> men(final java.util.Map<? extends K, ? extends Number> men) {
if ((this.men$key == null))
{
this.men$key = new java.util.ArrayList<K>();
@@ -76,7 +76,7 @@ import lombok.Singular;
}
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> rawMap(java.lang.Object rawMapKey, java.lang.Object rawMapValue) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> rawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) {
if ((this.rawMap$key == null))
{
this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
@@ -86,7 +86,7 @@ import lombok.Singular;
this.rawMap$value.add(rawMapValue);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> rawMap(java.util.Map<?, ?> rawMap) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
if ((this.rawMap$key == null))
{
this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
@@ -107,7 +107,7 @@ import lombok.Singular;
}
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> stringMap(String stringMapKey, V stringMapValue) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> stringMap(final String stringMapKey, final V stringMapValue) {
if ((this.stringMap$key == null))
{
this.stringMap$key = new java.util.ArrayList<String>();
@@ -117,7 +117,7 @@ import lombok.Singular;
this.stringMap$value.add(stringMapValue);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> stringMap(java.util.Map<? extends String, ? extends V> stringMap) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> stringMap(final java.util.Map<? extends String, ? extends V> stringMap) {
if ((this.stringMap$key == null))
{
this.stringMap$key = new java.util.ArrayList<String>();
diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAuto.java b/test/transform/resource/after-ecj/BuilderSingularNoAuto.java
index fa38efc3..4d27f459 100644
--- a/test/transform/resource/after-ecj/BuilderSingularNoAuto.java
+++ b/test/transform/resource/after-ecj/BuilderSingularNoAuto.java
@@ -8,13 +8,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder things(String things) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder things(final String things) {
if ((this.things == null))
this.things = new java.util.ArrayList<String>();
this.things.add(things);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder things(java.util.Collection<? extends String> things) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder things(final java.util.Collection<? extends String> things) {
if ((this.things == null))
this.things = new java.util.ArrayList<String>();
this.things.addAll(things);
@@ -25,13 +25,13 @@ import lombok.Singular;
this.things.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder widget(String widget) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder widget(final String widget) {
if ((this.widgets == null))
this.widgets = new java.util.ArrayList<String>();
this.widgets.add(widget);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder widgets(java.util.Collection<? extends String> widgets) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder widgets(final java.util.Collection<? extends String> widgets) {
if ((this.widgets == null))
this.widgets = new java.util.ArrayList<String>();
this.widgets.addAll(widgets);
@@ -42,13 +42,13 @@ import lombok.Singular;
this.widgets.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder items(String items) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder items(final String items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(items);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java
index 4823e46e..c0f78b57 100644
--- a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java
+++ b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java
@@ -10,13 +10,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder dangerMouse(String dangerMouse) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder dangerMouse(final String dangerMouse) {
if ((this.dangerMice == null))
this.dangerMice = com.google.common.collect.ImmutableSet.builder();
this.dangerMice.add(dangerMouse);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder dangerMice(java.lang.Iterable<? extends String> dangerMice) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder dangerMice(final java.lang.Iterable<? extends String> dangerMice) {
if ((this.dangerMice == null))
this.dangerMice = com.google.common.collect.ImmutableSet.builder();
this.dangerMice.addAll(dangerMice);
@@ -26,13 +26,13 @@ import lombok.Singular;
this.dangerMice = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder thing(Integer key, Number value) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder thing(final Integer key, final Number value) {
if ((this.things == null))
this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder();
this.things.put(key, value);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder things(java.util.Map<? extends Integer, ? extends Number> things) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder things(final java.util.Map<? extends Integer, ? extends Number> things) {
if ((this.things == null))
this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder();
this.things.putAll(things);
@@ -42,13 +42,13 @@ import lombok.Singular;
this.things = null;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder doohickey(Class<?> doohickey) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder doohickey(final Class<?> doohickey) {
if ((this.doohickeys == null))
this.doohickeys = com.google.common.collect.ImmutableList.builder();
this.doohickeys.add(doohickey);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder doohickeys(java.lang.Iterable<? extends Class<?>> doohickeys) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder doohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) {
if ((this.doohickeys == null))
this.doohickeys = com.google.common.collect.ImmutableList.builder();
this.doohickeys.addAll(doohickeys);
diff --git a/test/transform/resource/after-ecj/BuilderSingularSets.java b/test/transform/resource/after-ecj/BuilderSingularSets.java
index bf403831..eb53b1cd 100644
--- a/test/transform/resource/after-ecj/BuilderSingularSets.java
+++ b/test/transform/resource/after-ecj/BuilderSingularSets.java
@@ -10,13 +10,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMouse(T dangerMouse) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMouse(final T dangerMouse) {
if ((this.dangerMice == null))
this.dangerMice = new java.util.ArrayList<T>();
this.dangerMice.add(dangerMouse);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMice(java.util.Collection<? extends T> dangerMice) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMice(final java.util.Collection<? extends T> dangerMice) {
if ((this.dangerMice == null))
this.dangerMice = new java.util.ArrayList<T>();
this.dangerMice.addAll(dangerMice);
@@ -27,13 +27,13 @@ import lombok.Singular;
this.dangerMice.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopus(Number octopus) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopus(final Number octopus) {
if ((this.octopodes == null))
this.octopodes = new java.util.ArrayList<Number>();
this.octopodes.add(octopus);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopodes(java.util.Collection<? extends Number> octopodes) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopodes(final java.util.Collection<? extends Number> octopodes) {
if ((this.octopodes == null))
this.octopodes = new java.util.ArrayList<Number>();
this.octopodes.addAll(octopodes);
@@ -44,13 +44,13 @@ import lombok.Singular;
this.octopodes.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> rawSet(java.lang.Object rawSet) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> rawSet(final java.lang.Object rawSet) {
if ((this.rawSet == null))
this.rawSet = new java.util.ArrayList<java.lang.Object>();
this.rawSet.add(rawSet);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> rawSet(java.util.Collection<?> rawSet) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> rawSet(final java.util.Collection<?> rawSet) {
if ((this.rawSet == null))
this.rawSet = new java.util.ArrayList<java.lang.Object>();
this.rawSet.addAll(rawSet);
@@ -61,13 +61,13 @@ import lombok.Singular;
this.rawSet.clear();
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(String stringSet) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(final String stringSet) {
if ((this.stringSet == null))
this.stringSet = new java.util.ArrayList<String>();
this.stringSet.add(stringSet);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(java.util.Collection<? extends String> stringSet) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(final java.util.Collection<? extends String> stringSet) {
if ((this.stringSet == null))
this.stringSet = new java.util.ArrayList<String>();
this.stringSet.addAll(stringSet);
diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java
index 7feff6e9..bbbf9268 100644
--- a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java
+++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java
@@ -5,13 +5,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder elem(String elem) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder elem(final String elem) {
if ((this.elems == null))
this.elems = new java.util.ArrayList<String>();
this.elems.add(elem);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder elems(java.util.Collection<? extends String> elems) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder elems(final java.util.Collection<? extends String> elems) {
if ((this.elems == null))
this.elems = new java.util.ArrayList<String>();
this.elems.addAll(elems);
diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java
index 12c299c6..31579497 100644
--- a/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java
+++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java
@@ -5,13 +5,13 @@ import lombok.Singular;
@java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder() {
super();
}
- public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder elem(String elem) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder elem(final String elem) {
if ((this.elems == null))
this.elems = new java.util.ArrayList<String>();
this.elems.add(elem);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder elems(java.util.Collection<? extends String> elems) {
+ public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder elems(final java.util.Collection<? extends String> elems) {
if ((this.elems == null))
this.elems = new java.util.ArrayList<String>();
this.elems.addAll(elems);
diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnos.java b/test/transform/resource/after-ecj/BuilderTypeAnnos.java
new file mode 100644
index 00000000..1c310f38
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderTypeAnnos.java
@@ -0,0 +1,33 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
+}
+@lombok.Builder class BuilderTypeAnnos {
+ public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosBuilder {
+ private @java.lang.SuppressWarnings("all") List<String> foo;
+ @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder foo(final @TA List<String> foo) {
+ this.foo = foo;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderTypeAnnos build() {
+ return new BuilderTypeAnnos(foo);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo) + ")");
+ }
+ }
+ private @TA @TB List<String> foo;
+ @java.lang.SuppressWarnings("all") BuilderTypeAnnos(final @TA List<String> foo) {
+ super();
+ this.foo = foo;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder builder() {
+ return new BuilderTypeAnnosBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecated.java b/test/transform/resource/after-ecj/BuilderWithDeprecated.java
index 09a0b786..b429c3e7 100644
--- a/test/transform/resource/after-ecj/BuilderWithDeprecated.java
+++ b/test/transform/resource/after-ecj/BuilderWithDeprecated.java
@@ -18,13 +18,13 @@ public @Builder class BuilderWithDeprecated {
this.dep2 = dep2;
return this;
}
- public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder string(String string) {
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder string(final String string) {
if ((this.strings == null))
this.strings = new java.util.ArrayList<String>();
this.strings.add(string);
return this;
}
- public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder strings(java.util.Collection<? extends String> strings) {
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder strings(final java.util.Collection<? extends String> strings) {
if ((this.strings == null))
this.strings = new java.util.ArrayList<String>();
this.strings.addAll(strings);
@@ -35,13 +35,13 @@ public @Builder class BuilderWithDeprecated {
this.strings.clear();
return this;
}
- public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder number(Integer number) {
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder number(final Integer number) {
if ((this.numbers == null))
this.numbers = com.google.common.collect.ImmutableList.builder();
this.numbers.add(number);
return this;
}
- public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder numbers(java.lang.Iterable<? extends Integer> numbers) {
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) {
if ((this.numbers == null))
this.numbers = com.google.common.collect.ImmutableList.builder();
this.numbers.addAll(numbers);
diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java
index a8935107..636dc42d 100644
--- a/test/transform/resource/after-ecj/BuilderWithToBuilder.java
+++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java
@@ -21,13 +21,13 @@ import lombok.Builder;
this.foo = foo;
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> bar(T bar) {
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> bar(final T bar) {
if ((this.bars == null))
this.bars = new java.util.ArrayList<T>();
this.bars.add(bar);
return this;
}
- public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> bars(java.util.Collection<? extends T> bars) {
+ public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> bars(final java.util.Collection<? extends T> bars) {
if ((this.bars == null))
this.bars = new java.util.ArrayList<T>();
this.bars.addAll(bars);
diff --git a/test/transform/resource/after-ecj/ConstructorsTypeAnnos.java b/test/transform/resource/after-ecj/ConstructorsTypeAnnos.java
new file mode 100644
index 00000000..3491239f
--- /dev/null
+++ b/test/transform/resource/after-ecj/ConstructorsTypeAnnos.java
@@ -0,0 +1,14 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
+}
+@lombok.AllArgsConstructor class ConstructorsTypeAnnos {
+ @TA @TB List<String> foo;
+ public @java.lang.SuppressWarnings("all") ConstructorsTypeAnnos(final @TA List<String> foo) {
+ super();
+ this.foo = foo;
+ }
+}
diff --git a/test/transform/resource/after-ecj/GetterTypeAnnos.java b/test/transform/resource/after-ecj/GetterTypeAnnos.java
new file mode 100644
index 00000000..9ffc7f1c
--- /dev/null
+++ b/test/transform/resource/after-ecj/GetterTypeAnnos.java
@@ -0,0 +1,17 @@
+import lombok.Getter;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
+}
+class GetterTypeAnnos {
+ @Getter @TA @TB List<String> foo;
+ GetterTypeAnnos() {
+ super();
+ }
+ public @TA @java.lang.SuppressWarnings("all") List<String> getFoo() {
+ return this.foo;
+ }
+}
diff --git a/test/transform/resource/after-ecj/SetterTypeAnnos.java b/test/transform/resource/after-ecj/SetterTypeAnnos.java
new file mode 100644
index 00000000..860694ea
--- /dev/null
+++ b/test/transform/resource/after-ecj/SetterTypeAnnos.java
@@ -0,0 +1,17 @@
+import lombok.Setter;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
+}
+class SetterTypeAnnos {
+ @Setter @TA @TB List<String> foo;
+ SetterTypeAnnos() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") void setFoo(final @TA List<String> foo) {
+ this.foo = foo;
+ }
+}
diff --git a/test/transform/resource/after-ecj/SuperBuilderBasic.java b/test/transform/resource/after-ecj/SuperBuilderBasic.java
index 11fd8498..95cf5f01 100644
--- a/test/transform/resource/after-ecj/SuperBuilderBasic.java
+++ b/test/transform/resource/after-ecj/SuperBuilderBasic.java
@@ -13,13 +13,13 @@ public class SuperBuilderBasic {
this.field1 = field1;
return self();
}
- public @java.lang.SuppressWarnings("all") B item(String item) {
+ public @java.lang.SuppressWarnings("all") B item(final String item) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(item);
return self();
}
- public @java.lang.SuppressWarnings("all") B items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..bb02024d
--- /dev/null
+++ b/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java
@@ -0,0 +1,131 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+import lombok.Singular;
+@Target(ElementType.TYPE_USE) @interface MyAnnotation {
+}
+@lombok.experimental.SuperBuilder class SuperBuilderSingularAnnotatedTypes {
+ public static abstract @java.lang.SuppressWarnings("all") class SuperBuilderSingularAnnotatedTypesBuilder<C extends SuperBuilderSingularAnnotatedTypes, B extends SuperBuilderSingularAnnotatedTypesBuilder<C, B>> {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> foos;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
+ public SuperBuilderSingularAnnotatedTypesBuilder() {
+ super();
+ }
+ protected abstract @java.lang.SuppressWarnings("all") B self();
+ public abstract @java.lang.SuppressWarnings("all") C build();
+ public @java.lang.SuppressWarnings("all") B foo(final @MyAnnotation @NonNull String foo) {
+ if ((foo == null))
+ {
+ throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ }
+ if ((this.foos == null))
+ this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return self();
+ }
+ public @java.lang.SuppressWarnings("all") B foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
+ if ((this.foos == null))
+ this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.addAll(foos);
+ return self();
+ }
+ public @java.lang.SuppressWarnings("all") B clearFoos() {
+ if ((this.foos != null))
+ this.foos.clear();
+ return self();
+ }
+ public @java.lang.SuppressWarnings("all") B bar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull Integer barValue) {
+ if ((barKey == null))
+ {
+ throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ }
+ if ((barValue == null))
+ {
+ throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ }
+ if ((this.bars$key == null))
+ {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ this.bars$key.add(barKey);
+ this.bars$value.add(barValue);
+ return self();
+ }
+ public @java.lang.SuppressWarnings("all") B bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
+ if ((this.bars$key == null))
+ {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ for (java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet())
+ {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return self();
+ }
+ public @java.lang.SuppressWarnings("all") B clearBars() {
+ if ((this.bars$key != null))
+ {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return self();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("SuperBuilderSingularAnnotatedTypes.SuperBuilderSingularAnnotatedTypesBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class SuperBuilderSingularAnnotatedTypesBuilderImpl extends SuperBuilderSingularAnnotatedTypesBuilder<SuperBuilderSingularAnnotatedTypes, SuperBuilderSingularAnnotatedTypesBuilderImpl> {
+ private SuperBuilderSingularAnnotatedTypesBuilderImpl() {
+ super();
+ }
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularAnnotatedTypesBuilderImpl self() {
+ return this;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularAnnotatedTypes build() {
+ return new SuperBuilderSingularAnnotatedTypes(this);
+ }
+ }
+ private @Singular Set<@MyAnnotation @NonNull String> foos;
+ private @Singular Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ protected @java.lang.SuppressWarnings("all") SuperBuilderSingularAnnotatedTypes(final SuperBuilderSingularAnnotatedTypesBuilder<?, ?> b) {
+ super();
+ java.util.Set<@MyAnnotation @NonNull String> foos;
+ switch (((b.foos == null) ? 0 : b.foos.size())) {
+ case 0 :
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1 :
+ foos = java.util.Collections.singleton(b.foos.get(0));
+ break;
+ default :
+ foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(((b.foos.size() < 0x40000000) ? ((1 + b.foos.size()) + ((b.foos.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
+ foos.addAll(b.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ this.foos = foos;
+ java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ switch (((b.bars$key == null) ? 0 : b.bars$key.size())) {
+ case 0 :
+ bars = java.util.Collections.emptyMap();
+ break;
+ case 1 :
+ bars = java.util.Collections.singletonMap(b.bars$key.get(0), b.bars$value.get(0));
+ break;
+ default :
+ bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(((b.bars$key.size() < 0x40000000) ? ((1 + b.bars$key.size()) + ((b.bars$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
+ for (int $i = 0;; ($i < b.bars$key.size()); $i ++)
+ bars.put(b.bars$key.get($i), b.bars$value.get($i));
+ bars = java.util.Collections.unmodifiableMap(bars);
+ }
+ this.bars = bars;
+ }
+ public static @java.lang.SuppressWarnings("all") SuperBuilderSingularAnnotatedTypesBuilder<?, ?> builder() {
+ return new SuperBuilderSingularAnnotatedTypesBuilderImpl();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java
index ed0655c7..0ec8921d 100644
--- a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java
+++ b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java
@@ -13,13 +13,13 @@ public class SuperBuilderWithCustomBuilderMethod {
this.field1 = field1;
return self();
}
- public @java.lang.SuppressWarnings("all") B item(String item) {
+ public @java.lang.SuppressWarnings("all") B item(final String item) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(item);
return self();
}
- public @java.lang.SuppressWarnings("all") B items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java
index 0166e375..465704bb 100644
--- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java
+++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java
@@ -13,13 +13,13 @@ public class SuperBuilderWithGenerics {
this.field1 = field1;
return self();
}
- public @java.lang.SuppressWarnings("all") B item(String item) {
+ public @java.lang.SuppressWarnings("all") B item(final String item) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(item);
return self();
}
- public @java.lang.SuppressWarnings("all") B items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java
index 28b026ea..8429ee35 100644
--- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java
+++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java
@@ -13,13 +13,13 @@ public class SuperBuilderWithGenerics2 {
this.field1 = field1;
return self();
}
- public @java.lang.SuppressWarnings("all") B item(String item) {
+ public @java.lang.SuppressWarnings("all") B item(final String item) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(item);
return self();
}
- public @java.lang.SuppressWarnings("all") B items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java
index 106b8326..1c4bd53d 100644
--- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java
+++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java
@@ -9,7 +9,7 @@ public class SuperBuilderWithNonNull {
}
protected abstract @java.lang.SuppressWarnings("all") B self();
public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B nonNullParentField(final String nonNullParentField) {
+ public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) {
this.nonNullParentField = nonNullParentField;
nonNullParentField$set = true;
return self();
@@ -56,7 +56,7 @@ public class SuperBuilderWithNonNull {
}
protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B nonNullChildField(final String nonNullChildField) {
+ public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) {
this.nonNullChildField = nonNullChildField;
return self();
}
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java
index 33400b3c..5dbdfacc 100644
--- a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java
+++ b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java
@@ -16,13 +16,13 @@
this.otherField = otherField;
return self();
}
- public @java.lang.SuppressWarnings("all") B item(String item) {
+ public @java.lang.SuppressWarnings("all") B item(final String item) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.add(item);
return self();
}
- public @java.lang.SuppressWarnings("all") B items(java.util.Collection<? extends String> items) {
+ public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
if ((this.items == null))
this.items = new java.util.ArrayList<String>();
this.items.addAll(items);
diff --git a/test/transform/resource/after-ecj/WitherTypeAnnos.java b/test/transform/resource/after-ecj/WitherTypeAnnos.java
new file mode 100644
index 00000000..e41d9e13
--- /dev/null
+++ b/test/transform/resource/after-ecj/WitherTypeAnnos.java
@@ -0,0 +1,18 @@
+import lombok.experimental.Wither;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
+}
+class WitherTypeAnnos {
+ final @Wither @TA @TB List<String> foo;
+ WitherTypeAnnos(@TA @TB List<String> foo) {
+ super();
+ this.foo = foo;
+ }
+ public @java.lang.SuppressWarnings("all") WitherTypeAnnos withFoo(final @TA List<String> foo) {
+ return ((this.foo == foo) ? this : new WitherTypeAnnos(foo));
+ }
+}
diff --git a/test/transform/resource/before/BuilderSingularAnnotatedTypes.java b/test/transform/resource/before/BuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..d54fed8d
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularAnnotatedTypes.java
@@ -0,0 +1,14 @@
+//VERSION 8:
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+import lombok.Singular;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {}
+@lombok.Builder
+class BuilderSingularAnnotatedTypes {
+ @Singular private Set<@MyAnnotation @NonNull String> foos;
+ @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+}
diff --git a/test/transform/resource/before/BuilderTypeAnnos.java b/test/transform/resource/before/BuilderTypeAnnos.java
new file mode 100644
index 00000000..6b7bc1d8
--- /dev/null
+++ b/test/transform/resource/before/BuilderTypeAnnos.java
@@ -0,0 +1,14 @@
+//CONF: lombok.copyableAnnotations += TA
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+@lombok.Builder
+class BuilderTypeAnnos {
+ private @TA @TB List<String> foo;
+}
diff --git a/test/transform/resource/before/ConstructorsTypeAnnos.java b/test/transform/resource/before/ConstructorsTypeAnnos.java
new file mode 100644
index 00000000..d767f321
--- /dev/null
+++ b/test/transform/resource/before/ConstructorsTypeAnnos.java
@@ -0,0 +1,14 @@
+//CONF: lombok.copyableAnnotations += TA
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+@lombok.AllArgsConstructor
+class ConstructorsTypeAnnos {
+ @TA @TB List<String> foo;
+}
diff --git a/test/transform/resource/before/GetterTypeAnnos.java b/test/transform/resource/before/GetterTypeAnnos.java
new file mode 100644
index 00000000..34177503
--- /dev/null
+++ b/test/transform/resource/before/GetterTypeAnnos.java
@@ -0,0 +1,15 @@
+//CONF: lombok.copyableAnnotations += TA
+import lombok.Getter;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class GetterTypeAnnos {
+ @Getter
+ @TA @TB List<String> foo;
+}
diff --git a/test/transform/resource/before/SetterTypeAnnos.java b/test/transform/resource/before/SetterTypeAnnos.java
new file mode 100644
index 00000000..8031136d
--- /dev/null
+++ b/test/transform/resource/before/SetterTypeAnnos.java
@@ -0,0 +1,15 @@
+//CONF: lombok.copyableAnnotations += TA
+import lombok.Setter;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class SetterTypeAnnos {
+ @Setter
+ @TA @TB List<String> foo;
+}
diff --git a/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..d26352d2
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java
@@ -0,0 +1,14 @@
+//VERSION 8:
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+import lombok.Singular;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {}
+@lombok.experimental.SuperBuilder
+class SuperBuilderSingularAnnotatedTypes {
+ @Singular private Set<@MyAnnotation @NonNull String> foos;
+ @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+}
diff --git a/test/transform/resource/before/WitherTypeAnnos.java b/test/transform/resource/before/WitherTypeAnnos.java
new file mode 100644
index 00000000..97cd3d9f
--- /dev/null
+++ b/test/transform/resource/before/WitherTypeAnnos.java
@@ -0,0 +1,18 @@
+//CONF: lombok.copyableAnnotations += TA
+import lombok.experimental.Wither;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class WitherTypeAnnos {
+ @Wither final @TA @TB List<String> foo;
+
+ WitherTypeAnnos(@TA @TB List<String> foo) {
+ this.foo = foo;
+ }
+}
diff --git a/website/templates/features/Builder.html b/website/templates/features/Builder.html
index bc03749e..793c7b54 100644
--- a/website/templates/features/Builder.html
+++ b/website/templates/features/Builder.html
@@ -181,6 +181,8 @@ public class JacksonExample {
With <code>toBuilder = true</code> applied to methods, any type parameter of the annotated method itself must also show up in the return type.
</p><p>
The initializer on a <code>@Builder.Default</code> field is removed and stored in a static method, in order to guarantee that this initializer won't be executed at all if a value is specified in the build. This does mean the initializer cannot refer to <code>this</code>, <code>super</code> or any non-static member. If lombok generates a constructor for you, it'll also initialize this field with the initializer.
+ </p><p>
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to parameter of the builder's 'setter' method. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
</p>
</@f.smallPrint>
</@f.scaffold>
diff --git a/website/templates/features/Data.html b/website/templates/features/Data.html
index 59370cc8..36278819 100644
--- a/website/templates/features/Data.html
+++ b/website/templates/features/Data.html
@@ -33,7 +33,7 @@
<p>
See the small print of <a href="/features/ToString"><code>@ToString</code></a>, <a href="/features/EqualsAndHashCode"><code>@EqualsAndHashCode</code></a>, <a href="/features/GetterSetter"><code>@Getter / @Setter</code></a> and <a href="/features/constructor">@RequiredArgsConstructor</a>.
</p><p>
- Any annotations named <code>@NonNull</code> (case insensitive) on a field are interpreted as: This field must not ever hold <em>null</em>. Therefore, these annotations result in an explicit null check in the generated constructor for the provided field. Also, these annotations (as well as any annotation named <code>@Nullable</code>) are copied to the constructor parameter, in both the true constructor and any static constructor. The same principle applies to generated getters and setters (see the documentation for <a href="/features/GetterSetter">@Getter / @Setter</a>)
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to the relevant places (such as the method for getters, and the parameter for the constructor and setters). See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
</p><p>
By default, any variables that start with a $ symbol are excluded automatically. You can include them by specifying an explicit annotation (<code>@Getter</code> or <code>@ToString</code>, for example) and using the 'of' parameter.
</p>
diff --git a/website/templates/features/GetterSetter.html b/website/templates/features/GetterSetter.html
index 1baa5bd0..04cd1ec7 100644
--- a/website/templates/features/GetterSetter.html
+++ b/website/templates/features/GetterSetter.html
@@ -58,7 +58,9 @@
</p><p>
Any variation on <code>boolean</code> will <em>not</em> result in using the <code>is</code> prefix instead of the <code>get</code> prefix; for example, returning <code>java.lang.Boolean</code> results in a <code>get</code> prefix, not an <code>is</code> prefix.
</p><p>
- Any annotations named <code>@NonNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold <em>null</em>. Therefore, these annotations result in an explicit null check in the generated setter. Also, these annotations (as well as any annotation named <code>@Nullable</code> or <code>@CheckForNull</code>) are copied to setter parameter and getter method.
+ A number of annotations from popular libraries that indicate non-nullness, such as <code>javax.annotation.Nonnull</code>, if present on the field, result in an explicit null check in the generated setter.
+ </p><p>
+ Various well-known annotations about nullability, such as <code>org.eclipse.jdt.annotation.NonNull</code>, are automatically copied over to the right place (method for getters, parameter for setters). You can specify additional annotations that should always be copied via lombok <a href="/features/configuration">configuration key</a> <code>lombok.copyableAnnotations</code>.
</p><p>
You can annotate a class with a <code>@Getter</code> or <code>@Setter</code> annotation. Doing so is equivalent to annotating all non-static fields in that class with that annotation. <code>@Getter</code>/<code>@Setter</code> annotations on fields take precedence over the ones on classes.
</p><p>
diff --git a/website/templates/features/Value.html b/website/templates/features/Value.html
index fdad0e12..5fe188b3 100644
--- a/website/templates/features/Value.html
+++ b/website/templates/features/Value.html
@@ -42,6 +42,8 @@
</p><p>
For classes with generics, it's useful to have a static method which serves as a constructor, because inference of generic parameters via static methods works in java6 and avoids having to use the diamond operator. While you can force this by applying an explicit <code>@AllArgsConstructor(staticConstructor="of")</code> annotation, there's also the <code>@Value(staticConstructor="of")</code> feature, which will make the generated all-arguments constructor private, and generates a public static method named <code>of</code> which is a wrapper around this private constructor.
</p><p>
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to the relevant places (such as the method for getters, and the parameter for the constructor and setters). See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
+ </p><p>
<code>@Value</code> was an experimental feature from v0.11.4 to v0.11.9 (as <code>@lombok.experimental.Value</code>). It has since been moved into the core package. The old annotation is still around (and is an alias). It will eventually be removed in a future version, though.
</p><p>
It is not possible to use <code>@FieldDefaults</code> to 'undo' the private-by-default and final-by-default aspect of fields in the annotated class. Use <code>@NonFinal</code> and <code>@PackagePrivate</code> on the fields in the class to override this behaviour.
diff --git a/website/templates/features/constructor.html b/website/templates/features/constructor.html
index 716efe5a..fc0be1c6 100644
--- a/website/templates/features/constructor.html
+++ b/website/templates/features/constructor.html
@@ -51,6 +51,8 @@
</p><p>
While <code>suppressConstructorProperties</code> has been marked deprecated in anticipation of a world where all java environments have the <code>@ConstructorProperties</code> annotation available, first GWT 2.2 and Android 2.3.3, which do not (yet) have this annotation, will have to be ancient history before this annotation parameter will be removed.
</p><p>
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to the parameter. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
+ </p><p>
The <code>flagUsage</code> configuration keys do not trigger when a constructor is generated by <code>@Data</code>, <code>@Value</code> or any other lombok annotation.
</p>
</@f.smallPrint>
diff --git a/website/templates/features/experimental/SuperBuilder.html b/website/templates/features/experimental/SuperBuilder.html
index 9b49bc83..8189a254 100644
--- a/website/templates/features/experimental/SuperBuilder.html
+++ b/website/templates/features/experimental/SuperBuilder.html
@@ -63,6 +63,8 @@
An <code>ArrayList</code> is used to store added elements as call methods of a <code>@Singular</code> marked field, if the target collection is from the <code>java.util</code> package, <em>even if the collection is a set or map</em>. Because lombok ensures that generated collections are compacted, a new backing instance of a set or map must be constructed anyway, and storing the data as an <code>ArrayList</code> during the build process is more efficient that storing it as a map or set. This behaviour is not externally visible, an implementation detail of the current implementation of the <code>java.util</code> recipes for <code>@Singular</code>.
</p><p>
The generated builder code heavily relies on generics to avoid class casting when using the builder.
+ </p><p>
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to parameter of the builder's 'setter' method. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
</p>
</@f.smallPrint>
</@f.scaffold>
diff --git a/website/templates/features/experimental/Wither.html b/website/templates/features/experimental/Wither.html
index 9642458b..00dc10b1 100644
--- a/website/templates/features/experimental/Wither.html
+++ b/website/templates/features/experimental/Wither.html
@@ -60,7 +60,7 @@
</p><p>
For <code>boolean</code> fields that start with <code>is</code> immediately followed by a title-case letter, nothing is prefixed to generate the wither name.
</p><p>
- Any annotations named <code>@NonNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold <em>null</em>. Therefore, these annotations result in an explicit null check in the generated wither. Also, these annotations (as well as any annotation named <code>@Nullable</code> or <code>@CheckForNull</code>) are copied to wither parameter.
+ Various well known annotations about nullity cause null checks to be inserted and will be copied to the parameter. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
</p>
</@f.smallPrint>
</@f.scaffold>