aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Rieke <rieke@subshell.com>2018-10-12 09:06:34 +0200
committerJan Rieke <rieke@subshell.com>2018-10-12 09:06:34 +0200
commitd6057f8eb7d38994dc94645c55979f0f8a2233fa (patch)
tree63a0b717a09782c1f3a9017c1e979a0a786fcba1 /src
parent3bb6f69a5b03ac3181f5bd6a04050ba339c7642e (diff)
downloadlombok-d6057f8eb7d38994dc94645c55979f0f8a2233fa.tar.gz
lombok-d6057f8eb7d38994dc94645c55979f0f8a2233fa.tar.bz2
lombok-d6057f8eb7d38994dc94645c55979f0f8a2233fa.zip
fixed toBuilder on Singular fields with wildcards (javac)
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java3
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index 8170898b..6dd98c6f 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -521,7 +521,8 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
arg = tgt[0];
} else {
JCExpression eqNull = maker.Binary(CTC_EQUAL, tgt[0], maker.Literal(CTC_BOT, null));
- List<JCExpression> tas = cloneTypes(maker, bfd.singularData.getTypeArgs(), ast, type.getContext());
+ // Use the singularizer to create the type args (will remove possible wildcards on the type).
+ List<JCExpression> tas = bfd.singularData.getSingularizer().createTypeArgs(bfd.singularData.getTypeArgs().size(), false, type, bfd.singularData.getTypeArgs(), type.get());
JCExpression emptyList = maker.Apply(tas, chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil());
arg = maker.Conditional(eqNull, emptyList, tgt[1]);
}
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
index 74010d52..a50565ac 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
@@ -169,13 +169,13 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer {
List<JCExpression> jceBlank = List.nil();
JCExpression varType = chainDotsString(builderType, data.getTargetFqn());
- int agrumentsCount = getTypeArgumentsCount();
- varType = addTypeArgs(agrumentsCount, false, builderType, varType, data.getTypeArgs(), source);
+ int argumentsCount = getTypeArgumentsCount();
+ varType = addTypeArgs(argumentsCount, false, builderType, varType, data.getTypeArgs(), source);
JCExpression empty; {
//ImmutableX.of()
JCExpression emptyMethod = chainDots(builderType, "com", "google", "common", "collect", getSimpleTargetTypeName(data), "of");
- List<JCExpression> invokeTypeArgs = createTypeArgs(agrumentsCount, false, builderType, data.getTypeArgs(), source);
+ List<JCExpression> invokeTypeArgs = createTypeArgs(argumentsCount, false, builderType, data.getTypeArgs(), source);
empty = maker.Apply(invokeTypeArgs, emptyMethod, jceBlank);
}