public static @Nullable Document createDocument(final String text,
                                                  Project project,
                                                  boolean isClassesAccepted,
                                                  JavaCodeFragment.VisibilityChecker visibilityChecker) {
    final PsiPackage defaultPackage = project.isDefault() ? null : JavaPsiFacade.getInstance(project).findPackage("");
    final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project);
    final JavaCodeFragment fragment = factory.createReferenceCodeFragment(text, defaultPackage, true, isClassesAccepted);
    fragment.setVisibilityChecker(visibilityChecker);
    return PsiDocumentManager.getInstance(project).getDocument(fragment);
  }
public static @Nullable Document createDocument(final String text,
                                                  Project project,
                                                  boolean isClassesAccepted,
                                                  JavaCodeFragment.VisibilityChecker visibilityChecker)