Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/fullJdk/native/nativePropertyAccessors.kt
T
Alexander Udalov 72aa3d1465 Use mock JDK in compiler tests where full JDK is not needed
- move some of boxWithStdlib tests under fullJdk/ directory, where they will be
  compiled against the full JDK
- introduce FULL_JDK in-text directive for the reflection test as only 4 tests
  out of 654 needed the full JDK
2015-04-02 21:57:48 +03:00

49 lines
1.2 KiB
Kotlin
Vendored

class C {
companion object {
val defaultGetter: Int = 1
[native] get
var defaultSetter: Int = 1
[native] get
[native] set
}
val defaultGetter: Int = 1
[native] get
var defaultSetter: Int = 1
[native] get
[native] set
}
val defaultGetter: Int = 1
[native] get
var defaultSetter: Int = 1
[native] get
[native] set
fun check(body: () -> Unit, signature: String): String? {
try {
body()
return "Link error expected"
}
catch (e: java.lang.UnsatisfiedLinkError) {
if (e.getMessage() != signature) return "Fail $signature: " + e.getMessage()
}
return null
}
fun box(): String {
return check({defaultGetter}, "_DefaultPackage.getDefaultGetter()I")
?: check({defaultSetter = 1}, "_DefaultPackage.setDefaultSetter(I)V")
?: check({C.defaultGetter}, "C\$Companion.getDefaultGetter()I")
?: check({C.defaultSetter = 1}, "C\$Companion.setDefaultSetter(I)V")
?: check({C().defaultGetter}, "C.getDefaultGetter()I")
?: check({C().defaultSetter = 1}, "C.setDefaultSetter(I)V")
?: "OK"
}