Command-line option disabling KotlinNothingValueException generation
This commit is contained in:
@@ -2646,7 +2646,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
|
|
||||||
KotlinType returnType = resolvedCall.getResultingDescriptor().getReturnType();
|
KotlinType returnType = resolvedCall.getResultingDescriptor().getReturnType();
|
||||||
if (returnType != null && KotlinBuiltIns.isNothing(returnType)) {
|
if (returnType != null && KotlinBuiltIns.isNothing(returnType)) {
|
||||||
if (state.getLanguageVersionSettings().getApiVersion().compareTo(ApiVersion.KOTLIN_1_4) >= 0) {
|
if (state.getUseKotlinNothingValueException()) {
|
||||||
v.anew(Type.getObjectType("kotlin/KotlinNothingValueException"));
|
v.anew(Type.getObjectType("kotlin/KotlinNothingValueException"));
|
||||||
v.dup();
|
v.dup();
|
||||||
v.invokespecial("kotlin/KotlinNothingValueException", "<init>", "()V", false);
|
v.invokespecial("kotlin/KotlinNothingValueException", "<init>", "()V", false);
|
||||||
|
|||||||
@@ -219,6 +219,9 @@ class GenerationState private constructor(
|
|||||||
val generateOptimizedCallableReferenceSuperClasses =
|
val generateOptimizedCallableReferenceSuperClasses =
|
||||||
languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 &&
|
languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 &&
|
||||||
!configuration.getBoolean(JVMConfigurationKeys.NO_OPTIMIZED_CALLABLE_REFERENCES)
|
!configuration.getBoolean(JVMConfigurationKeys.NO_OPTIMIZED_CALLABLE_REFERENCES)
|
||||||
|
val useKotlinNothingValueException =
|
||||||
|
languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 &&
|
||||||
|
!configuration.getBoolean(JVMConfigurationKeys.NO_KOTLIN_NOTHING_VALUE_EXCEPTION)
|
||||||
val samWrapperClasses: SamWrapperClasses = SamWrapperClasses(this)
|
val samWrapperClasses: SamWrapperClasses = SamWrapperClasses(this)
|
||||||
val globalInlineContext: GlobalInlineContext = GlobalInlineContext(diagnostics)
|
val globalInlineContext: GlobalInlineContext = GlobalInlineContext(diagnostics)
|
||||||
val mappingsClassesForWhenByEnum: MappingsClassesForWhenByEnum = MappingsClassesForWhenByEnum(this)
|
val mappingsClassesForWhenByEnum: MappingsClassesForWhenByEnum = MappingsClassesForWhenByEnum(this)
|
||||||
|
|||||||
+6
@@ -347,6 +347,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
|||||||
)
|
)
|
||||||
var noOptimizedCallableReferences: Boolean by FreezableVar(false)
|
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> {
|
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||||
val result = super.configureAnalysisFlags(collector)
|
val result = super.configureAnalysisFlags(collector)
|
||||||
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
|
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
|||||||
put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
||||||
put(JVMConfigurationKeys.EMIT_JVM_TYPE_ANNOTATIONS, arguments.emitJvmTypeAnnotations)
|
put(JVMConfigurationKeys.EMIT_JVM_TYPE_ANNOTATIONS, arguments.emitJvmTypeAnnotations)
|
||||||
put(JVMConfigurationKeys.NO_OPTIMIZED_CALLABLE_REFERENCES, arguments.noOptimizedCallableReferences)
|
put(JVMConfigurationKeys.NO_OPTIMIZED_CALLABLE_REFERENCES, arguments.noOptimizedCallableReferences)
|
||||||
|
put(JVMConfigurationKeys.NO_KOTLIN_NOTHING_VALUE_EXCEPTION, arguments.noKotlinNothingValueException)
|
||||||
|
|
||||||
if (!JVMConstructorCallNormalizationMode.isSupportedValue(arguments.constructorCallNormalizationMode)) {
|
if (!JVMConstructorCallNormalizationMode.isSupportedValue(arguments.constructorCallNormalizationMode)) {
|
||||||
getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(
|
getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(
|
||||||
|
|||||||
@@ -119,4 +119,7 @@ public class JVMConfigurationKeys {
|
|||||||
|
|
||||||
public static final CompilerConfigurationKey<Boolean> NO_OPTIMIZED_CALLABLE_REFERENCES =
|
public static final CompilerConfigurationKey<Boolean> NO_OPTIMIZED_CALLABLE_REFERENCES =
|
||||||
CompilerConfigurationKey.create("Do not use optimized callable reference superclasses available from 1.4");
|
CompilerConfigurationKey.create("Do not use optimized callable reference superclasses available from 1.4");
|
||||||
|
|
||||||
|
public static final CompilerConfigurationKey<Boolean> NO_KOTLIN_NOTHING_VALUE_EXCEPTION =
|
||||||
|
CompilerConfigurationKey.create("Do not use KotlinNothingValueException available since 1.4");
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -67,6 +67,8 @@ where advanced options include:
|
|||||||
-Xno-call-assertions Don't generate not-null assertions for arguments of platform types
|
-Xno-call-assertions Don't generate not-null assertions for arguments of platform types
|
||||||
-Xno-exception-on-explicit-equals-for-boxed-null
|
-Xno-exception-on-explicit-equals-for-boxed-null
|
||||||
Do not throw NPE on explicit 'equals' call for null receiver of platform boxed primitive type
|
Do not throw NPE on explicit 'equals' call for null receiver of platform boxed primitive type
|
||||||
|
-Xno-kotlin-nothing-value-exception
|
||||||
|
Do not use KotlinNothingValueException available since 1.4
|
||||||
-Xno-optimize Disable optimizations
|
-Xno-optimize Disable optimizations
|
||||||
-Xno-optimized-callable-references
|
-Xno-optimized-callable-references
|
||||||
Do not use optimized callable reference superclasses available from 1.4
|
Do not use optimized callable reference superclasses available from 1.4
|
||||||
|
|||||||
Reference in New Issue
Block a user