Files
kotlin-fork/compiler/testData/compileKotlinAgainstKotlin/reflectTopLevelFunctionOtherFile.kt
T
Alexander Udalov 4f2fdd1c01 Load all resources in RuntimePackagePartProvider; optimize code
The issue was reproducible when the same package is present in different
modules with the same -module-name (which is a popular case of src/test
roots in simple IDEA projects). The problem was in the fact that several
resource files containing package name mapping with the same name were
present in the classpath, but RuntimePackagePartProvider only considered
the first one. The fix is to use getResources instead of
getResourceAsStream and handle each returned resource.

Also, optimize internal representation to store the mapping in the form
which is the most convenient for findPackageParts, which should be
faster than registerModule because in theory, it's called more often.

 #KT-21973 Fixed
 #KT-24651
2018-07-02 18:49:09 +02:00

21 lines
370 B
Kotlin
Vendored

// IGNORE_BACKEND: NATIVE
// WITH_REFLECT
// FILE: A.kt
fun test() {
}
// FILE: B.kt
import kotlin.reflect.jvm.javaMethod
import kotlin.reflect.jvm.kotlinFunction
fun box(): String {
val r = Class.forName("AKt").methods.single { it.name == "test" }.kotlinFunction
if (r?.toString() != "fun test(): kotlin.Unit")
return "Fail: $r"
return "OK"
}