Fix annotations on Java elements in reflection
#KT-10840 Fixed
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
@Anno("J")
|
||||
public class J {
|
||||
@Anno("foo")
|
||||
public static int foo = 42;
|
||||
|
||||
@Anno("bar")
|
||||
public static void bar() {}
|
||||
|
||||
@Anno("constructor")
|
||||
public J() {}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
annotation class Anno(val value: String)
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("[@Anno(value=J)]", J::class.annotations.toString())
|
||||
assertEquals("[@Anno(value=foo)]", J::foo.annotations.toString())
|
||||
assertEquals("[@Anno(value=bar)]", J::bar.annotations.toString())
|
||||
assertEquals("[@Anno(value=constructor)]", ::J.annotations.toString())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -581,6 +581,12 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/reflection"), Pattern.compile("^([^\\.]+)$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnJavaMembers")
|
||||
public void testAnnotationsOnJavaMembers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("callInstanceJavaMethod")
|
||||
public void testCallInstanceJavaMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/");
|
||||
|
||||
Reference in New Issue
Block a user