public static boolean isInSourceContent(@NotNull VirtualFile file) {
    return ApplicationManager.getApplication().getService(InternalPersistentJavaLanguageLevelReaderService.class)
             .getPersistedLanguageLevel(file) != null;
  }
public static boolean isInSourceContent(@NotNull VirtualFile file)