[SuperBuilder] don't warn on existing toBuilder method

This commit is contained in:
Jan Rieke
2020-05-28 21:18:35 +02:00
committed by Roel Spilker
parent 48b1f17f7e
commit b767427f06
2 changed files with 3 additions and 3 deletions
@@ -390,10 +390,10 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
// Add the toBuilder() method to the annotated class.
switch (methodExists(TO_BUILDER_METHOD_NAME_STRING, tdParent, 0)) {
case EXISTS_BY_USER:
annotationNode.addWarning("Not generating toBuilder() as it already exists.");
break;
case NOT_EXISTS:
injectMethod(tdParent, generateToBuilderMethod(cfv, builderClassName, builderImplClassName, tdParent, typeParams, ast));
break;
default:
// Should not happen.
}
@@ -377,14 +377,14 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
if (toBuilder) {
switch (methodExists(TO_BUILDER_METHOD_NAME, tdParent, 0)) {
case EXISTS_BY_USER:
annotationNode.addWarning("Not generating toBuilder() as it already exists.");
return;
break;
case NOT_EXISTS:
JCMethodDecl md = generateToBuilderMethod(cfv, builderClassName, builderImplClassName, annotationNode, tdParent, typeParams);
if (md != null) {
recursiveSetGeneratedBy(md, ast, annotationNode.getContext());
injectMethod(tdParent, md);
}
break;
default:
// Should not happen.
}