Command-line option disabling KotlinNothingValueException generation

This commit is contained in:
Dmitry Petrov
2020-04-16 17:04:47 +03:00
parent 3c4e691e62
commit ac5411c32e
6 changed files with 16 additions and 1 deletions
@@ -347,6 +347,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var noOptimizedCallableReferences: Boolean by FreezableVar(false)
@Argument(
value = "-Xno-kotlin-nothing-value-exception",
description = "Do not use KotlinNothingValueException available since 1.4"
)
var noKotlinNothingValueException: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
@@ -154,6 +154,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
put(JVMConfigurationKeys.EMIT_JVM_TYPE_ANNOTATIONS, arguments.emitJvmTypeAnnotations)
put(JVMConfigurationKeys.NO_OPTIMIZED_CALLABLE_REFERENCES, arguments.noOptimizedCallableReferences)
put(JVMConfigurationKeys.NO_KOTLIN_NOTHING_VALUE_EXCEPTION, arguments.noKotlinNothingValueException)
if (!JVMConstructorCallNormalizationMode.isSupportedValue(arguments.constructorCallNormalizationMode)) {
getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(