[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.
This commit is contained in:
Reinier Zwitserloot committed 2009-06-27 03:57:51 +02:00
1 parent c4611d669d
commit b9714eae8c
1 file changed
+6 -5
+6 -5
View File
@@ -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;