@Contract("null -> false")
  public static boolean checkProviderMethodAccessible(@Nullable PsiClass targetClass) {
    if (targetClass == null || targetClass.getName() == null) return false;
    JvmMethod[] methods = targetClass.findMethodsByName(PsiJavaModule.PROVIDER_METHOD);
    for (JvmMethod method : methods) {
      if (!method.hasParameters()) return false;
    }
    PsiJavaModule descriptor = JavaModuleGraphUtil.findDescriptorByElement(targetClass.getContainingFile().getOriginalFile());
    if (descriptor == null || descriptor instanceof LightJavaModule) return false;

    Iterable<PsiProvidesStatement> providers = descriptor.getProvides();
    for (PsiProvidesStatement provider : providers) {
      PsiReferenceList implementations = provider.getImplementationList();
      if (implementations == null) continue;
      for (PsiClassType type : implementations.getReferencedTypes()) {
        if (targetClass.isEquivalentTo(type.resolve())) {
          return true;
        }
      }
    }
    return false;
  }
@Contract("null -> false")
  public static boolean checkProviderMethodAccessible(@Nullable PsiClass targetClass)