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
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package foo
|
||||
|
||||
import kotlin.jvm.*
|
||||
import kotlin.platform.*
|
||||
|
||||
object ObjWithNative {
|
||||
native fun foo(x: Int = 1): Double
|
||||
|
||||
platformStatic native fun bar(l: Long, s: String = ""): Double
|
||||
}
|
||||
|
||||
native fun topLevel(x: Int = 1): Double
|
||||
|
||||
fun box(): String {
|
||||
var d = 0.0
|
||||
|
||||
try {
|
||||
d = ObjWithNative.bar(1)
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||
}
|
||||
|
||||
try {
|
||||
d = ObjWithNative.foo()
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.ObjWithNative.foo(I)D") return "Fail 2: " + e.getMessage()
|
||||
}
|
||||
|
||||
try {
|
||||
d = topLevel()
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.FooPackage.topLevel(I)D") return "Fail 3: " + e.getMessage()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import kotlin.jvm.*
|
||||
import kotlin.platform.*
|
||||
|
||||
class C {
|
||||
companion object {
|
||||
private platformStatic native fun foo()
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
C().bar()
|
||||
return "Link error expected"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "C.foo()V") return "Fail 1: " + e.getMessage()
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package foo
|
||||
|
||||
import kotlin.jvm.*
|
||||
|
||||
class WithNative {
|
||||
native fun foo()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
WithNative().foo()
|
||||
return "Link error expected"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package foo
|
||||
|
||||
import kotlin.jvm.*
|
||||
import kotlin.platform.*
|
||||
|
||||
class WithNative {
|
||||
companion object {
|
||||
platformStatic native fun bar(l: Long, s: String): Double
|
||||
}
|
||||
}
|
||||
|
||||
object ObjWithNative {
|
||||
platformStatic native fun bar(l: Long, s: String): Double
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var d = 0.0
|
||||
try {
|
||||
d = WithNative.bar(1, "")
|
||||
return "Link error expected"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.WithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||
}
|
||||
|
||||
try {
|
||||
d = ObjWithNative.bar(1, "")
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 2: " + e.getMessage()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package foo
|
||||
|
||||
import kotlin.jvm.*
|
||||
import kotlin.platform.*
|
||||
|
||||
native fun bar(l: Long, s: String): Double
|
||||
|
||||
fun box(): String {
|
||||
var d = 0.0
|
||||
|
||||
try {
|
||||
d = bar(1, "")
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.FooPackage.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user