LanguageLevel (MavenProject mavenProject, LanguageLevel level) { Element compilerConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-compiler-plugin"); if (compilerConfiguration != null) { 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)) { try { return LanguageLevel.valueOf(level.name() + "_PREVIEW"); } catch (IllegalArgumentException ignored) { } } } } return level; }