mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 08:31:35 +00:00
The generated code is more inline with java, and we avoid the error of accessing package-private field outside of the package. However, this changes semantics a bit. Now, a user should set assertion status of inline-site's package, instead of inline function's one. #KT-28317: Fixed
40 lines
993 B
Kotlin
Vendored
40 lines
993 B
Kotlin
Vendored
// FILE: inline.kt
|
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
|
// WITH_RUNTIME
|
|
// FULL_JDK
|
|
// IGNORE_BACKEND: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
package test
|
|
|
|
inline fun inlineMe() {
|
|
assert(false) { "FROM INLINED" }
|
|
}
|
|
|
|
// FILE: inlineSite.kt
|
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
|
|
|
import test.*
|
|
|
|
class CheckerJvmAssertInlineFunctionAssertionsDisabled {
|
|
fun check() {
|
|
inlineMe()
|
|
assert(false) { "FROM INLINESITE" }
|
|
}
|
|
}
|
|
|
|
class Dummy
|
|
|
|
fun disableAssertions(): CheckerJvmAssertInlineFunctionAssertionsDisabled {
|
|
val loader = Dummy::class.java.classLoader
|
|
loader.setClassAssertionStatus("CheckerJvmAssertInlineFunctionAssertionsDisabled", false)
|
|
loader.setClassAssertionStatus("InlineKt", false)
|
|
val c = loader.loadClass("CheckerJvmAssertInlineFunctionAssertionsDisabled")
|
|
return c.newInstance() as CheckerJvmAssertInlineFunctionAssertionsDisabled
|
|
}
|
|
|
|
fun box(): String {
|
|
var c = disableAssertions()
|
|
c.check()
|
|
return "OK"
|
|
} |