Generate annotations in proper order in DefaultImpls

This commit is contained in:
Mikhael Bogdanov
2017-12-21 15:26:08 +01:00
parent c9d0ab38cf
commit ea5505f80c
6 changed files with 51 additions and 2 deletions
@@ -0,0 +1,20 @@
// FULL_JDK
// WITH_REFLECT
// IGNORE_BACKEND: JS, NATIVE
annotation class Anno(val value: String)
interface Test {
fun foo(@Anno("OK") a: String) = "123"
}
fun box(): String {
val testMethod = Class.forName("Test\$DefaultImpls").declaredMethods.single()
//return (::test.parameters.single().annotations.single() as Simple).value
val receiverAnnotations = (testMethod.parameters[0]).annotations
if (receiverAnnotations.isNotEmpty()) return "fail: receiver parameter should not have any annotations, but: ${receiverAnnotations.joinToString()}"
val value2 = ((testMethod.parameters[1]).annotations.single() as Anno).value
return value2
}