From b9714eae8ced8d22a319a471331be3a522ebccce Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 27 Jun 2009 03:57:51 +0200 Subject: [BUGFIX] Pretty major bug - due to a typo, ALL values for annotation methods were set to the value of the last annotation method. e.g in: @Foo(bar=10), ALL methods in the Foo annotation were presumed to be listed, and set to 10. This was obviously causing problems. Fixed it. --- src/lombok/eclipse/Eclipse.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lombok/eclipse/Eclipse.java b/src/lombok/eclipse/Eclipse.java index 67622e47..549de3c0 100644 --- a/src/lombok/eclipse/Eclipse.java +++ b/src/lombok/eclipse/Eclipse.java @@ -199,7 +199,7 @@ public class Eclipse { public static AnnotationValues createAnnotation(Class type, final Node annotationNode) { - Annotation annotation = (Annotation) annotationNode.get(); + final Annotation annotation = (Annotation) annotationNode.get(); Map values = new HashMap(); final MemberValuePair[] pairs = annotation.memberValuePairs(); @@ -213,9 +213,8 @@ public class Eclipse { if ( pairs != null ) for ( MemberValuePair pair : pairs ) { char[] n = pair.name; - String mName = n == null ? "value" : new String(name); - if ( !mName.equals(name) ) continue; - fullExpression = pair.value; + String mName = n == null ? "value" : new String(pair.name); + if ( mName.equals(name) ) fullExpression = pair.value; } if ( fullExpression != null ) { @@ -237,7 +236,9 @@ public class Eclipse { @Override public void setError(String message, int valueIdx) { Expression ex; if ( valueIdx == -1 ) ex = fullExpr; - else ex = exprs[valueIdx]; + else ex = exprs != null ? exprs[valueIdx] : null; + + if ( ex == null ) ex = annotation; int sourceStart = ex.sourceStart; int sourceEnd = ex.sourceEnd; -- cgit