LanguageLevel (@Nullable VirtualFile virtualFile) { // For default project, do not look into virtual file system. // It is important for Upsource, where operations are done in default project to // prevent expensive look-up into VFS if (virtualFile == null || myProject.isDefault()) return PsiUtil.getLanguageLevel(myProject); LanguageLevel level = JavaLanguageLevelPusher.getPushedLanguageLevel(virtualFile); if (level != null) { return level; } ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex(); Module module = index.getModuleForFile(virtualFile); if (module != null && index.isInSourceContent(virtualFile)) { return LanguageLevelUtil.getEffectiveLanguageLevel(module); } if (virtualFile instanceof LightVirtualFile) { return LanguageLevel.HIGHEST; } LanguageLevel classesLanguageLevel = getClassesLanguageLevel(virtualFile); return classesLanguageLevel != null ? classesLanguageLevel : PsiUtil.getLanguageLevel(myProject); }