JVM IR: do not generate extension receiver parameter as ACC_MANDATED

Otherwise Java reflection is not able to load its type as a
parameterized type.

 #KT-40857 Fixed
This commit is contained in:
Alexander Udalov
2023-02-28 23:30:23 +01:00
committed by Space Team
parent d23a4f46cc
commit 47c48efa33
9 changed files with 62 additions and 16 deletions
@@ -0,0 +1,17 @@
// SKIP_JDK6
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_STDLIB
// FULL_JDK
// PARAMETERS_METADATA
import java.lang.reflect.ParameterizedType
fun List<String>.bar(i: Int) = Unit
fun box(): String {
val function = object {}.javaClass.enclosingClass.getDeclaredMethods().single { it.name == "bar" }
val type = function.parameters[0].parameterizedType
if (type !is ParameterizedType || type.toString() != "java.util.List<java.lang.String>") return "Fail: $type ${type.javaClass}"
return "OK"
}