void (@NotNull PsiMethodCallExpression callExpression, @NotNull ProblemsHolder holder, @NotNull PsiJavaModule javaModule) { final PsiExpression[] arguments = callExpression.getArgumentList().getExpressions(); if (arguments.length != 0) { final PsiExpression classNameArgument = arguments[0]; final String className = computeConstantExpression(classNameArgument, String.class); if (className != null) { final Project project = holder.getProject(); final JavaPsiFacade facade = JavaPsiFacade.getInstance(project); final PsiClass psiClass = facade.findClass(className, callExpression.getResolveScope()); if (psiClass != null) { final PsiJavaModule otherModule = JavaModuleGraphUtil.findDescriptorByElement(psiClass); if (otherModule != null && otherModule != javaModule) { if (!JavaModuleGraphUtil.reads(javaModule, otherModule)) { String message = JavaBundle.message("module.not.in.requirements", javaModule.getName(), otherModule.getName()); holder.problem(classNameArgument, message).fix(new AddRequiresDirectiveFix(javaModule, otherModule.getName())).register(); return; } if (otherModule.hasModifierProperty(PsiModifier.OPEN)) { return; } final PsiJavaFile file = PsiTreeUtil.getParentOfType(psiClass, PsiJavaFile.class); if (file != null) { final String packageName = file.getPackageName(); if (isPackageAccessible(otherModule.getOpens(), packageName, javaModule)) { return; } final boolean publicApi = isPublicApi(psiClass); if (publicApi && isPackageAccessible(otherModule.getExports(), packageName, javaModule)) { return; } if (publicApi) { final String message = JavaBundle.message("module.package.not.exported", otherModule.getName(), packageName, javaModule.getName()); holder.problem(classNameArgument, message).fix(new AddExportsDirectiveFix(otherModule, packageName, javaModule.getName())).register(); } else { final String message = JavaBundle.message("module.package.not.open", otherModule.getName(), packageName, javaModule.getName()); holder.problem(classNameArgument, message).fix(new AddOpensDirectiveFix(otherModule, packageName, javaModule.getName())).register(); } } } } } } }