diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-27 03:57:51 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-27 03:57:51 +0200 |
commit | b9714eae8ced8d22a319a471331be3a522ebccce (patch) | |
tree | f264de805340bfaec5f97b169aa930a0de6b6e93 | |
parent | c4611d669db5ef38ba59540dc850cb59a5168348 (diff) | |
download | lombok-b9714eae8ced8d22a319a471331be3a522ebccce.tar.gz lombok-b9714eae8ced8d22a319a471331be3a522ebccce.tar.bz2 lombok-b9714eae8ced8d22a319a471331be3a522ebccce.zip |
[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.
-rw-r--r-- | src/lombok/eclipse/Eclipse.java | 11 |
1 files changed, 6 insertions, 5 deletions
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 <A extends java.lang.annotation.Annotation> AnnotationValues<A> createAnnotation(Class<A> type, final Node annotationNode) { - Annotation annotation = (Annotation) annotationNode.get(); + final Annotation annotation = (Annotation) annotationNode.get(); Map<String, AnnotationValue> values = new HashMap<String, AnnotationValue>(); 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; |