use of org.checkerframework.common.util.report.qual.ReportUse in project checker-framework by typetools.
the class ReportVisitor method checkReportUse.
/**
* Check for uses of the {@link ReportUse} annotation. This method has to be called for every
* explicit or implicit use of a type, most cases are simply covered by the type validator.
*
* @param node the tree for error reporting only
* @param member the element from which to start looking
*/
private void checkReportUse(Tree node, Element member) {
Element loop = member;
while (loop != null) {
boolean report = this.atypeFactory.getDeclAnnotation(loop, ReportUse.class) != null;
if (report) {
checker.report(Result.failure("usage", node, ElementUtils.getVerboseName(loop), loop.getKind(), ElementUtils.getVerboseName(member), member.getKind()), node);
break;
} else {
if (loop.getKind() == ElementKind.PACKAGE) {
loop = ElementUtils.parentPackage((PackageElement) loop, elements);
continue;
}
}
// Package will always be the last iteration.
loop = loop.getEnclosingElement();
}
}
Aggregations