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:
Reinier Zwitserloot committed 2009-07-11 11:12:47 +02:00
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,
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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