aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Middag <jacob@gaddim.nl>2019-08-08 21:14:58 +0200
committerJacob Middag <jacob@gaddim.nl>2019-08-08 21:14:58 +0200
commit819d1956761f6077fdf897e77c4f6ac47e92104e (patch)
tree9dcde5edd2c5fc7d17c83b97ad46fda28c5964d1 /src
parentff1c01d9e9e66d898c30939b497490b04fe6163c (diff)
downloadlombok-819d1956761f6077fdf897e77c4f6ac47e92104e.tar.gz
lombok-819d1956761f6077fdf897e77c4f6ac47e92104e.tar.bz2
lombok-819d1956761f6077fdf897e77c4f6ac47e92104e.zip
[Fixes #2189] Clone type to correctly set annotated type on constructor, getter and setter.
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java3
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java2
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java3
3 files changed, 5 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index 096963f4..34d2cbfe 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -339,7 +339,8 @@ public class HandleConstructor {
Name rawName = field.name;
List<JCAnnotation> copyableAnnotations = findCopyableAnnotations(fieldNode);
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, typeNode.getContext());
- JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, copyableAnnotations), fieldName, field.vartype, null);
+ JCExpression pType = cloneType(fieldNode.getTreeMaker(), field.vartype, source.get(), source.getContext());
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, copyableAnnotations), fieldName, pType, null);
params.append(param);
if (hasNonNullAnnotations(fieldNode)) {
JCStatement nullCheck = generateNullCheck(maker, param, source);
diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java
index 7a178f66..f17936eb 100644
--- a/src/core/lombok/javac/handlers/HandleGetter.java
+++ b/src/core/lombok/javac/handlers/HandleGetter.java
@@ -223,7 +223,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
JCVariableDecl fieldNode = (JCVariableDecl) field.get();
// Remember the type; lazy will change it
- JCExpression methodType = copyType(treeMaker, fieldNode);
+ JCExpression methodType = cloneType(treeMaker, copyType(treeMaker, fieldNode), source, field.getContext());
// Generate the methodName; lazy will change the field type
Name methodName = field.toName(toGetterName(field));
diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java
index cd8b5d1c..560069ff 100644
--- a/src/core/lombok/javac/handlers/HandleSetter.java
+++ b/src/core/lombok/javac/handlers/HandleSetter.java
@@ -233,7 +233,8 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> {
List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(copyableAnnotations);
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext());
- JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(flags, annsOnParam), paramName, fieldDecl.vartype, null);
+ JCExpression pType = cloneType(treeMaker, fieldDecl.vartype, source.get(), source.getContext());
+ JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(flags, annsOnParam), paramName, pType, null);
if (!hasNonNullAnnotations(field) && !hasNonNullAnnotations(field, onParam)) {
statements.append(treeMaker.Exec(assign));