PsiFile (final @NotNull Project project, final @NotNull String text) { final PsiFile file = PsiFileFactory.getInstance(project).createFileFromText( "sample.java", JavaFileType.INSTANCE, text, LocalTimeCounter.currentTime(), false, false ); file.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST); return file; }