@NotNull
  private static LanguageLevel getApplicableLevel(@NotNull PsiFile file, @NotNull JavaFeature feature) {
    LanguageLevel standardLevel = feature.getStandardLevel();
    LanguageLevel featureLevel = feature.getMinimumLevel();
    if (featureLevel.isPreview()) {
      JavaSdkVersion sdkVersion = JavaSdkVersionUtil.getJavaSdkVersion(file);
      if (sdkVersion != null) {
        if (standardLevel != null && sdkVersion.isAtLeast(JavaSdkVersion.fromLanguageLevel(standardLevel))) {
          return standardLevel;
        }
        LanguageLevel previewLevel = sdkVersion.getMaxLanguageLevel().getPreviewLevel();
        if (previewLevel != null && previewLevel.isAtLeast(featureLevel)) {
          return previewLevel;
        }
      }
    }
    return featureLevel;
  }
@NotNull
  private static LanguageLevel getApplicableLevel(@NotNull PsiFile file, @NotNull JavaFeature feature)