From ca2b8c281b6efd1ebc99b212483c9751834f570b Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Tue, 21 Aug 2018 12:47:52 +0200 Subject: SuperBuilder now with generics on self() method --- src/core/lombok/javac/handlers/HandleSuperBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/lombok/javac') diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java index aaf94dd8..18e74908 100644 --- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java +++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java @@ -286,7 +286,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler { if (cd != null) injectMethod(builderImplType, cd); // Create the self() and build() methods in the BuilderImpl. - injectMethod(builderImplType, generateSelfMethod(builderImplType)); + injectMethod(builderImplType, generateSelfMethod(builderImplType, typeParams)); injectMethod(builderImplType, generateBuildMethod(buildMethodName, returnType, builderImplType, thrownExceptions)); recursiveSetGeneratedBy(builderImplType.get(), ast, annotationNode.getContext()); @@ -509,14 +509,14 @@ public class HandleSuperBuilder extends JavacAnnotationHandler { return maker.MethodDef(modifiers, name, returnType, List.nil(), List.nil(), List.nil(), null, null); } - private JCMethodDecl generateSelfMethod(JavacNode builderImplType) { + private JCMethodDecl generateSelfMethod(JavacNode builderImplType, List typeParams) { JavacTreeMaker maker = builderImplType.getTreeMaker(); JCAnnotation overrideAnnotation = maker.Annotation(genJavaLangTypeRef(builderImplType, "Override"), List.nil()); JCModifiers modifiers = maker.Modifiers(Flags.PROTECTED, List.of(overrideAnnotation)); Name name = builderImplType.toName(SELF_METHOD); - JCExpression returnType = maker.Ident(builderImplType.toName(builderImplType.getName())); + JCExpression returnType = namePlusTypeParamsToTypeReference(maker, builderImplType.toName(builderImplType.getName()), typeParams); JCStatement statement = maker.Return(maker.Ident(builderImplType.toName("this"))); JCBlock body = maker.Block(0, List.of(statement)); -- cgit