Switch enableJvmDefault to jvmDefaultMode

This commit is contained in:
Mikhael Bogdanov
2018-05-23 14:57:14 +02:00
parent bacc2079ed
commit 065780de4c
61 changed files with 114 additions and 70 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.cli.common.arguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.*
@@ -222,8 +223,19 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var noExceptionOnExplicitEqualsForBoxedNull by FreezableVar(false)
@Argument(value = "-Xenable-jvm-default", description = "Allow to use '@JvmDefault' for JVM default method support")
var enableJvmDefault: Boolean by FreezableVar(false)
@Argument(
value = "-Xoutput-imports",
valueDescription = "<path>",
description = "Output imports from all compiled files to the specified file in JSON format"
)
var outputImports: String? by FreezableVar(null)
@Argument(
value = "-Xjvm-default-mode",
valueDescription = "{disable|enable|compatibility}",
description = "Allow to use '@JvmDefault' for JVM default method support"
)
var jvmDefaultMode: String by FreezableVar(JvmDefaultMode.DEFAULT.description)
@Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default")
var disableDefaultScriptingPlugin: Boolean by FreezableVar(false)
@@ -240,8 +252,13 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
jsr305,
supportCompatqualCheckerFrameworkAnnotations
)
result[AnalysisFlag.enableJvmDefault] = enableJvmDefault
result[AnalysisFlag.ignoreDataFlowInAssert] = JVMAssertionsMode.fromString(assertionsMode) != JVMAssertionsMode.LEGACY
JvmDefaultMode.fromStringOrNull(jvmDefaultMode)?.let { result[AnalysisFlag.jvmDefaultMode] = it }
?: collector.report(
CompilerMessageSeverity.ERROR,
"Unknown @JvmDefault mode: $jvmDefaultMode, " +
"supported modes: ${JvmDefaultMode.values().map { it.description }}"
)
return result
}