diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2023-03-12 09:05:24 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2023-03-22 12:33:59 +0100 |
commit | 8c0081a806a3c772f29be5c038024a5a941c4be6 (patch) | |
tree | b9120f8f99941e0eeecdcc8563241074747a65e8 | |
parent | 3b968fe57c3f816a27e5d57f1bf6060d6e4c4b4e (diff) | |
download | lombok-8c0081a806a3c772f29be5c038024a5a941c4be6.tar.gz lombok-8c0081a806a3c772f29be5c038024a5a941c4be6.tar.bz2 lombok-8c0081a806a3c772f29be5c038024a5a941c4be6.zip |
[fixes #3364] Generate JCTree clones to prevent duplicate nodes
12 files changed, 125 insertions, 83 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index ed7d2844..34b4f004 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -796,10 +796,11 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { List<JCAnnotation> annsOnMethod = job.checkerFramework.generateSideEffectFree() ? List.of(maker.Annotation(genTypeRef(job.builderType, CheckerFrameworkVersion.NAME__SIDE_EFFECT_FREE), List.<JCExpression>nil())) : List.<JCAnnotation>nil(); JCVariableDecl recv = generateReceiver(job); JCMethodDecl methodDef; + JCExpression returnTypeCopy = cloneType(maker, returnType, job.sourceNode); if (recv != null && maker.hasMethodDefWithRecvParam()) { - methodDef = maker.MethodDefWithRecvParam(maker.Modifiers(toJavacModifier(job.accessInners), annsOnMethod), job.toName(job.buildMethodName), returnType, List.<JCTypeParameter>nil(), recv, List.<JCVariableDecl>nil(), thrownExceptions, body, null); + methodDef = maker.MethodDefWithRecvParam(maker.Modifiers(toJavacModifier(job.accessInners), annsOnMethod), job.toName(job.buildMethodName), returnTypeCopy, List.<JCTypeParameter>nil(), recv, List.<JCVariableDecl>nil(), thrownExceptions, body, null); } else { - methodDef = maker.MethodDef(maker.Modifiers(toJavacModifier(job.accessInners), annsOnMethod), job.toName(job.buildMethodName), returnType, List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), thrownExceptions, body, null); + methodDef = maker.MethodDef(maker.Modifiers(toJavacModifier(job.accessInners), annsOnMethod), job.toName(job.buildMethodName), returnTypeCopy, List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), thrownExceptions, body, null); } if (staticName == null) createRelevantNonNullAnnotation(job.builderType, methodDef); return methodDef; diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index dc70e2ce..6a5dad1b 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -440,7 +440,7 @@ public class HandleConstructor { if (!type.typarams.isEmpty()) { for (JCTypeParameter param : type.typarams) { - typeParams.append(maker.TypeParameter(param.name, param.bounds)); + typeParams.append(maker.TypeParameter(param.name, cloneTypes(maker, param.bounds, source))); } } List<JCAnnotation> annsOnReturnType = List.nil(); diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java index dace3521..3b408145 100644 --- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -191,7 +191,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas injectMethod(typeNode, equalsMethod); if (needsCanEqual && canEqualExists == MemberExistsResult.NOT_EXISTS) { - JCMethodDecl canEqualMethod = createCanEqual(typeNode, source, onParam); + JCMethodDecl canEqualMethod = createCanEqual(typeNode, source, copyAnnotations(onParam)); injectMethod(typeNode, canEqualMethod); } @@ -240,10 +240,10 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas /* if (this.$hashCodeCache != 0) return this.$hashCodeCache; */ { if (cacheHashCode) { - JCIdent receiver = maker.Ident(typeNode.toName("this")); - JCFieldAccess cacheHashCodeFieldAccess = maker.Select(receiver, typeNode.toName(HASH_CODE_CACHE_NAME)); - JCExpression cacheNotZero = maker.Binary(CTC_NOT_EQUAL, cacheHashCodeFieldAccess, maker.Literal(CTC_INT, 0)); - statements.append(maker.If(cacheNotZero, maker.Return(cacheHashCodeFieldAccess), null)); + JCFieldAccess hashCodeCacheFieldAccess = createHashCodeCacheFieldAccess(typeNode, maker); + JCExpression cacheNotZero = maker.Binary(CTC_NOT_EQUAL, hashCodeCacheFieldAccess, maker.Literal(CTC_INT, 0)); + hashCodeCacheFieldAccess = createHashCodeCacheFieldAccess(typeNode, maker); + statements.append(maker.If(cacheNotZero, maker.Return(hashCodeCacheFieldAccess), null)); } } @@ -345,7 +345,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas statements.append(maker.If(maker.Binary(CTC_EQUAL, maker.Ident(resultName), maker.Literal(CTC_INT, 0)), maker.Exec(maker.Assign(maker.Ident(resultName), genJavaLangTypeRef(typeNode, "Integer", "MIN_VALUE"))), null)); - JCFieldAccess cacheHashCodeFieldAccess = maker.Select(maker.Ident(typeNode.toName("this")), typeNode.toName(HASH_CODE_CACHE_NAME)); + JCFieldAccess cacheHashCodeFieldAccess = createHashCodeCacheFieldAccess(typeNode, maker); statements.append(maker.Exec(maker.Assign(cacheHashCodeFieldAccess, maker.Ident(resultName)))); } } @@ -359,6 +359,12 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), List.<JCExpression>nil(), body, null), source); } + private JCFieldAccess createHashCodeCacheFieldAccess(JavacNode typeNode, JavacTreeMaker maker) { + JCIdent receiver = maker.Ident(typeNode.toName("this")); + JCFieldAccess cacheHashCodeFieldAccess = maker.Select(receiver, typeNode.toName(HASH_CODE_CACHE_NAME)); + return cacheHashCodeFieldAccess; + } + public JCExpressionStatement createResultCalculation(JavacNode typeNode, JCExpression expr) { /* result = result * PRIME + expr; */ JavacTreeMaker maker = typeNode.getTreeMaker(); diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index 86eb9fda..3f7fbd20 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -222,7 +222,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { JCVariableDecl fieldNode = (JCVariableDecl) field.get(); // Remember the type; lazy will change it - JCExpression methodType = cloneType(treeMaker, copyType(treeMaker, fieldNode), source); + JCExpression methodType = copyType(treeMaker, fieldNode, source); AnnotationValues<Accessors> accessors = JavacHandlerUtil.getAccessorsForField(field); // Generate the methodName; lazy will change the field type Name methodName = field.toName(toGetterName(field, accessors)); @@ -359,7 +359,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); JCVariableDecl field = (JCVariableDecl) fieldNode.get(); - JCExpression copyOfRawFieldType = copyType(maker, field); + JCExpression copyOfRawFieldType = copyType(maker, field, source); JCExpression copyOfBoxedFieldType = null; field.type = null; boolean isPrimitive = false; @@ -371,7 +371,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { copyOfBoxedFieldType = genJavaLangTypeRef(fieldNode, boxed); } } - if (copyOfBoxedFieldType == null) copyOfBoxedFieldType = copyType(maker, field); + if (copyOfBoxedFieldType == null) copyOfBoxedFieldType = copyType(maker, field, source); Name valueName = fieldNode.toName("value"); Name actualValueName = fieldNode.toName("actualValue"); @@ -446,7 +446,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { /* private final java.util.concurrent.atomic.AtomicReference<Object> fieldName = new java.util.concurrent.atomic.AtomicReference<Object>(); */ { field.vartype = recursiveSetGeneratedBy( maker.TypeApply(chainDotsString(fieldNode, AR), List.<JCExpression>of(genJavaLangTypeRef(fieldNode, "Object"))), source); - field.init = recursiveSetGeneratedBy(maker.NewClass(null, NIL_EXPRESSION, copyType(maker, field), NIL_EXPRESSION, null), source); + field.init = recursiveSetGeneratedBy(maker.NewClass(null, NIL_EXPRESSION, copyType(maker, field, source), NIL_EXPRESSION, null), source); } return statements.toList(); @@ -462,7 +462,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { return maker.Exec(maker.Apply(NIL_EXPRESSION, maker.Select(receiver, source.toName("set")), List.<JCExpression>of(value))); } - public JCExpression copyType(JavacTreeMaker treeMaker, JCVariableDecl fieldNode) { - return fieldNode.type != null ? treeMaker.Type(fieldNode.type) : fieldNode.vartype; + public JCExpression copyType(JavacTreeMaker treeMaker, JCVariableDecl fieldNode, JavacNode source) { + return fieldNode.type != null ? treeMaker.Type(fieldNode.type) : cloneType(treeMaker, fieldNode.vartype, source); } } diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java index 957f5581..f5eefaa1 100644 --- a/src/core/lombok/javac/handlers/HandleLog.java +++ b/src/core/lombok/javac/handlers/HandleLog.java @@ -43,6 +43,7 @@ import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCClassDecl; import com.sun.tools.javac.tree.JCTree.JCExpression; import com.sun.tools.javac.tree.JCTree.JCFieldAccess; +import com.sun.tools.javac.tree.JCTree.JCLiteral; import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.util.List; @@ -148,14 +149,18 @@ public class HandleLog { LogFactoryParameter parameter = parameters.get(i); switch (parameter) { case TYPE: - expressions[i] = loggingType; + expressions[i] = cloneType(maker, loggingType, typeNode); break; case NAME: JCExpression method = maker.Select(loggingType, typeNode.toName("getName")); expressions[i] = maker.Apply(List.<JCExpression>nil(), method, List.<JCExpression>nil()); break; case TOPIC: - expressions[i] = (JCExpression) loggerTopic.clone(); + if (loggerTopic instanceof JCLiteral) { + expressions[i] = maker.Literal(((JCLiteral) loggerTopic).value); + } else { + expressions[i] = cloneType(maker, loggerTopic, typeNode); + } break; case NULL: expressions[i] = maker.Literal(CTC_BOT, null); diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java index 913f838c..1ebbccc8 100644 --- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java +++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java @@ -260,7 +260,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> { Name superclassName = ((JCFieldAccess) extendsClause).getIdentifier(); String builderClassNameTemplate = BuilderJob.getBuilderClassNameTemplate(annotationNode, null); String superclassBuilderClassName = job.replaceBuilderClassName(superclassName.toString(), builderClassNameTemplate); - superclassBuilderClass = parent.getTreeMaker().Select((JCFieldAccess) extendsClause, parent.toName(superclassBuilderClassName)); + superclassBuilderClass = parent.getTreeMaker().Select(cloneType(maker, (JCFieldAccess) extendsClause, annotationNode), parent.toName(superclassBuilderClassName)); } else if (extendsClause != null) { String builderClassNameTemplate = BuilderJob.getBuilderClassNameTemplate(annotationNode, null); String superclassBuilderClassName = job.replaceBuilderClassName(extendsClause.toString(), builderClassNameTemplate); @@ -607,6 +607,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> { // Now add the <?, ?>. JCWildcard wildcard = maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); typeParameterNames.append(wildcard); + wildcard = maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); typeParameterNames.append(wildcard); // And return type annotations. List<JCAnnotation> annsOnParamType = List.nil(); @@ -644,6 +645,7 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> { // Now add the <?, ?>. JCWildcard wildcard = maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); typeParameterNames.append(wildcard); + wildcard = maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); typeParameterNames.append(wildcard); JCTypeApply returnType = maker.TypeApply(namePlusTypeParamsToTypeReference(maker, job.parentType, job.toName(job.builderAbstractClassName), false, List.<JCTypeParameter>nil()), typeParameterNames.toList()); diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index ac947581..9c6e0f84 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -1695,29 +1695,8 @@ public class JavacHandlerUtil { * Searches the given field node for annotations and returns each one that is 'copyable' (either via configuration or from the base list). */ public static List<JCAnnotation> findCopyableAnnotations(JavacNode node) { - JCAnnotation anno = null; - String annoName = null; - for (JavacNode child : node.down()) { - if (child.getKind() == Kind.ANNOTATION) { - if (anno != null) { - annoName = ""; - break; - } - JCAnnotation annotation = (JCAnnotation) child.get(); - annoName = annotation.annotationType.toString(); - anno = annotation; - } - } - - if (annoName == null) return List.nil(); - java.util.List<TypeName> configuredCopyable = node.getAst().readConfiguration(ConfigurationKeys.COPYABLE_ANNOTATIONS); - if (!annoName.isEmpty()) { - for (TypeName cn : configuredCopyable) if (cn != null && typeMatches(cn.toString(), node, annoName)) return List.of(anno); - for (String bn : BASE_COPYABLE_ANNOTATIONS) if (typeMatches(bn, node, annoName)) return List.of(anno); - } - ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>(); for (JavacNode child : node.down()) { if (child.getKind() == Kind.ANNOTATION) { @@ -1735,7 +1714,7 @@ public class JavacHandlerUtil { } } } - return result.toList(); + return copyAnnotations(result.toList()); } /** @@ -1756,26 +1735,6 @@ public class JavacHandlerUtil { * Searches the given field node for annotations that are in the given list, and returns those. */ private static List<JCAnnotation> findAnnotationsInList(JavacNode node, java.util.List<String> annotationsToFind) { - JCAnnotation anno = null; - String annoName = null; - for (JavacNode child : node.down()) { - if (child.getKind() == Kind.ANNOTATION) { - if (anno != null) { - annoName = ""; - break; - } - JCAnnotation annotation = (JCAnnotation) child.get(); - annoName = annotation.annotationType.toString(); - anno = annotation; - } - } - - if (annoName == null) return List.nil(); - - if (!annoName.isEmpty()) { - for (String bn : annotationsToFind) if (typeMatches(bn, node, annoName)) return List.of(anno); - } - ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>(); for (JavacNode child : node.down()) { if (child.getKind() == Kind.ANNOTATION) { @@ -1788,7 +1747,7 @@ public class JavacHandlerUtil { } } } - return result.toList(); + return copyAnnotations(result.toList()); } /** diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java index e4eb1a30..adfb1fce 100644 --- a/test/core/src/lombok/RunTestsViaDelombok.java +++ b/test/core/src/lombok/RunTestsViaDelombok.java @@ -29,9 +29,12 @@ import java.io.PrintStream; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.ArrayDeque; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Deque; +import java.util.IdentityHashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -56,6 +59,7 @@ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCModifiers; +import com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.tree.JCTree.TypeBoundKind; import com.sun.tools.javac.tree.TreeScanner; @@ -81,6 +85,7 @@ public class RunTestsViaDelombok extends AbstractRunTests { if (checkPositions) delombok.addAdditionalAnnotationProcessor(new ValidatePositionProcessor(version)); delombok.addAdditionalAnnotationProcessor(new ValidateTypesProcessor()); + delombok.addAdditionalAnnotationProcessor(new ValidateNoDuplicateTreeNodeProcessor()); delombok.addFile(file.getAbsoluteFile().getParentFile(), file.getName()); delombok.setSourcepath(file.getAbsoluteFile().getParent()); @@ -232,6 +237,68 @@ public class RunTestsViaDelombok extends AbstractRunTests { } } + public static class ValidateNoDuplicateTreeNodeProcessor extends TreeProcessor { + + private String craftFailMsg(Collection<JCTree> astContext) { + StringBuilder msg = new StringBuilder(); + for (JCTree t : astContext) { + msg.append("\n ").append(t.getClass().getSimpleName()); + String asStr = t.toString(); + if (asStr.length() < 80) msg.append(": ").append(asStr); + else if (t instanceof JCClassDecl) msg.append(": ").append(((JCClassDecl) t).name); + else if (t instanceof JCMethodDecl) msg.append(": ").append(((JCMethodDecl) t).name); + else if (t instanceof JCVariableDecl) msg.append(": ").append(((JCVariableDecl) t).name); + } + return msg.append("\n-------").toString(); + } + + @Override + void processCompilationUnit(JCCompilationUnit unit) { + final Deque<JCTree> parents = new ArrayDeque<JCTree>(); + parents.add(unit); + + final Map<JCTree, List<JCTree>> knownTreeNode = new IdentityHashMap<JCTree, List<JCTree>>(); + + unit.accept(new TreeScanner() { + private JCTree parent; + + @Override + public void scan(JCTree tree) { + parent = parents.peek(); + + if (tree == null) return; + if (tree instanceof JCPrimitiveTypeTree) return; + // javac generates duplicates for record members + if (tree instanceof JCVariableDecl && (((JCVariableDecl) tree).mods.flags & Javac.GENERATED_MEMBER) != 0) return; + + List<JCTree> knownNodeContext = knownTreeNode.put(tree, new ArrayList<JCTree>(parents)); + if (knownNodeContext != null) { + // javac generates two JCVariableDecl elements for 'int a, b;' + if (parent instanceof JCVariableDecl) { + if (tree instanceof JCModifiers) return; + if (tree instanceof JCIdent) return; + } + + fail("Node " + tree + " found twice:" + craftFailMsg(knownNodeContext) + craftFailMsg(parents)); + } + + parents.push(tree); + super.scan(tree); + parents.pop(); + } + + /** + * We always generate shallow copies for annotations + */ + @Override + public void visitAnnotation(JCAnnotation tree) { + return; + } + }); + } + + } + public static abstract class TreeProcessor extends AbstractProcessor { private Trees trees; @Override public synchronized void init(ProcessingEnvironment processingEnv) { diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/SuperBuilderCustomName.java index 900fbb03..cad2716c 100644 --- a/test/transform/resource/after-delombok/BuilderCustomName.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomName.java @@ -1,8 +1,8 @@ import java.util.List; -class BuilderCustomName<T> { +class SuperBuilderCustomName<T> { private final int field; @java.lang.SuppressWarnings("all") - public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends BuilderCustomName.SimpleTestBuilder<T, C, B>> { + public static abstract class SimpleTestBuilder<T, C extends SuperBuilderCustomName<T>, B extends SuperBuilderCustomName.SimpleTestBuilder<T, C, B>> { @java.lang.SuppressWarnings("all") private int field; /** @@ -20,31 +20,31 @@ class BuilderCustomName<T> { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderCustomName.SimpleTestBuilder(field=" + this.field + ")"; + return "SuperBuilderCustomName.SimpleTestBuilder(field=" + this.field + ")"; } } @java.lang.SuppressWarnings("all") - private static final class SimpleTestBuilderImpl<T> extends BuilderCustomName.SimpleTestBuilder<T, BuilderCustomName<T>, BuilderCustomName.SimpleTestBuilderImpl<T>> { + private static final class SimpleTestBuilderImpl<T> extends SuperBuilderCustomName.SimpleTestBuilder<T, SuperBuilderCustomName<T>, SuperBuilderCustomName.SimpleTestBuilderImpl<T>> { @java.lang.SuppressWarnings("all") private SimpleTestBuilderImpl() { } @java.lang.Override @java.lang.SuppressWarnings("all") - protected BuilderCustomName.SimpleTestBuilderImpl<T> self() { + protected SuperBuilderCustomName.SimpleTestBuilderImpl<T> self() { return this; } @java.lang.Override @java.lang.SuppressWarnings("all") - public BuilderCustomName<T> build() { - return new BuilderCustomName<T>(this); + public SuperBuilderCustomName<T> build() { + return new SuperBuilderCustomName<T>(this); } } @java.lang.SuppressWarnings("all") - protected BuilderCustomName(final BuilderCustomName.SimpleTestBuilder<T, ?, ?> b) { + protected SuperBuilderCustomName(final SuperBuilderCustomName.SimpleTestBuilder<T, ?, ?> b) { this.field = b.field; } @java.lang.SuppressWarnings("all") - public static <T> BuilderCustomName.SimpleTestBuilder<T, ?, ?> builder() { - return new BuilderCustomName.SimpleTestBuilderImpl<T>(); + public static <T> SuperBuilderCustomName.SimpleTestBuilder<T, ?, ?> builder() { + return new SuperBuilderCustomName.SimpleTestBuilderImpl<T>(); } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderCustomName.java b/test/transform/resource/after-ecj/SuperBuilderCustomName.java index cb578ccd..fc834090 100644 --- a/test/transform/resource/after-ecj/BuilderCustomName.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomName.java @@ -1,6 +1,6 @@ import java.util.List; -@lombok.experimental.SuperBuilder class BuilderCustomName<T> { - public static abstract @java.lang.SuppressWarnings("all") class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends BuilderCustomName.SimpleTestBuilder<T, C, B>> { +@lombok.experimental.SuperBuilder class SuperBuilderCustomName<T> { + public static abstract @java.lang.SuppressWarnings("all") class SimpleTestBuilder<T, C extends SuperBuilderCustomName<T>, B extends SuperBuilderCustomName.SimpleTestBuilder<T, C, B>> { private @java.lang.SuppressWarnings("all") int field; public SimpleTestBuilder() { super(); @@ -15,26 +15,26 @@ import java.util.List; protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("BuilderCustomName.SimpleTestBuilder(field=" + this.field) + ")"); + return (("SuperBuilderCustomName.SimpleTestBuilder(field=" + this.field) + ")"); } } - private static final @java.lang.SuppressWarnings("all") class SimpleTestBuilderImpl<T> extends BuilderCustomName.SimpleTestBuilder<T, BuilderCustomName<T>, BuilderCustomName.SimpleTestBuilderImpl<T>> { + private static final @java.lang.SuppressWarnings("all") class SimpleTestBuilderImpl<T> extends SuperBuilderCustomName.SimpleTestBuilder<T, SuperBuilderCustomName<T>, SuperBuilderCustomName.SimpleTestBuilderImpl<T>> { private SimpleTestBuilderImpl() { super(); } - protected @java.lang.Override @java.lang.SuppressWarnings("all") BuilderCustomName.SimpleTestBuilderImpl<T> self() { + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomName.SimpleTestBuilderImpl<T> self() { return this; } - public @java.lang.Override @java.lang.SuppressWarnings("all") BuilderCustomName<T> build() { - return new BuilderCustomName<T>(this); + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomName<T> build() { + return new SuperBuilderCustomName<T>(this); } } private final int field; - protected @java.lang.SuppressWarnings("all") BuilderCustomName(final BuilderCustomName.SimpleTestBuilder<T, ?, ?> b) { + protected @java.lang.SuppressWarnings("all") SuperBuilderCustomName(final SuperBuilderCustomName.SimpleTestBuilder<T, ?, ?> b) { super(); this.field = b.field; } - public static @java.lang.SuppressWarnings("all") <T>BuilderCustomName.SimpleTestBuilder<T, ?, ?> builder() { - return new BuilderCustomName.SimpleTestBuilderImpl<T>(); + public static @java.lang.SuppressWarnings("all") <T>SuperBuilderCustomName.SimpleTestBuilder<T, ?, ?> builder() { + return new SuperBuilderCustomName.SimpleTestBuilderImpl<T>(); } } diff --git a/test/transform/resource/before/BuilderCustomName.java b/test/transform/resource/before/SuperBuilderCustomName.java index d5709e63..7308e282 100644 --- a/test/transform/resource/before/BuilderCustomName.java +++ b/test/transform/resource/before/SuperBuilderCustomName.java @@ -2,6 +2,6 @@ import java.util.List; @lombok.experimental.SuperBuilder -class BuilderCustomName<T> { +class SuperBuilderCustomName<T> { private final int field; } diff --git a/test/transform/resource/messages-delombok/NonNullPlain.java.messages b/test/transform/resource/messages-delombok/NonNullPlain.java.messages index 7b0c540b..385efa23 100644 --- a/test/transform/resource/messages-delombok/NonNullPlain.java.messages +++ b/test/transform/resource/messages-delombok/NonNullPlain.java.messages @@ -1 +1,3 @@ -5 @NonNull is meaningless on a primitive.
\ No newline at end of file +8 @NonNull is meaningless on a primitive. +4 @NonNull is meaningless on a primitive. +6 @NonNull is meaningless on a primitive.
\ No newline at end of file |