}
for (MemberValuePair pair : a.memberValuePairs()) {
if (!String.valueOf(pair.name).equals("value")) {
continue;
}
Expression valueExpr = pair.value;
if (valueExpr instanceof StringLiteral) {
// @SuppressWarnings("Foo")
return ImmutableSet.of(((StringLiteral) valueExpr).constant.stringValue().toLowerCase(
Locale.ENGLISH));
} else if (valueExpr instanceof ArrayInitializer) {
// @SuppressWarnings({ "Foo", "Bar"})
ArrayInitializer ai = (ArrayInitializer) valueExpr;
ImmutableSet.Builder valuesSetBuilder = ImmutableSet.builder();
for (int i = 0, j = ai.expressions.length; i < j; i++) {
if ((ai.expressions[i]) instanceof StringLiteral) {
StringLiteral expression = (StringLiteral) ai.expressions[i];
valuesSetBuilder.add(expression.constant.stringValue().toLowerCase(Locale.ENGLISH));
} else {
suppressionAnnotationWarning(a,
"Unable to analyze SuppressWarnings annotation, " +
ai.expressions[i].toString() + " not a string constant.");
}
}
return valuesSetBuilder.build();
} else {
suppressionAnnotationWarning(a, "Unable to analyze SuppressWarnings annotation, " +
valueExpr.toString() + " not a string constant.");
}
}
}
return ImmutableSet.of();
}