public static boolean addDependency(@NotNull PsiJavaModule from,
                                      @NotNull PsiJavaModule to,
                                      @Nullable DependencyScope scope) {
    if (to.getName().equals(JAVA_BASE)) return false;
    if (!PsiUtil.isAvailable(JavaFeature.MODULES, from)) return false;
    if (from instanceof LightJavaModule) return false;
    if (from == to) return false;
    if (!PsiNameHelper.isValidModuleName(to.getName(), to)) return false;
    if (contains(from.getRequires(), to.getName())) return false;
    if (reads(from, to)) return false;
    PsiUtil.addModuleStatement(from, PsiKeyword.REQUIRES + " " +
                                     (isStaticModule(to.getName(), scope) ? PsiKeyword.STATIC + " " : "") +
                                     (isExported(from, to) ? PsiKeyword.TRANSITIVE + " " : "") +
                                     to.getName());
    optimizeDependencies(from, to);
    return true;
  }
public static boolean addDependency(@NotNull PsiJavaModule from,
                                      @NotNull PsiJavaModule to,
                                      @Nullable DependencyScope scope)