From 460c70890cea12e0224d8b978b36bfc89b3b0e1e Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Mon, 16 Apr 2018 20:21:02 +0200 Subject: let @SuperBuilder's toString() call super.toString() --- src/core/lombok/javac/handlers/HandleSuperBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java index 31976447..bd0f3b70 100644 --- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java +++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java @@ -181,7 +181,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler { String superclassBuilderClassName = extendsClause.toString() + "Builder"; superclassBuilderClassExpression = chainDots(tdParent, extendsClause.toString(), superclassBuilderClassName); } - // If there is no superclass, superclassBuilderClassName is still == null at this point. + // If there is no superclass, superclassBuilderClassExpression is still == null at this point. // You can use it to check whether to inherit or not. returnType = namePlusTypeParamsToTypeReference(tdParent.getTreeMaker(), td.name, td.typarams); @@ -257,8 +257,8 @@ public class HandleSuperBuilder extends JavacAnnotationHandler { for (BuilderFieldData bfd : builderFields) { fieldNodes.addAll(bfd.createdFields); } - // TODO: toString() should also call super.toString(), so that it also shows fields from the superclass. - JCMethodDecl md = HandleToString.createToString(builderType, fieldNodes, true, false, FieldAccess.ALWAYS_FIELD, ast); + // Let toString() call super.toString() if there is a superclass, so that it also shows fields from the superclass' builder. + JCMethodDecl md = HandleToString.createToString(builderType, fieldNodes, true, superclassBuilderClassExpression != null, FieldAccess.ALWAYS_FIELD, ast); if (md != null) injectMethod(builderType, md); } -- cgit