private Checking computeMethodChecking()

in TransformCore/src/main/java/com/facebook/ads/injkit/threadcheck/ThreadCheckInjector.java [247:285]


  private Checking computeMethodChecking(ClassNode node, MethodNode method, Model model)
      throws AnnotationProcessingException {
    Set<String> ui = methodClosure(config.getUiThreadAnnotationClass(), node, method, model);
    Set<String> work = methodClosure(config.getWorkerThreadAnnotationClass(), node, method, model);
    Set<String> any = methodClosure(config.getAnyThreadAnnotationClass(), node, method, 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 when analyzing method "
                  + " %s%s (access %d): [%s] have UI annotation "
                  + "(%s), [%s] have worker annotation (%s) and [%s] have any "
                  + "annotation (%s)",
              method.name,
              method.desc,
              method.access,
              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;
  }