public static boolean addDependency(@NotNull PsiElement from,
                                      @NotNull PsiClass to,
                                      @Nullable DependencyScope scope) {
    if (!PsiUtil.isAvailable(JavaFeature.MODULES, from)) return false;
    PsiJavaModule fromDescriptor = findDescriptorByElement(from);
    if (fromDescriptor == null) return false;
    PsiJavaModule toDescriptor = findDescriptorByElement(to);
    if (toDescriptor == null) return false;
    if(!ContainerUtil.and(JavaModuleSystem.EP_NAME.getExtensionList(), sys -> sys.isAccessible(to, from))) return false;
    return addDependency(fromDescriptor, toDescriptor, scope);
  }
public static boolean addDependency(@NotNull PsiElement from,
                                      @NotNull PsiClass to,
                                      @Nullable DependencyScope scope)