aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-09-04 01:47:59 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-09-11 01:59:19 +0200
commitcc8370ab2d7b3ca15023364c99e53735e62e13d7 (patch)
tree984b7fa824760fb2040067500aaacc859ed68821
parentcd8434feee79c6e119de0a254e071c6c49a8938e (diff)
downloadlombok-cc8370ab2d7b3ca15023364c99e53735e62e13d7.tar.gz
lombok-cc8370ab2d7b3ca15023364c99e53735e62e13d7.tar.bz2
lombok-cc8370ab2d7b3ca15023364c99e53735e62e13d7.zip
code review and fixes for the ‘copyable annotations’ setting concept.
-rw-r--r--src/core/lombok/ConfigurationKeys.java6
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java6
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java18
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java13
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java2
-rw-r--r--src/core/lombok/eclipse/handlers/HandleGetter.java2
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSetter.java4
-rw-r--r--src/core/lombok/eclipse/handlers/HandleWither.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java15
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleWither.java4
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java8
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java22
-rw-r--r--test/transform/resource/after-delombok/BuilderTypeAnnos.java (renamed from test/transform/resource/after-delombok/BuilderTypeAnnosNoCopy.java)24
-rw-r--r--test/transform/resource/after-delombok/BuilderTypeAnnosCopy.java51
-rw-r--r--test/transform/resource/after-delombok/ConstructorsTypeAnnos.java18
-rw-r--r--test/transform/resource/after-delombok/ConstructorsTypeAnnosCopy.java17
-rw-r--r--test/transform/resource/after-delombok/ConstructorsTypeAnnosNoCopy.java17
-rw-r--r--test/transform/resource/after-delombok/GetterTypeAnnos.java19
-rw-r--r--test/transform/resource/after-delombok/GetterTypeAnnosCopy.java18
-rw-r--r--test/transform/resource/after-delombok/GetterTypeAnnosNoCopy.java17
-rw-r--r--test/transform/resource/after-delombok/SetterTypeAnnos.java18
-rw-r--r--test/transform/resource/after-delombok/SetterTypeAnnosCopy.java17
-rw-r--r--test/transform/resource/after-delombok/SetterTypeAnnosNoCopy.java17
-rw-r--r--test/transform/resource/after-delombok/WitherTypeAnnos.java21
-rw-r--r--test/transform/resource/after-delombok/WitherTypeAnnosCopy.java21
-rw-r--r--test/transform/resource/after-delombok/WitherTypeAnnosNoCopy.java21
-rw-r--r--test/transform/resource/after-ecj/BuilderTypeAnnos.java (renamed from test/transform/resource/after-ecj/BuilderTypeAnnosCopy.java)6
-rw-r--r--test/transform/resource/after-ecj/BuilderTypeAnnosNoCopy.java31
-rw-r--r--test/transform/resource/after-ecj/ConstructorsTypeAnnos.java (renamed from test/transform/resource/after-ecj/ConstructorsTypeAnnosCopy.java)6
-rw-r--r--test/transform/resource/after-ecj/ConstructorsTypeAnnosNoCopy.java12
-rw-r--r--test/transform/resource/after-ecj/GetterTypeAnnos.java (renamed from test/transform/resource/after-ecj/GetterTypeAnnosCopy.java)6
-rw-r--r--test/transform/resource/after-ecj/GetterTypeAnnosNoCopy.java15
-rw-r--r--test/transform/resource/after-ecj/SetterTypeAnnos.java (renamed from test/transform/resource/after-ecj/SetterTypeAnnosCopy.java)6
-rw-r--r--test/transform/resource/after-ecj/SetterTypeAnnosNoCopy.java15
-rw-r--r--test/transform/resource/after-ecj/WitherTypeAnnos.java (renamed from test/transform/resource/after-ecj/WitherTypeAnnosCopy.java)8
-rw-r--r--test/transform/resource/after-ecj/WitherTypeAnnosNoCopy.java16
-rw-r--r--test/transform/resource/before/BuilderTypeAnnos.java14
-rw-r--r--test/transform/resource/before/BuilderTypeAnnosCopy.java14
-rw-r--r--test/transform/resource/before/BuilderTypeAnnosNoCopy.java12
-rw-r--r--test/transform/resource/before/ConstructorsTypeAnnos.java14
-rw-r--r--test/transform/resource/before/ConstructorsTypeAnnosCopy.java14
-rw-r--r--test/transform/resource/before/ConstructorsTypeAnnosNoCopy.java12
-rw-r--r--test/transform/resource/before/GetterTypeAnnos.java15
-rw-r--r--test/transform/resource/before/GetterTypeAnnosCopy.java16
-rw-r--r--test/transform/resource/before/GetterTypeAnnosNoCopy.java14
-rw-r--r--test/transform/resource/before/SetterTypeAnnos.java15
-rw-r--r--test/transform/resource/before/SetterTypeAnnosCopy.java16
-rw-r--r--test/transform/resource/before/SetterTypeAnnosNoCopy.java14
-rw-r--r--test/transform/resource/before/WitherTypeAnnos.java18
-rw-r--r--test/transform/resource/before/WitherTypeAnnosCopy.java19
-rw-r--r--test/transform/resource/before/WitherTypeAnnosNoCopy.java17
54 files changed, 244 insertions, 513 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index beb0d1e0..89748f60 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -565,10 +565,10 @@ public class ConfigurationKeys {
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.copyAnnotations} += &lt;String: fully-qualified annotation class name&gt;.
+ * lombok configuration: {@code lombok.copyableAnnotations} += &lt;String: fully-qualified annotation class name&gt;.
*
- * Copy these annotations to getters, setters, etc.
+ * Copy these annotations to getters, setters, withers, builder-setters, etc.
*/
- public static final ConfigurationKey<List<String>> COPY_ANNOTATIONS = new ConfigurationKey<List<String>>("lombok.copyAnnotations", "Copy these annotations to getters, setters, etc.") {};
+ public static final ConfigurationKey<List<String>> COPYABLE_ANNOTATIONS = new ConfigurationKey<List<String>>("lombok.copyableAnnotations", "Copy these annotations to getters, setters, withers, builder-setters, etc.") {};
}
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index 48c48c20..1694e305 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -230,9 +230,9 @@ public class HandlerUtil {
public static final String DEFAULT_EXCEPTION_FOR_NON_NULL = "java.lang.NullPointerException";
- /** Returns the configuration value for ConfigurationKeys.COPY_ANNOTATIONS. */
- public static List<String> copyAnnotationNames(AST<?, ?, ?> ast) {
- return ast.readConfiguration(ConfigurationKeys.COPY_ANNOTATIONS);
+ /** Returns the configuration value for ConfigurationKeys.COPYABLE_ANNOTATIONS. */
+ public static List<String> getCopyableAnnotationNames(AST<?, ?, ?> ast) {
+ return ast.readConfiguration(ConfigurationKeys.COPYABLE_ANNOTATIONS);
}
/**
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 1e29764a..e7a58de3 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -672,6 +672,24 @@ public class EclipseHandlerUtil {
}
}
+ private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0];
+
+ /**
+ * Searches the given field node for annotations and returns each one that matches the provided list of names.
+ */
+ public static Annotation[] findExactAnnotations(AbstractVariableDeclaration field, List<String> names) {
+ List<Annotation> result = new ArrayList<Annotation>();
+ if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY;
+ for (Annotation annotation : field.annotations) {
+ TypeReference typeRef = annotation.type;
+ if (typeRef != null && typeRef.getTypeName() != null) {
+ String annoName = toQualifiedName(typeRef.getTypeName());
+ if (names.contains(annoName)) result.add(annotation);
+ }
+ }
+ 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 3e373a00..f05896ab 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -202,8 +202,8 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
Annotation[] nonNulls = findAnnotations(fd, NON_NULL_PATTERN);
Annotation[] nullables = findAnnotations(fd, NULLABLE_PATTERN);
- Annotation[] copyAnnotations = findExactAnnotations(fd, copyAnnotationNames(fieldNode.getAst()));
-
+ Annotation[] copyAnnotations = findExactAnnotations(fd, getCopyableAnnotationNames(fieldNode.getAst()));
+
BuilderFieldData bfd = new BuilderFieldData();
bfd.rawName = fieldNode.getName().toCharArray();
bfd.name = removePrefixFromField(fieldNode);
@@ -380,9 +380,14 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
if (param.getKind() != Kind.ARGUMENT) continue;
BuilderFieldData bfd = new BuilderFieldData();
Argument arg = (Argument) param.get();
+
+ Annotation[] nonNulls = findAnnotations(arg, NON_NULL_PATTERN);
+ Annotation[] nullables = findAnnotations(arg, NULLABLE_PATTERN);
+ Annotation[] copyAnnotations = findExactAnnotations(arg, getCopyableAnnotationNames(param.getAst()));
+
bfd.rawName = arg.name;
bfd.name = arg.name;
- bfd.annotations = arg.annotations;
+ bfd.annotations = copyAnnotations(arg, nonNulls, nullables, copyAnnotations);
bfd.type = arg.type;
bfd.singularData = getSingularData(param, ast);
bfd.originalFieldNode = param;
@@ -774,7 +779,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(), annotations != null ? Arrays.asList(annotations) : 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 cb9c2b4b..3d947a73 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -405,7 +405,7 @@ public class HandleConstructor {
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);
- Annotation[] copyAnnotations = findExactAnnotations(field, copyAnnotationNames(fieldNode.getAst()));
+ Annotation[] copyAnnotations = findExactAnnotations(field, getCopyableAnnotationNames(fieldNode.getAst()));
if (nonNulls.length != 0) {
Statement nullCheck = generateNullCheck(parameter, sourceNode);
if (nullCheck != null) nullChecks.add(nullCheck);
diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java
index 45ddb2cc..58af8c1e 100644
--- a/src/core/lombok/eclipse/handlers/HandleGetter.java
+++ b/src/core/lombok/eclipse/handlers/HandleGetter.java
@@ -274,7 +274,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
onMethod.toArray(new Annotation[0]),
findAnnotations(field, NON_NULL_PATTERN),
findAnnotations(field, NULLABLE_PATTERN),
- findExactAnnotations(field, copyAnnotationNames(fieldNode.getAst())),
+ findExactAnnotations(field, getCopyableAnnotationNames(fieldNode.getAst())),
findDelegatesAndMarkAsHandled(fieldNode),
deprecated);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java
index bd34b313..ca81fef7 100644
--- a/src/core/lombok/eclipse/handlers/HandleSetter.java
+++ b/src/core/lombok/eclipse/handlers/HandleSetter.java
@@ -238,7 +238,7 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
- Annotation[] copyAnnotations = findExactAnnotations(field, copyAnnotationNames(fieldNode.getAst()));
+ Annotation[] copyableAnnotations = findExactAnnotations(field, getCopyableAnnotationNames(fieldNode.getAst()));
List<Statement> statements = new ArrayList<Statement>(5);
if (nonNulls.length == 0) {
statements.add(assignment);
@@ -256,7 +256,7 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
statements.add(returnStatement);
}
method.statements = statements.toArray(new Statement[0]);
- param.annotations = copyAnnotations(source, nonNulls, nullables, copyAnnotations, onParam.toArray(new Annotation[0]));
+ param.annotations = copyAnnotations(source, nonNulls, nullables, copyableAnnotations, onParam.toArray(new Annotation[0]));
method.traverse(new SetGeneratedByVisitor(source), parent.scope);
return method;
diff --git a/src/core/lombok/eclipse/handlers/HandleWither.java b/src/core/lombok/eclipse/handlers/HandleWither.java
index e9831ce1..11032e9c 100644
--- a/src/core/lombok/eclipse/handlers/HandleWither.java
+++ b/src/core/lombok/eclipse/handlers/HandleWither.java
@@ -242,7 +242,7 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
- Annotation[] copyAnnotations = findExactAnnotations(field, copyAnnotationNames(fieldNode.getAst()));
+ Annotation[] copyableAnnotations = findExactAnnotations(field, getCopyableAnnotationNames(fieldNode.getAst()));
if (!makeAbstract) {
List<Expression> args = new ArrayList<Expression>();
@@ -286,7 +286,7 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
method.statements = statements.toArray(new Statement[0]);
}
- param.annotations = copyAnnotations(source, nonNulls, nullables, copyAnnotations, onParam.toArray(new Annotation[0]));
+ param.annotations = copyAnnotations(source, nonNulls, nullables, copyableAnnotations, onParam.toArray(new Annotation[0]));
method.traverse(new SetGeneratedByVisitor(source), parent.scope);
return method;
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index 75bfb01c..7577eeb2 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -149,15 +149,15 @@ 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));
-
+
List<JCAnnotation> nonNulls = findAnnotations(fieldNode, NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(fieldNode, NULLABLE_PATTERN);
- List<JCAnnotation> copyAnnotations = findExactAnnotations(fieldNode, copyAnnotationNames(fieldNode.getAst()));
-
+ List<JCAnnotation> copyableAnnotations = findExactAnnotations(fieldNode, getCopyableAnnotationNames(fieldNode.getAst()));
+
BuilderFieldData bfd = new BuilderFieldData();
bfd.rawName = fd.name;
bfd.name = removePrefixFromField(fieldNode);
- bfd.annotations = nonNulls.appendList(nullables).appendList(copyAnnotations);
+ bfd.annotations = nonNulls.appendList(nullables).appendList(copyableAnnotations);
bfd.type = fd.vartype;
bfd.singularData = getSingularData(fieldNode);
bfd.originalFieldNode = fieldNode;
@@ -333,10 +333,15 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
for (JavacNode param : fillParametersFrom.down()) {
if (param.getKind() != Kind.ARGUMENT) continue;
BuilderFieldData bfd = new BuilderFieldData();
+
+ List<JCAnnotation> nonNulls = findAnnotations(param, NON_NULL_PATTERN);
+ List<JCAnnotation> nullables = findAnnotations(param, NULLABLE_PATTERN);
+ List<JCAnnotation> copyableAnnotations = findExactAnnotations(param, getCopyableAnnotationNames(param.getAst()));
+
JCVariableDecl raw = (JCVariableDecl) param.get();
bfd.name = raw.name;
bfd.rawName = raw.name;
- bfd.annotations = raw.mods.annotations;
+ bfd.annotations = nonNulls.appendList(nullables).appendList(copyableAnnotations);
bfd.type = raw.vartype;
bfd.singularData = getSingularData(param);
bfd.originalFieldNode = param;
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index b0fa3d29..1e45d73f 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -331,9 +331,9 @@ public class HandleConstructor {
Name rawName = field.name;
List<JCAnnotation> nonNulls = findAnnotations(fieldNode, NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(fieldNode, NULLABLE_PATTERN);
- List<JCAnnotation> copyAnnotations = findExactAnnotations(fieldNode, copyAnnotationNames(fieldNode.getAst()));
+ List<JCAnnotation> copyableAnnotations = findExactAnnotations(fieldNode, getCopyableAnnotationNames(fieldNode.getAst()));
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, typeNode.getContext());
- JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, nonNulls.appendList(nullables).appendList(copyAnnotations)), fieldName, field.vartype, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, nonNulls.appendList(nullables).appendList(copyableAnnotations)), fieldName, field.vartype, null);
params.append(param);
if (!nonNulls.isEmpty()) {
JCStatement nullCheck = generateNullCheck(maker, fieldNode, param, source);
diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java
index 6e4b2685..04b300a8 100644
--- a/src/core/lombok/javac/handlers/HandleGetter.java
+++ b/src/core/lombok/javac/handlers/HandleGetter.java
@@ -245,11 +245,11 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN);
- List<JCAnnotation> copyAnnotations = findExactAnnotations(field, copyAnnotationNames(field.getAst()));
+ List<JCAnnotation> copyableAnnotations = findExactAnnotations(field, getCopyableAnnotationNames(field.getAst()));
List<JCAnnotation> delegates = findDelegatesAndRemoveFromField(field);
- List<JCAnnotation> annsOnMethod = copyAnnotations(onMethod).appendList(nonNulls).appendList(nullables).appendList(copyAnnotations);
+ List<JCAnnotation> annsOnMethod = copyAnnotations(onMethod).appendList(nonNulls).appendList(nullables).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 631ea193..e5e9481d 100644
--- a/src/core/lombok/javac/handlers/HandleSetter.java
+++ b/src/core/lombok/javac/handlers/HandleSetter.java
@@ -228,10 +228,10 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> {
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN);
- List<JCAnnotation> copyAnnotations = findExactAnnotations(field, copyAnnotationNames(field.getAst()));
+ List<JCAnnotation> copyableAnnotations = findExactAnnotations(field, getCopyableAnnotationNames(field.getAst()));
Name methodName = field.toName(setterName);
- List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables).appendList(copyAnnotations);
+ List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables).appendList(copyableAnnotations);
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext());
JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
diff --git a/src/core/lombok/javac/handlers/HandleWither.java b/src/core/lombok/javac/handlers/HandleWither.java
index e6fc2d02..b0e32d61 100644
--- a/src/core/lombok/javac/handlers/HandleWither.java
+++ b/src/core/lombok/javac/handlers/HandleWither.java
@@ -224,7 +224,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
List<JCAnnotation> nonNulls = findAnnotations(field, NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(field, NULLABLE_PATTERN);
- List<JCAnnotation> copyAnnotations = findExactAnnotations(field, copyAnnotationNames(field.getAst()));
+ List<JCAnnotation> copyableAnnotations = findExactAnnotations(field, getCopyableAnnotationNames(field.getAst()));
Name methodName = field.toName(witherName);
@@ -232,7 +232,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).appendList(copyAnnotations);
+ List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables).appendList(copyableAnnotations);
JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index cb729183..1cc28072 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1343,15 +1343,13 @@ public class JavacHandlerUtil {
for (JavacNode child : fieldNode.down()) {
if (child.getKind() == Kind.ANNOTATION) {
JCAnnotation annotation = (JCAnnotation) child.get();
- String annoname = annotation.annotationType.toString();
- if (names.contains(annoname)) {
- result.append(annotation);
- }
+ String annoName = annotation.annotationType.toString();
+ if (names.contains(annoName)) result.append(annotation);
}
}
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.
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java
index 42adeeac..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) {
@@ -155,24 +155,6 @@ public class Eclipse {
return result.toArray(EMPTY_ANNOTATIONS_ARRAY);
}
- /**
- * Searches the given field node for annotations and returns each one that matches the provided list of names.
- */
- public static Annotation[] findExactAnnotations(FieldDeclaration field, List<String> names) {
- List<Annotation> result = new ArrayList<Annotation>();
- if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY;
- for (Annotation annotation : field.annotations) {
- TypeReference typeRef = annotation.type;
- if (typeRef != null && typeRef.getTypeName() != null) {
- String annoname = toQualifiedName(typeRef.getTypeName());
- if (names.contains(annoname)) {
- result.add(annotation);
- }
- }
- }
- return result.toArray(EMPTY_ANNOTATIONS_ARRAY);
- }
-
/** Matches any of the 8 primitive names, such as {@code boolean}. */
private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile(
"^(boolean|byte|short|int|long|float|double|char)$");
diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnosNoCopy.java b/test/transform/resource/after-delombok/BuilderTypeAnnos.java
index b08e03a3..8a31762a 100644
--- a/test/transform/resource/after-delombok/BuilderTypeAnnosNoCopy.java
+++ b/test/transform/resource/after-delombok/BuilderTypeAnnos.java
@@ -1,48 +1,42 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@interface TA {
}
-
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
class BuilderTypeAnnos {
@TA
- private List<@TA String> foo;
-
+ @TB
+ private List<String> foo;
@java.lang.SuppressWarnings("all")
- BuilderTypeAnnos(final List<@TA String> foo) {
+ BuilderTypeAnnos(@TA final List<String> foo) {
this.foo = foo;
}
-
-
@java.lang.SuppressWarnings("all")
public static class BuilderTypeAnnosBuilder {
@java.lang.SuppressWarnings("all")
- private List<@TA String> foo;
-
+ private List<String> foo;
@java.lang.SuppressWarnings("all")
BuilderTypeAnnosBuilder() {
}
-
@java.lang.SuppressWarnings("all")
- public BuilderTypeAnnosBuilder foo(final List<@TA String> foo) {
+ 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/BuilderTypeAnnosCopy.java b/test/transform/resource/after-delombok/BuilderTypeAnnosCopy.java
deleted file mode 100644
index 8b0ea537..00000000
--- a/test/transform/resource/after-delombok/BuilderTypeAnnosCopy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class BuilderTypeAnnos {
- @TA
- private List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- BuilderTypeAnnos(@TA final List<@TA String> foo) {
- this.foo = foo;
- }
-
-
- @java.lang.SuppressWarnings("all")
- public static class BuilderTypeAnnosBuilder {
- @java.lang.SuppressWarnings("all")
- private List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- BuilderTypeAnnosBuilder() {
- }
-
- @java.lang.SuppressWarnings("all")
- public BuilderTypeAnnosBuilder foo(@TA final List<@TA 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/ConstructorsTypeAnnosCopy.java b/test/transform/resource/after-delombok/ConstructorsTypeAnnosCopy.java
deleted file mode 100644
index 28d6ed09..00000000
--- a/test/transform/resource/after-delombok/ConstructorsTypeAnnosCopy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class ConstructorsTypeAnnos {
- @TA
- List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- public ConstructorsTypeAnnos(@TA final List<@TA String> foo) {
- this.foo = foo;
- }
-}
diff --git a/test/transform/resource/after-delombok/ConstructorsTypeAnnosNoCopy.java b/test/transform/resource/after-delombok/ConstructorsTypeAnnosNoCopy.java
deleted file mode 100644
index e27131ef..00000000
--- a/test/transform/resource/after-delombok/ConstructorsTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class ConstructorsTypeAnnos {
- @TA
- List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- public ConstructorsTypeAnnos(final List<@TA 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/GetterTypeAnnosCopy.java b/test/transform/resource/after-delombok/GetterTypeAnnosCopy.java
deleted file mode 100644
index cde6cbdd..00000000
--- a/test/transform/resource/after-delombok/GetterTypeAnnosCopy.java
+++ /dev/null
@@ -1,18 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class GetterTypeAnnos {
- @TA
- List<@TA String> foo;
-
- @TA
- @java.lang.SuppressWarnings("all")
- public List<@TA String> getFoo() {
- return this.foo;
- }
-}
diff --git a/test/transform/resource/after-delombok/GetterTypeAnnosNoCopy.java b/test/transform/resource/after-delombok/GetterTypeAnnosNoCopy.java
deleted file mode 100644
index 58054de6..00000000
--- a/test/transform/resource/after-delombok/GetterTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class GetterTypeAnnos {
- @TA
- List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- public List<@TA 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/SetterTypeAnnosCopy.java b/test/transform/resource/after-delombok/SetterTypeAnnosCopy.java
deleted file mode 100644
index b45c3234..00000000
--- a/test/transform/resource/after-delombok/SetterTypeAnnosCopy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class SetterTypeAnnos {
- @TA
- List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- public void setFoo(@TA final List<@TA String> foo) {
- this.foo = foo;
- }
-}
diff --git a/test/transform/resource/after-delombok/SetterTypeAnnosNoCopy.java b/test/transform/resource/after-delombok/SetterTypeAnnosNoCopy.java
deleted file mode 100644
index e773bd9c..00000000
--- a/test/transform/resource/after-delombok/SetterTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class SetterTypeAnnos {
- @TA
- List<@TA String> foo;
-
- @java.lang.SuppressWarnings("all")
- public void setFoo(final List<@TA String> foo) {
- this.foo = foo;
- }
-}
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-delombok/WitherTypeAnnosCopy.java b/test/transform/resource/after-delombok/WitherTypeAnnosCopy.java
deleted file mode 100644
index 8cbb7e5d..00000000
--- a/test/transform/resource/after-delombok/WitherTypeAnnosCopy.java
+++ /dev/null
@@ -1,21 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class WitherTypeAnnos {
- @TA
- final List<@TA String> foo;
-
- WitherTypeAnnos(@TA List<@TA String> foo) {
- this.foo = foo;
- }
-
- @java.lang.SuppressWarnings("all")
- public WitherTypeAnnos withFoo(@TA final List<@TA String> foo) {
- return this.foo == foo ? this : new WitherTypeAnnos(foo);
- }
-}
diff --git a/test/transform/resource/after-delombok/WitherTypeAnnosNoCopy.java b/test/transform/resource/after-delombok/WitherTypeAnnosNoCopy.java
deleted file mode 100644
index 18c25e04..00000000
--- a/test/transform/resource/after-delombok/WitherTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,21 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class WitherTypeAnnos {
- @TA
- final List<@TA String> foo;
-
- WitherTypeAnnos(@TA List<@TA String> foo) {
- this.foo = foo;
- }
-
- @java.lang.SuppressWarnings("all")
- public WitherTypeAnnos withFoo(final List<@TA String> foo) {
- return this.foo == foo ? this : new WitherTypeAnnos(foo);
- }
-}
diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosCopy.java b/test/transform/resource/after-ecj/BuilderTypeAnnos.java
index 8dfc8164..1c310f38 100644
--- a/test/transform/resource/after-ecj/BuilderTypeAnnosCopy.java
+++ b/test/transform/resource/after-ecj/BuilderTypeAnnos.java
@@ -1,7 +1,9 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
+@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 {
@@ -20,7 +22,7 @@ import java.util.List;
return (("BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo) + ")");
}
}
- private @TA List<@TA String> foo;
+ private @TA @TB List<String> foo;
@java.lang.SuppressWarnings("all") BuilderTypeAnnos(final @TA List<String> foo) {
super();
this.foo = foo;
diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosNoCopy.java b/test/transform/resource/after-ecj/BuilderTypeAnnosNoCopy.java
deleted file mode 100644
index a2dfcc2f..00000000
--- a/test/transform/resource/after-ecj/BuilderTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,31 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
-}
-@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 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 List<@TA String> foo;
- @java.lang.SuppressWarnings("all") BuilderTypeAnnos(final 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/ConstructorsTypeAnnosCopy.java b/test/transform/resource/after-ecj/ConstructorsTypeAnnos.java
index ad372fc9..3491239f 100644
--- a/test/transform/resource/after-ecj/ConstructorsTypeAnnosCopy.java
+++ b/test/transform/resource/after-ecj/ConstructorsTypeAnnos.java
@@ -1,10 +1,12 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
}
@lombok.AllArgsConstructor class ConstructorsTypeAnnos {
- @TA List<@TA String> foo;
+ @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/ConstructorsTypeAnnosNoCopy.java b/test/transform/resource/after-ecj/ConstructorsTypeAnnosNoCopy.java
deleted file mode 100644
index ce4b1b3b..00000000
--- a/test/transform/resource/after-ecj/ConstructorsTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,12 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
-}
-@lombok.AllArgsConstructor class ConstructorsTypeAnnos {
- @TA List<@TA String> foo;
- public @java.lang.SuppressWarnings("all") ConstructorsTypeAnnos(final List<String> foo) {
- super();
- this.foo = foo;
- }
-}
diff --git a/test/transform/resource/after-ecj/GetterTypeAnnosCopy.java b/test/transform/resource/after-ecj/GetterTypeAnnos.java
index 1b4f03c5..9ffc7f1c 100644
--- a/test/transform/resource/after-ecj/GetterTypeAnnosCopy.java
+++ b/test/transform/resource/after-ecj/GetterTypeAnnos.java
@@ -2,10 +2,12 @@ import lombok.Getter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
}
class GetterTypeAnnos {
- @Getter @TA List<@TA String> foo;
+ @Getter @TA @TB List<String> foo;
GetterTypeAnnos() {
super();
}
diff --git a/test/transform/resource/after-ecj/GetterTypeAnnosNoCopy.java b/test/transform/resource/after-ecj/GetterTypeAnnosNoCopy.java
deleted file mode 100644
index a43d3215..00000000
--- a/test/transform/resource/after-ecj/GetterTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,15 +0,0 @@
-import lombok.Getter;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
-}
-class GetterTypeAnnos {
- @Getter @TA List<@TA String> foo;
- GetterTypeAnnos() {
- super();
- }
- public @java.lang.SuppressWarnings("all") List<String> getFoo() {
- return this.foo;
- }
-}
diff --git a/test/transform/resource/after-ecj/SetterTypeAnnosCopy.java b/test/transform/resource/after-ecj/SetterTypeAnnos.java
index ef290cbf..860694ea 100644
--- a/test/transform/resource/after-ecj/SetterTypeAnnosCopy.java
+++ b/test/transform/resource/after-ecj/SetterTypeAnnos.java
@@ -2,10 +2,12 @@ import lombok.Setter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
}
class SetterTypeAnnos {
- @Setter @TA List<@TA String> foo;
+ @Setter @TA @TB List<String> foo;
SetterTypeAnnos() {
super();
}
diff --git a/test/transform/resource/after-ecj/SetterTypeAnnosNoCopy.java b/test/transform/resource/after-ecj/SetterTypeAnnosNoCopy.java
deleted file mode 100644
index 17e27782..00000000
--- a/test/transform/resource/after-ecj/SetterTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,15 +0,0 @@
-import lombok.Setter;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
-}
-class SetterTypeAnnos {
- @Setter @TA List<@TA String> foo;
- SetterTypeAnnos() {
- super();
- }
- public @java.lang.SuppressWarnings("all") void setFoo(final List<String> foo) {
- this.foo = foo;
- }
-}
diff --git a/test/transform/resource/after-ecj/WitherTypeAnnosCopy.java b/test/transform/resource/after-ecj/WitherTypeAnnos.java
index b4f3c687..e41d9e13 100644
--- a/test/transform/resource/after-ecj/WitherTypeAnnosCopy.java
+++ b/test/transform/resource/after-ecj/WitherTypeAnnos.java
@@ -2,11 +2,13 @@ import lombok.experimental.Wither;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB {
}
class WitherTypeAnnos {
- final @Wither @TA List<@TA String> foo;
- WitherTypeAnnos(@TA List<@TA String> foo) {
+ final @Wither @TA @TB List<String> foo;
+ WitherTypeAnnos(@TA @TB List<String> foo) {
super();
this.foo = foo;
}
diff --git a/test/transform/resource/after-ecj/WitherTypeAnnosNoCopy.java b/test/transform/resource/after-ecj/WitherTypeAnnosNoCopy.java
deleted file mode 100644
index 4f0b0710..00000000
--- a/test/transform/resource/after-ecj/WitherTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,16 +0,0 @@
-import lombok.experimental.Wither;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
-}
-class WitherTypeAnnos {
- final @Wither @TA List<@TA String> foo;
- WitherTypeAnnos(@TA List<@TA String> foo) {
- super();
- this.foo = foo;
- }
- public @java.lang.SuppressWarnings("all") WitherTypeAnnos withFoo(final List<String> foo) {
- return ((this.foo == foo) ? this : new WitherTypeAnnos(foo));
- }
-}
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/BuilderTypeAnnosCopy.java b/test/transform/resource/before/BuilderTypeAnnosCopy.java
deleted file mode 100644
index e5ea9e41..00000000
--- a/test/transform/resource/before/BuilderTypeAnnosCopy.java
+++ /dev/null
@@ -1,14 +0,0 @@
-//CONF: lombok.copyAnnotations += TA
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-@lombok.Builder
-class BuilderTypeAnnos {
- private @TA List<@TA String> foo;
-}
diff --git a/test/transform/resource/before/BuilderTypeAnnosNoCopy.java b/test/transform/resource/before/BuilderTypeAnnosNoCopy.java
deleted file mode 100644
index 2defba7b..00000000
--- a/test/transform/resource/before/BuilderTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,12 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-@lombok.Builder
-class BuilderTypeAnnos {
- private @TA List<@TA 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/ConstructorsTypeAnnosCopy.java b/test/transform/resource/before/ConstructorsTypeAnnosCopy.java
deleted file mode 100644
index 229927c3..00000000
--- a/test/transform/resource/before/ConstructorsTypeAnnosCopy.java
+++ /dev/null
@@ -1,14 +0,0 @@
-//CONF: lombok.copyAnnotations += TA
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-@lombok.AllArgsConstructor
-class ConstructorsTypeAnnos {
- @TA List<@TA String> foo;
-}
diff --git a/test/transform/resource/before/ConstructorsTypeAnnosNoCopy.java b/test/transform/resource/before/ConstructorsTypeAnnosNoCopy.java
deleted file mode 100644
index 7bc27008..00000000
--- a/test/transform/resource/before/ConstructorsTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,12 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-@lombok.AllArgsConstructor
-class ConstructorsTypeAnnos {
- @TA List<@TA 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/GetterTypeAnnosCopy.java b/test/transform/resource/before/GetterTypeAnnosCopy.java
deleted file mode 100644
index b48b8337..00000000
--- a/test/transform/resource/before/GetterTypeAnnosCopy.java
+++ /dev/null
@@ -1,16 +0,0 @@
-//CONF: lombok.copyAnnotations += TA
-
-import lombok.Getter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class GetterTypeAnnos {
- @Getter
- @TA List<@TA String> foo;
-}
diff --git a/test/transform/resource/before/GetterTypeAnnosNoCopy.java b/test/transform/resource/before/GetterTypeAnnosNoCopy.java
deleted file mode 100644
index bf4d9486..00000000
--- a/test/transform/resource/before/GetterTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,14 +0,0 @@
-import lombok.Getter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class GetterTypeAnnos {
- @Getter
- @TA List<@TA 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/SetterTypeAnnosCopy.java b/test/transform/resource/before/SetterTypeAnnosCopy.java
deleted file mode 100644
index d9d086f0..00000000
--- a/test/transform/resource/before/SetterTypeAnnosCopy.java
+++ /dev/null
@@ -1,16 +0,0 @@
-//CONF: lombok.copyAnnotations += TA
-
-import lombok.Setter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class SetterTypeAnnos {
- @Setter
- @TA List<@TA String> foo;
-}
diff --git a/test/transform/resource/before/SetterTypeAnnosNoCopy.java b/test/transform/resource/before/SetterTypeAnnosNoCopy.java
deleted file mode 100644
index e3666543..00000000
--- a/test/transform/resource/before/SetterTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,14 +0,0 @@
-import lombok.Setter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class SetterTypeAnnos {
- @Setter
- @TA List<@TA String> foo;
-}
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/test/transform/resource/before/WitherTypeAnnosCopy.java b/test/transform/resource/before/WitherTypeAnnosCopy.java
deleted file mode 100644
index 645682f5..00000000
--- a/test/transform/resource/before/WitherTypeAnnosCopy.java
+++ /dev/null
@@ -1,19 +0,0 @@
-//CONF: lombok.copyAnnotations += TA
-
-import lombok.experimental.Wither;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class WitherTypeAnnos {
- @Wither final @TA List<@TA String> foo;
-
- WitherTypeAnnos(@TA List<@TA String> foo) {
- this.foo = foo;
- }
-}
diff --git a/test/transform/resource/before/WitherTypeAnnosNoCopy.java b/test/transform/resource/before/WitherTypeAnnosNoCopy.java
deleted file mode 100644
index d278af55..00000000
--- a/test/transform/resource/before/WitherTypeAnnosNoCopy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-import lombok.experimental.Wither;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.List;
-
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-@interface TA {
-}
-
-class WitherTypeAnnos {
- @Wither final @TA List<@TA String> foo;
-
- WitherTypeAnnos(@TA List<@TA String> foo) {
- this.foo = foo;
- }
-}