private static LanguageLevel adjustPreviewLanguageLevel(MavenProject mavenProject, LanguageLevel level) {
    String enablePreviewProperty = mavenProject.getProperties().getProperty("maven.compiler.enablePreview");
    if (Boolean.parseBoolean(enablePreviewProperty)) {
      return notNull(level.getPreviewLevel(), level);
    }

    Element compilerConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-compiler-plugin");
    if (compilerConfiguration != null) {
      String enablePreviewParameter = compilerConfiguration.getChildTextTrim("enablePreview");
      if (Boolean.parseBoolean(enablePreviewParameter)) {
        return notNull(level.getPreviewLevel(), level);
      }

      Element compilerArgs = compilerConfiguration.getChild("compilerArgs");
      if (compilerArgs != null) {
        if (isPreviewText(compilerArgs) ||
            ContainerUtil.exists(compilerArgs.getChildren("arg"), MavenImportUtil::isPreviewText) ||
            ContainerUtil.exists(compilerArgs.getChildren("compilerArg"), MavenImportUtil::isPreviewText)) {
          return notNull(level.getPreviewLevel(), level);
        }
      }
    }

    return level;
  }
private static LanguageLevel adjustPreviewLanguageLevel(MavenProject mavenProject, LanguageLevel level)