continue;
for( Class<? extends Annotation> m : sa.members ) {
Annotation offender = seed.readAnnotation(m);
if(offender!=null) {
// found it
builder.reportError(new IllegalAnnotationException(
Messages.ANNOTATION_NOT_ALLOWED.format(m.getSimpleName()),offender));
return;
}
}
}
// there must have been an offender
assert false;
}
// actually create annotations
switch(group) {
case TRANSIENT:
return;
case ANY_ATTRIBUTE:
// an attribute wildcard property
if(attributeWildcard!=null) {
builder.reportError(new IllegalAnnotationException(
Messages.TWO_ATTRIBUTE_WILDCARDS.format(
nav().getClassName(getClazz())),aa,attributeWildcard));
return; // recover by ignore
}
attributeWildcard = seed;
if(inheritsAttributeWildcard()) {
builder.reportError(new IllegalAnnotationException(
Messages.SUPER_CLASS_HAS_WILDCARD.format(),
aa,getInheritedAttributeWildcard()));
return;
}
// check the signature and make sure it's assignable to Map
if(!nav().isSubClassOf(seed.getRawType(),nav().ref(Map.class))) {
builder.reportError(new IllegalAnnotationException(
Messages.INVALID_ATTRIBUTE_WILDCARD_TYPE.format(nav().getTypeName(seed.getRawType())),
aa,getInheritedAttributeWildcard()));
return;
}
return;
case ATTRIBUTE:
properties.add(createAttributeProperty(seed));
return;
case VALUE:
properties.add(createValueProperty(seed));
return;
case ELEMENT:
properties.add(createElementProperty(seed));
return;
case ELEMENT_REF:
properties.add(createReferenceProperty(seed));
return;
case MAP:
properties.add(createMapProperty(seed));
return;
default:
assert false;
}
} catch( ConflictException x ) {
// report a conflicting annotation
List<Annotation> err = x.annotations;
builder.reportError(new IllegalAnnotationException(
Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format(
nav().getClassName(getClazz())+'#'+seed.getName(),
err.get(0).annotationType().getName(), err.get(1).annotationType().getName()),
err.get(0), err.get(1) ));
// recover by ignoring this property
} catch( DupliateException e ) {
// both are present
builder.reportError(new IllegalAnnotationException(
Messages.DUPLICATE_ANNOTATIONS.format(e.a1.annotationType().getName()),
e.a1, e.a2 ));
// recover by ignoring this property
}