mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 00:17:45 +00:00
The setter/getter handlers now mark themselves as not wanted to be called upon anymore when reporting errors.
They were logging 4 or more identical warnings per problem before this change.
This commit is contained in:
1 parent
bc44e76b7d
commit
f84f3a1bc8
4 files changed
+9
-9
No files matched your search
@@ -90,7 +90,7 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> {
|
||||
private boolean createGetterForField(AccessLevel level, Node fieldNode, Node errorNode, ASTNode pos, boolean whineIfExists) {
|
||||
if ( fieldNode.getKind() != Kind.FIELD ) {
|
||||
errorNode.addError("@Getter is only supported on a field.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
FieldDeclaration field = (FieldDeclaration) fieldNode.get();
|
||||
@@ -106,7 +106,7 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> {
|
||||
case EXISTS_BY_USER:
|
||||
if ( whineIfExists ) errorNode.addWarning(
|
||||
String.format("Not generating %s(): A method with that name already exists", getterName));
|
||||
return false;
|
||||
return true;
|
||||
default:
|
||||
case NOT_EXISTS:
|
||||
//continue with creating the getter
|
||||
|
||||
@@ -95,7 +95,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> {
|
||||
private boolean createSetterForField(AccessLevel level, Node fieldNode, Node errorNode, ASTNode pos, boolean whineIfExists) {
|
||||
if ( fieldNode.getKind() != Kind.FIELD ) {
|
||||
errorNode.addError("@Setter is only supported on a field.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
FieldDeclaration field = (FieldDeclaration) fieldNode.get();
|
||||
@@ -110,7 +110,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> {
|
||||
if ( whineIfExists ) errorNode.addWarning(
|
||||
String.format("Not generating %s(%s %s): A method with that name already exists",
|
||||
setterName, field.type, new String(field.name)));
|
||||
return false;
|
||||
return true;
|
||||
default:
|
||||
case NOT_EXISTS:
|
||||
//continue with creating the setter
|
||||
@@ -121,7 +121,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> {
|
||||
|
||||
injectMethod(fieldNode.up(), method);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private MethodDeclaration generateSetter(TypeDeclaration parent, FieldDeclaration field, String name,
|
||||
|
||||
@@ -91,7 +91,7 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
|
||||
private boolean createGetterForField(AccessLevel level, Node fieldNode, Node errorNode, DiagnosticPosition pos, boolean whineIfExists) {
|
||||
if ( fieldNode.getKind() != Kind.FIELD ) {
|
||||
errorNode.addError("@Getter is only supported on a field.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
JCVariableDecl fieldDecl = (JCVariableDecl)fieldNode.get();
|
||||
@@ -103,7 +103,7 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
|
||||
case EXISTS_BY_USER:
|
||||
if ( whineIfExists ) errorNode.addWarning(
|
||||
String.format("Not generating %s(): A method with that name already exists", methodName));
|
||||
return false;
|
||||
return true;
|
||||
default:
|
||||
case NOT_EXISTS:
|
||||
//continue with creating the getter
|
||||
|
||||
@@ -94,7 +94,7 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
|
||||
private boolean createSetterForField(AccessLevel level, Node fieldNode, Node errorNode, DiagnosticPosition pos, boolean whineIfExists) {
|
||||
if ( fieldNode.getKind() != Kind.FIELD ) {
|
||||
fieldNode.addError("@Setter is only supported on a field.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
JCVariableDecl fieldDecl = (JCVariableDecl)fieldNode.get();
|
||||
@@ -107,7 +107,7 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
|
||||
if ( whineIfExists ) errorNode.addWarning(
|
||||
String.format("Not generating %s(%s %s): A method with that name already exists",
|
||||
methodName, fieldDecl.vartype, fieldDecl.name));
|
||||
return false;
|
||||
return true;
|
||||
default:
|
||||
case NOT_EXISTS:
|
||||
//continue with creating the setter
|
||||
|
||||
Reference in new issue
Block a user