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
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
// 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"
|
||||
}
|
||||
Reference in New Issue
Block a user