diff --git a/compiler/testData/codegen/boxWithStdlib/native/default.kt b/compiler/testData/codegen/boxWithStdlib/native/default.kt new file mode 100644 index 00000000000..dcc99b31771 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/native/default.kt @@ -0,0 +1,31 @@ +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 +} + +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() + } + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index 7c2c44a3c99..99f74c2d338 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -1819,6 +1819,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/native"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("default.kt") + public void testDefault() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/default.kt"); + doTestWithStdlib(fileName); + } + @TestMetadata("simpleNative.kt") public void testSimpleNative() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/simpleNative.kt");