From d7ee0bc8a5a36e5968741e0e0a445a165b32f1e5 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 20 Jul 2010 11:58:56 +0200 Subject: @Getter int x, y; used to only apply to 'x', now it applies to both x and y. Fixes issue #54 --- src/core/lombok/javac/handlers/HandleGetter.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/core/lombok/javac/handlers/HandleGetter.java') diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index 9c0ce32f..582aa02b 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -22,6 +22,9 @@ package lombok.javac.handlers; import static lombok.javac.handlers.JavacHandlerUtil.*; + +import java.util.Collection; + import lombok.AccessLevel; import lombok.Getter; import lombok.core.AnnotationValues; @@ -94,6 +97,7 @@ public class HandleGetter implements JavacAnnotationHandler { } @Override public boolean handle(AnnotationValues annotation, JCAnnotation ast, JavacNode annotationNode) { + Collection fields = annotationNode.upFromAnnotationToFields(); markAnnotationAsProcessed(annotationNode, Getter.class); deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel"); JavacNode node = annotationNode.up(); @@ -102,7 +106,7 @@ public class HandleGetter implements JavacAnnotationHandler { if (node == null) return false; if (node.getKind() == Kind.FIELD) { - return createGetterForField(level, node, annotationNode, true); + return createGetterForFields(level, fields, annotationNode, true); } if (node.getKind() == Kind.TYPE) { JCClassDecl typeDecl = null; @@ -124,6 +128,14 @@ public class HandleGetter implements JavacAnnotationHandler { return false; } + private boolean createGetterForFields(AccessLevel level, Collection fieldNodes, JavacNode errorNode, boolean whineIfExists) { + for (JavacNode fieldNode : fieldNodes) { + createGetterForField(level, fieldNode, errorNode, whineIfExists); + } + + return true; + } + private boolean createGetterForField(AccessLevel level, JavacNode fieldNode, JavacNode errorNode, boolean whineIfExists) { if (fieldNode.getKind() != Kind.FIELD) { -- cgit