Document (String value, @Nullable Language language, Project project) { PsiPackage defaultPackage = JavaPsiFacade.getInstance(project).findPackage(""); final JavaCodeFragment fragment = JavaCodeFragmentFactory.getInstance(project).createReferenceCodeFragment("", defaultPackage, true, true); return PsiDocumentManager.getInstance(project).getDocument(fragment); }