+ "' is not (compiler limitation)");
}
bindingPattern = true;
// Check that the formal is bound to a type that is represented by one field in the annotation type
ReferenceType theAnnotationType = (ReferenceType) annotationType;
ResolvedMember[] annotationFields = theAnnotationType.getDeclaredMethods();
field = null;
boolean looksAmbiguous = false;
for (int i = 0; i < annotationFields.length; i++) {
ResolvedMember resolvedMember = annotationFields[i];
if (resolvedMember.getReturnType().equals(formalBinding.getType())) {
if (field != null) {
boolean haveProblem = true;
// use the name to differentiate
if (field.getName().equals(formalName)) {
// don't use this new field
haveProblem = false;
} else if (resolvedMember.getName().equals(formalName)) {
// ok, let's use this one
field = resolvedMember;
haveProblem = false;
}
if (haveProblem) {
looksAmbiguous = true;
}
} else {
field = resolvedMember;
}
}
}
if (looksAmbiguous) {
// did we find something that does match by name?
if (field == null || !field.getName().equals(formalName)) {
scope.message(IMessage.ERROR, this, "The field type '" + formalBinding.getType()
+ "' is ambiguous for annotation type '" + theAnnotationType.getName() + "'");
}
}
if (field == null) {
scope.message(IMessage.ERROR, this, "No field of type '" + formalBinding.getType() + "' exists on annotation type '"
+ theAnnotationType.getName() + "'");
}
BindingAnnotationFieldTypePattern binding = new BindingAnnotationFieldTypePattern(formalBinding.getType(),
formalBinding.getIndex(), theAnnotationType);
binding.copyLocationFrom(this);