use of dyvilx.tools.compiler.ast.classes.metadata.IClassMetadata in project Dyvil by Dyvil.
the class CodeAnnotation method check.
@Override
public void check(MarkerList markers, IContext context, ElementType target) {
super.check(markers, context, target);
if (this.type == null || !this.type.isResolved()) {
return;
}
final IClass theClass = this.type.getTheClass();
if (theClass == null) {
return;
}
if (!theClass.isAnnotation()) {
markers.add(Markers.semanticError(this.position, "annotation.type", this.type.getName()));
return;
}
if (target == null) {
return;
}
final IClassMetadata metadata = theClass.getMetadata();
if (!metadata.isTarget(target)) {
final Marker error = Markers.semanticError(this.position, "annotation.target", this.type.getName());
error.addInfo(Markers.getSemantic("annotation.target.element", target));
error.addInfo(Markers.getSemantic("annotation.target.allowed", metadata.getTargets()));
markers.add(error);
}
}
Aggregations