diff options
author | Jan Rieke <rieke@subshell.com> | 2020-12-30 14:15:08 +0100 |
---|---|---|
committer | Jan Rieke <rieke@subshell.com> | 2020-12-30 14:51:28 +0100 |
commit | 714be613cb29bb682d99d75abb97efc944042c50 (patch) | |
tree | 6e89b9ddcd7690adeae97eaeb4ecb281c7105e15 /src/core/lombok/javac | |
parent | 67d66be9eccf050a5f3758273ea2d685217f6d5a (diff) | |
download | lombok-714be613cb29bb682d99d75abb97efc944042c50.tar.gz lombok-714be613cb29bb682d99d75abb97efc944042c50.tar.bz2 lombok-714be613cb29bb682d99d75abb97efc944042c50.zip |
[fixes #2647] consider lombok.builder.className for builder extends
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleBuilder.java | 8 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleSuperBuilder.java | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index 867d6889..4ace3b68 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -148,8 +148,12 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { } String replaceBuilderClassName(Name name) { - if (builderClassName.indexOf('*') == -1) return builderClassName; - return builderClassName.replace("*", name.toString()); + return replaceBuilderClassName(name.toString(), builderClassName); + } + + String replaceBuilderClassName(String name, String template) { + if (template.indexOf('*') == -1) return template; + return template.replace("*", name); } JCExpression createBuilderParentTypeReference() { diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java index 99f0ea6a..567e7816 100644 --- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java +++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java @@ -257,10 +257,12 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> { } if (extendsClause instanceof JCFieldAccess) { Name superclassName = ((JCFieldAccess) extendsClause).getIdentifier(); - String superclassBuilderClassName = superclassName.toString() + "Builder"; + String builderClassNameTemplate = BuilderJob.fixBuilderClassName(annotationNode, ""); + String superclassBuilderClassName = job.replaceBuilderClassName(superclassName.toString(), builderClassNameTemplate); superclassBuilderClass = parent.getTreeMaker().Select((JCFieldAccess) extendsClause, parent.toName(superclassBuilderClassName)); } else if (extendsClause != null) { - String superclassBuilderClassName = extendsClause.toString() + "Builder"; + String builderClassNameTemplate = BuilderJob.fixBuilderClassName(annotationNode, ""); + String superclassBuilderClassName = job.replaceBuilderClassName(extendsClause.toString(), builderClassNameTemplate); superclassBuilderClass = chainDots(parent, extendsClause.toString(), superclassBuilderClassName); } |