in ti/phase2/jars/core/src/java/org/apache/ti/compiler/internal/AnnotationGrammar.java [77:145]
public final Object check(AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
MemberDeclaration classMember, int annotationArrayIndex)
throws FatalCompileTimeException {
if (!beginCheck(annotation, parentAnnotations, classMember)) {
return null;
}
Map valuesPresent = annotation.getElementValues();
HashSet wasPresent = new HashSet();
HashMap checkResults = new HashMap();
if (parentAnnotations == null) {
parentAnnotations = new AnnotationInstance[0];
}
int oldLen = parentAnnotations.length;
AnnotationInstance[] parentsIncludingMe = new AnnotationInstance[oldLen + 1];
System.arraycopy(parentAnnotations, 0, parentsIncludingMe, 0, oldLen);
parentsIncludingMe[oldLen] = annotation;
for (Iterator ii = valuesPresent.entrySet().iterator(); ii.hasNext();) {
Map.Entry i = (Map.Entry) ii.next();
AnnotationTypeElementDeclaration decl = (AnnotationTypeElementDeclaration) i.getKey();
AnnotationValue value = (AnnotationValue) i.getValue();
String memberName = decl.getSimpleName();
wasPresent.add(memberName);
onCheckMember(decl, value, annotation, parentAnnotations, classMember);
Object grammarOrType = null;
if ((grammarOrType = _memberGrammars.get(memberName)) != null) {
AnnotationGrammar childGrammar = (AnnotationGrammar) grammarOrType;
if (childGrammar != null) // it will be non-null unless there are other, more basic, errors
{
Object result = childGrammar.check((AnnotationInstance) value.getValue(), parentsIncludingMe, classMember);
if (result != null) {
checkResults.put(memberName, result);
}
}
} else if ((grammarOrType = _memberArrayGrammars.get(memberName)) != null) {
AnnotationGrammar arrayGrammar = (AnnotationGrammar) grammarOrType;
if (arrayGrammar != null) {
List annotations = CompilerUtils.getAnnotationArray(value);
for (int j = 0; j < annotations.size(); ++j) {
AnnotationInstance ann = (AnnotationInstance) annotations.get(j);
arrayGrammar.check(ann, parentsIncludingMe, classMember, j);
}
}
} else {
AnnotationMemberType memberType = (AnnotationMemberType) _memberTypes.get(memberName);
if (memberType != null) // it will be non-null unless there are other, more basic, errors
{
Object result = memberType.check(decl, value, parentsIncludingMe, classMember, annotationArrayIndex);
if (result != null) {
checkResults.put(memberName, result);
}
}
}
}
return endCheck(annotation, parentAnnotations, classMember, wasPresent, checkResults);
}