diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-12 00:35:17 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-12 00:35:17 +0200 |
commit | 5fef32c1f59403ef2978942ac2838731b1406413 (patch) | |
tree | e906845aebe6bcccd65ed33ba314bf0ba3ce782f /src/lombok/javac/handlers | |
parent | 12d44e59c57e4654a7c61f83baf606a39fbb8448 (diff) | |
download | lombok-5fef32c1f59403ef2978942ac2838731b1406413.tar.gz lombok-5fef32c1f59403ef2978942ac2838731b1406413.tar.bz2 lombok-5fef32c1f59403ef2978942ac2838731b1406413.zip |
More fixes to avoid erroneous "getter/setter is already there, not generating it" warnings
when the getter/setter already there was in fact generated by lombok, and fixed a bug
in eclipse where a boolean array's getter method would be called isFoo() instead of getFoo().
Diffstat (limited to 'src/lombok/javac/handlers')
-rw-r--r-- | src/lombok/javac/handlers/HandleGetter.java | 13 | ||||
-rw-r--r-- | src/lombok/javac/handlers/HandleSetter.java | 13 |
2 files changed, 6 insertions, 20 deletions
diff --git a/src/lombok/javac/handlers/HandleGetter.java b/src/lombok/javac/handlers/HandleGetter.java index ed0370ac..c993afcd 100644 --- a/src/lombok/javac/handlers/HandleGetter.java +++ b/src/lombok/javac/handlers/HandleGetter.java @@ -63,23 +63,16 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> { * be a warning if its already there. The default access level is used. */ public void generateGetterForField(Node fieldNode, DiagnosticPosition pos) { - AccessLevel level = AccessLevel.PUBLIC; - Node errorNode = fieldNode; - boolean whineIfExists = false; - for ( Node child : fieldNode.down() ) { if ( child.getKind() == Kind.ANNOTATION ) { if ( Javac.annotationTypeMatches(Getter.class, child) ) { - level = Javac.createAnnotation(Getter.class, child).getInstance().value(); - errorNode = child; - pos = child.get(); - whineIfExists = true; - break; + //The annotation will make it happen, so we can skip it. + return; } } } - createGetterForField(level, fieldNode, errorNode, pos, whineIfExists); + createGetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, pos, false); } @Override public boolean handle(AnnotationValues<Getter> annotation, JCAnnotation ast, Node annotationNode) { diff --git a/src/lombok/javac/handlers/HandleSetter.java b/src/lombok/javac/handlers/HandleSetter.java index b1c37bb1..d11b4250 100644 --- a/src/lombok/javac/handlers/HandleSetter.java +++ b/src/lombok/javac/handlers/HandleSetter.java @@ -66,23 +66,16 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> { * be a warning if its already there. The default access level is used. */ public void generateSetterForField(Node fieldNode, DiagnosticPosition pos) { - AccessLevel level = AccessLevel.PUBLIC; - Node errorNode = fieldNode; - boolean whineIfExists = false; - for ( Node child : fieldNode.down() ) { if ( child.getKind() == Kind.ANNOTATION ) { if ( Javac.annotationTypeMatches(Setter.class, child) ) { - level = Javac.createAnnotation(Setter.class, child).getInstance().value(); - errorNode = child; - pos = child.get(); - whineIfExists = true; - break; + //The annotation will make it happen, so we can skip it. + return; } } } - createSetterForField(level, fieldNode, errorNode, pos, whineIfExists); + createSetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, pos, false); } @Override public boolean handle(AnnotationValues<Setter> annotation, JCAnnotation ast, Node annotationNode) { |