} catch (ClassNotFoundException e) {
classNotAvailable = new AnnotationClassNotAvailableException(val, className);
} finally {
classNames.add(className);
}
} else throw new ResolutionException(val, "Expected class literal");
}
if (expectedType.isAnnotation()) {
if (val instanceof Annotation) {
returnValues.add(this.resolver.toAnnotationInstance(expectedType.asSubclass(java.lang.annotation.Annotation.class), (Annotation)val));
continue;
} else {
throw new ResolutionException(val, "Expected an annotation of type " + expectedType);
}
}
throw new ResolutionException(val, "Not a valid annotation type: " + expectedType);
}
}
if (classNotAvailable != null) {
classNotAvailable.setClassNames(classNames);
throw classNotAvailable;
}
if (array) {
Object arr = Array.newInstance(expectedType, returnValues.size());
for (int i = 0; i < returnValues.size(); i++) Array.set(arr, i, returnValues.get(i));
return arr;
}
switch (returnValues.size()) {
case 0:
Object def = method.getDefaultValue();
if (def != null) return def;
throw new ResolutionException(node, "Missing annotation method: " + method.getName());
case 1:
return returnValues.get(0);
default:
throw new ResolutionException(node, "Multiple values for a single-value annotation method: " + method.getName());
}
}