in TransformCore/src/main/java/com/facebook/ads/injkit/threadcheck/ThreadCheckInjector.java [197:231]
private Checking computeClassChecking(ClassNode node, Model model)
throws AnnotationProcessingException {
Set<String> ui = annotationClosure(config.getUiThreadAnnotationClass(), node, model);
Set<String> work = annotationClosure(config.getWorkerThreadAnnotationClass(), node, model);
Set<String> any = annotationClosure(config.getAnyThreadAnnotationClass(), node, model);
if ((ui.isEmpty() ? 0 : 1) + (work.isEmpty() ? 0 : 1) + (any.isEmpty() ? 0 : 1) > 1) {
throw new AnnotationProcessingException(
String.format(
Locale.US,
"Inconsistent annotations in class hierarchy: [%s] have UI annotation "
+ "(%s), [%s] have worker annotation (%s) and [%s] have any "
+ "annotation (%s)",
String.join(",", ui),
config.getUiThreadAnnotationClass(),
String.join(",", work),
config.getWorkerThreadAnnotationClass(),
String.join(",", any),
config.getAnyThreadAnnotationClass()));
}
if (!ui.isEmpty()) {
return Checking.IS_UI;
}
if (!work.isEmpty()) {
return Checking.IS_WORKER;
}
if (!any.isEmpty()) {
return Checking.IS_ANY;
}
return Checking.NOT_DEFINED;
}