mirror of
https://github.com/tiennm99/lombok.git
synced 2026-09-10 04:19:56 +00:00
[SuperBuilder] don't warn on existing toBuilder method
This commit is contained in:
@@ -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.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user