diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-10-29 23:29:10 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-10-29 23:29:10 +0100 |
commit | d8de0e3c49c97450c3cd78a7d1766a8f21150591 (patch) | |
tree | 47e8b626b1dda32d3ddcbccc022799653fc786b2 /src/core | |
parent | eca219ee6433cd964f0549a114a791ca4eb9f0fa (diff) | |
parent | e9d098a16c6b07fb39905ce154f810255a0dfc8f (diff) | |
download | lombok-d8de0e3c49c97450c3cd78a7d1766a8f21150591.tar.gz lombok-d8de0e3c49c97450c3cd78a7d1766a8f21150591.tar.bz2 lombok-d8de0e3c49c97450c3cd78a7d1766a8f21150591.zip |
Merge branch 'wildcardsSingularFix' of git://github.com/janrieke/lombok into janrieke-wildcardsSingularFix
Diffstat (limited to 'src/core')
3 files changed, 15 insertions, 5 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index 89cf81e0..0ce1436d 100644 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -537,7 +537,17 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> { boolean obtainIsStatic = bfd.obtainVia.isStatic(); for (int i = 0; i < tgt.length; i++) { MessageSend obtainExpr = new MessageSend(); - obtainExpr.receiver = obtainIsStatic ? new SingleNameReference(type.getName().toCharArray(), 0) : new ThisReference(0, 0); + if (obtainIsStatic) { + if (typeParams != null && typeParams.length > 0) { + obtainExpr.typeArguments = new TypeReference[typeParams.length]; + for (int j = 0; j<typeParams.length; j++) { + obtainExpr.typeArguments[j] = new SingleTypeReference(typeParams[j].name, 0); + } + } + obtainExpr.receiver = new SingleNameReference(type.getName().toCharArray(), 0); + } else { + obtainExpr.receiver = new ThisReference(0, 0); + } obtainExpr.selector = obtainName.toCharArray(); if (obtainIsStatic) obtainExpr.arguments = new Expression[] {new ThisReference(0, 0)}; tgt[i] = obtainExpr; diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index c5c1e1ca..0f6e21d0 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -508,7 +508,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { if (bfd.obtainVia.isStatic()) { for (int i = 0; i < tgt.length; i++) { JCExpression c = maker.Select(maker.Ident(type.toName(type.getName())), type.toName(bfd.obtainVia.method())); - tgt[i] = maker.Apply(List.<JCExpression>nil(), c, List.<JCExpression>of(maker.Ident(type.toName("this")))); + tgt[i] = maker.Apply(typeParameterNames(maker, typeParams), c, List.<JCExpression>of(maker.Ident(type.toName("this")))); } } else { for (int i = 0; i < tgt.length; i++) { 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); } |