use of com.google.errorprone.matchers.Matcher in project error-prone by google.
the class RestrictedApiChecker method anyAnnotation.
private static Matcher<Tree> anyAnnotation(List<? extends TypeMirror> mirrors, VisitorState state) {
JavacProcessingEnvironment javacEnv = JavacProcessingEnvironment.instance(state.context);
ArrayList<Matcher<Tree>> matchers = new ArrayList<>(mirrors.size());
for (TypeMirror mirror : mirrors) {
TypeElement typeElem = (TypeElement) javacEnv.getTypeUtils().asElement(mirror);
String name = mirror.toString();
if (typeElem != null) {
// Get the binary name if possible ($ to separate nested members). See b/36160747
name = javacEnv.getElementUtils().getBinaryName(typeElem).toString();
}
matchers.add(Matchers.hasAnnotation(name));
}
return Matchers.anyOf(matchers);
}
Aggregations