public static @NotNull LanguageLevel getLanguageLevel(@NotNull MavenProject mavenProject, @NotNull Supplier<LanguageLevel> supplier) {
    LanguageLevel level = null;

    Element cfg = mavenProject.getPluginConfiguration("com.googlecode", "maven-idea-plugin");
    if (cfg != null) {
      String key = cfg.getChildTextTrim("jdkLevel");
      level = key == null ? null : MAVEN_IDEA_PLUGIN_LEVELS.get(key);
    }

    if (level == null) {
      level = supplier.get();
    }

    // default source and target settings of maven-compiler-plugin is 1.5 for versions less than 3.8.1 and 1.6 for 3.8.1 and above
    // see details at http://maven.apache.org/plugins/maven-compiler-plugin and https://issues.apache.org/jira/browse/MCOMPILER-335
    if (level == null) {
      level = getDefaultLevel(mavenProject);
    }

    if (level.isAtLeast(LanguageLevel.JDK_11)) {
      level = adjustPreviewLanguageLevel(mavenProject, level);
    }
    return level;
  }
public static @NotNull LanguageLevel getLanguageLevel(@NotNull MavenProject mavenProject, @NotNull Supplier<LanguageLevel> supplier)