diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 208b3d361ff..87092beb185 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -184,6 +184,9 @@ class ExpressionCodegen( } private fun generateNonNullAssertions() { + if (state.isParamAssertionsDisabled) + return + val isSyntheticOrBridge = irFunction.origin.isSynthetic || // Although these are accessible from Java, the functions they bridge to already have the assertions. irFunction.origin == IrDeclarationOrigin.BRIDGE_SPECIAL || diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/noCallAssertions.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/noCallAssertions.kt index 9e22074e572..a6979d5250a 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/noCallAssertions.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/noCallAssertions.kt @@ -1,5 +1,4 @@ // KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS, +JVM.DISABLE_CALL_ASSERTIONS -// IGNORE_BACKEND: JVM_IR // FILE: A.java import org.jetbrains.annotations.NotNull; diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/doNotGenerateParamAssertions.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/doNotGenerateParamAssertions.kt index 5419e3edd87..df90138a4e6 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/doNotGenerateParamAssertions.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/doNotGenerateParamAssertions.kt @@ -1,5 +1,4 @@ // KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS -// IGNORE_BACKEND: JVM_IR class A { fun foo(s: String) { diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableCaptured.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableCaptured.kt index 8d7a0e63f7d..607aed72f01 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableCaptured.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableCaptured.kt @@ -1,5 +1,4 @@ // KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS -// IGNORE_BACKEND: JVM_IR class A { fun add(element: T) {} diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableGenericMethod.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableGenericMethod.kt index d15647f5136..9f615781cb3 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableGenericMethod.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/noAssertionForNullableGenericMethod.kt @@ -1,5 +1,4 @@ // KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS -// IGNORE_BACKEND: JVM_IR fun foo(a: List) { val t: T = a.get(0)