Files
kotlin-fork/compiler/testData/codegen/box/parametersMetadata/delegation.kt
T
Mads Ager a65f50bb00 JVM_IR: Generate java 8 parameter names when -java-parameters is passed.
The type mapper does not map enum parameters and outer this parameters
to the right parameter signature kinds so around half the tests
are still failing. Since a new type mapper is being worked
on I will not investigate that further right now.
2019-04-16 09:32:57 +02:00

38 lines
913 B
Kotlin
Vendored

// SKIP_JDK6
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
// JAVAC_OPTIONS: -parameters
// KOTLIN_CONFIGURATION_FLAGS: +JVM.PARAMETERS_METADATA
// FILE: JavaInterface.java
public interface JavaInterface {
void plugin(String id);
}
// FILE: test.kt
import kotlin.test.assertEquals
interface KotlinInterface {
fun plugin(id: String)
}
class KotlinDelegate(impl: KotlinInterface) : KotlinInterface by impl
class JavaDelegate(impl: JavaInterface) : JavaInterface by impl
private fun check(javaClass: Class<*>) {
val pluginMethod = javaClass.getDeclaredMethod("plugin", String::class.java)
assertEquals(listOf("id"), pluginMethod.parameters.map { it.name }, "Incorrect parameters for $javaClass")
}
fun box(): String {
check(JavaInterface::class.java)
check(KotlinInterface::class.java)
check(KotlinDelegate::class.java)
check(JavaDelegate::class.java)
return "OK"
}