Fix reflection class lookup in default package
Do not append "." to the name of the class in the default package.
This commit is contained in:
committed by
Space Team
parent
e290fa5f7b
commit
51ce829b96
@@ -97,9 +97,20 @@ private fun loadClass(classLoader: ClassLoader, packageName: String, className:
|
||||
}
|
||||
}
|
||||
|
||||
var fqName = "$packageName.${className.replace('.', '$')}"
|
||||
if (arrayDimensions > 0) {
|
||||
fqName = "[".repeat(arrayDimensions) + "L$fqName;"
|
||||
val fqName = buildString {
|
||||
if (arrayDimensions > 0) {
|
||||
repeat(arrayDimensions) {
|
||||
append("[")
|
||||
}
|
||||
append("L")
|
||||
}
|
||||
if (packageName.isNotEmpty()) {
|
||||
append("$packageName.")
|
||||
}
|
||||
append(className.replace('.', '$'))
|
||||
if (arrayDimensions > 0) {
|
||||
append(";")
|
||||
}
|
||||
}
|
||||
|
||||
return classLoader.tryLoadClass(fqName)
|
||||
|
||||
Reference in New Issue
Block a user