Add some tests on Java property references
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
public class J {
|
||||||
|
static String x;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val f = J::x
|
||||||
|
assertEquals("x", f.name)
|
||||||
|
|
||||||
|
f.set("OK")
|
||||||
|
assertEquals("OK", J.x)
|
||||||
|
assertEquals("OK", f.getter())
|
||||||
|
|
||||||
|
return f.get()
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
public class J {
|
||||||
|
public String foo = "";
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
class K : J() {
|
||||||
|
fun getFoo(): String = "K"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val j = J()
|
||||||
|
val x = J::foo
|
||||||
|
x.set(j, "J")
|
||||||
|
assertEquals("J", x.get(j))
|
||||||
|
|
||||||
|
val k = K()
|
||||||
|
val y = K::foo
|
||||||
|
y.set(k, "K")
|
||||||
|
assertEquals("K", y.get(k))
|
||||||
|
assertEquals("K", x.get(k))
|
||||||
|
|
||||||
|
val z = K::getFoo
|
||||||
|
assertEquals("K", z.invoke(k))
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -285,12 +285,24 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
doTestWithJava(fileName);
|
doTestWithJava(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("javaStaticField")
|
||||||
|
public void testJavaStaticField() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaStaticField/");
|
||||||
|
doTestWithJava(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlinPropertyInheritedInJava")
|
@TestMetadata("kotlinPropertyInheritedInJava")
|
||||||
public void testKotlinPropertyInheritedInJava() throws Exception {
|
public void testKotlinPropertyInheritedInJava() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/");
|
||||||
doTestWithJava(fileName);
|
doTestWithJava(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noConflictOnKotlinGetterAndJavaField")
|
||||||
|
public void testNoConflictOnKotlinGetterAndJavaField() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/");
|
||||||
|
doTestWithJava(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors")
|
@TestMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors")
|
||||||
|
|||||||
Reference in New Issue
Block a user