From f84f3a1bc8407160b82580300d2a58fd8c66aaa1 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 11 Jul 2009 11:12:47 +0200 Subject: 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. --- src/lombok/eclipse/handlers/HandleGetter.java | 4 ++-- src/lombok/eclipse/handlers/HandleSetter.java | 6 +++--- src/lombok/javac/handlers/HandleGetter.java | 4 ++-- src/lombok/javac/handlers/HandleSetter.java | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/lombok/eclipse/handlers/HandleGetter.java b/src/lombok/eclipse/handlers/HandleGetter.java index 78b399c5..b69a43f3 100644 --- a/src/lombok/eclipse/handlers/HandleGetter.java +++ b/src/lombok/eclipse/handlers/HandleGetter.java @@ -90,7 +90,7 @@ public class HandleGetter implements EclipseAnnotationHandler { 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 { 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 diff --git a/src/lombok/eclipse/handlers/HandleSetter.java b/src/lombok/eclipse/handlers/HandleSetter.java index 70eb855e..b08f298a 100644 --- a/src/lombok/eclipse/handlers/HandleSetter.java +++ b/src/lombok/eclipse/handlers/HandleSetter.java @@ -95,7 +95,7 @@ public class HandleSetter implements EclipseAnnotationHandler { 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 { 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 { injectMethod(fieldNode.up(), method); - return false; + return true; } private MethodDeclaration generateSetter(TypeDeclaration parent, FieldDeclaration field, String name, diff --git a/src/lombok/javac/handlers/HandleGetter.java b/src/lombok/javac/handlers/HandleGetter.java index 18e02a58..ed0370ac 100644 --- a/src/lombok/javac/handlers/HandleGetter.java +++ b/src/lombok/javac/handlers/HandleGetter.java @@ -91,7 +91,7 @@ public class HandleGetter implements JavacAnnotationHandler { 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 { 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 diff --git a/src/lombok/javac/handlers/HandleSetter.java b/src/lombok/javac/handlers/HandleSetter.java index 817d3011..b1c37bb1 100644 --- a/src/lombok/javac/handlers/HandleSetter.java +++ b/src/lombok/javac/handlers/HandleSetter.java @@ -94,7 +94,7 @@ public class HandleSetter implements JavacAnnotationHandler { 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 { 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 -- cgit