From 4da08ce3ccdd94f48856bd77b3dff50a77c150b1 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 18 Oct 2009 17:37:03 +0200 Subject: Removed some warnings. --- src/lombok/core/AST.java | 10 +++++++++- src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java | 4 +++- src/lombok/javac/handlers/HandleEqualsAndHashCode.java | 4 +++- src/lombok/javac/handlers/HandleGetter.java | 9 ++++++--- src/lombok/javac/handlers/HandleSetter.java | 9 ++++++--- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/lombok/core/AST.java b/src/lombok/core/AST.java index b1b5f3be..6d786d1e 100644 --- a/src/lombok/core/AST.java +++ b/src/lombok/core/AST.java @@ -286,7 +286,15 @@ public abstract class AST, L extends LombokNode, return false; } - /** Override if your AST collection does not support the set method. Javac's for example, does not. */ + /** + * Override if your AST collection does not support the set method. Javac's for example, does not. + * + * @param field The field that contains the array or list of AST nodes. + * @param fieldRef The object that you can supply to the field's {@code get} method. + * @param chain If the collection is immutable, you need to update the pointer to the collection in each element in the chain. + * + * @throws IllegalAccessException This exception won't happen, but we allow you to throw it so you can avoid having to catch it. + */ @SuppressWarnings("unchecked") protected void setElementInASTCollection(Field field, Object fieldRef, List> chain, Collection collection, int idx, N newN) throws IllegalAccessException { if (collection instanceof List) { diff --git a/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java index c5945e6c..c53938d1 100644 --- a/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java +++ b/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java @@ -160,7 +160,9 @@ public class HandleEqualsAndHashCode implements EclipseAnnotationHandler { * same rules apply (e.g. warning if the method already exists, stated access level applies). * If not, the getter is still generated if it isn't already there, though there will not * be a warning if its already there. The default access level is used. + * + * @param fieldNode The node representing the field you want a getter for. + * @param pos The node responsible for generating the getter (the {@code @Data} or {@code @Getter} annotation). */ public void generateGetterForField(JavacNode fieldNode, DiagnosticPosition pos) { for (JavacNode child : fieldNode.down()) { @@ -73,7 +76,7 @@ public class HandleGetter implements JavacAnnotationHandler { } } - createGetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, pos, false); + createGetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, false); } @Override public boolean handle(AnnotationValues annotation, JCAnnotation ast, JavacNode annotationNode) { @@ -81,11 +84,11 @@ public class HandleGetter implements JavacAnnotationHandler { AccessLevel level = annotation.getInstance().value(); if (level == AccessLevel.NONE) return true; - return createGetterForField(level, fieldNode, annotationNode, annotationNode.get(), true); + return createGetterForField(level, fieldNode, annotationNode, true); } private boolean createGetterForField(AccessLevel level, - JavacNode fieldNode, JavacNode errorNode, DiagnosticPosition pos, boolean whineIfExists) { + JavacNode fieldNode, JavacNode errorNode, boolean whineIfExists) { if (fieldNode.getKind() != Kind.FIELD) { errorNode.addError("@Getter is only supported on a field."); return true; diff --git a/src/lombok/javac/handlers/HandleSetter.java b/src/lombok/javac/handlers/HandleSetter.java index 08387895..33bc34a9 100644 --- a/src/lombok/javac/handlers/HandleSetter.java +++ b/src/lombok/javac/handlers/HandleSetter.java @@ -64,6 +64,9 @@ public class HandleSetter implements JavacAnnotationHandler { * same rules apply (e.g. warning if the method already exists, stated access level applies). * If not, the setter is still generated if it isn't already there, though there will not * be a warning if its already there. The default access level is used. + * + * @param fieldNode The node representing the field you want a setter for. + * @param pos The node responsible for generating the setter (the {@code @Data} or {@code @Setter} annotation). */ public void generateSetterForField(JavacNode fieldNode, DiagnosticPosition pos) { for (JavacNode child : fieldNode.down()) { @@ -75,7 +78,7 @@ public class HandleSetter implements JavacAnnotationHandler { } } - createSetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, pos, false); + createSetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, false); } @Override public boolean handle(AnnotationValues annotation, JCAnnotation ast, JavacNode annotationNode) { @@ -83,11 +86,11 @@ public class HandleSetter implements JavacAnnotationHandler { AccessLevel level = annotation.getInstance().value(); if (level == AccessLevel.NONE) return true; - return createSetterForField(level, fieldNode, annotationNode, annotationNode.get(), true); + return createSetterForField(level, fieldNode, annotationNode, true); } private boolean createSetterForField(AccessLevel level, - JavacNode fieldNode, JavacNode errorNode, DiagnosticPosition pos, boolean whineIfExists) { + JavacNode fieldNode, JavacNode errorNode, boolean whineIfExists) { if (fieldNode.getKind() != Kind.FIELD) { fieldNode.addError("@Setter is only supported on a field."); return true; -- cgit