Prevent infinite recursion in loadClass()
This commit is contained in:
@@ -12,14 +12,22 @@ class JDIEval(
|
|||||||
private val thread: jdi.ThreadReference
|
private val thread: jdi.ThreadReference
|
||||||
) : Eval {
|
) : Eval {
|
||||||
override fun loadClass(classType: Type): Value {
|
override fun loadClass(classType: Type): Value {
|
||||||
|
val loadedClasses = vm.classesByName(classType.getInternalName())
|
||||||
|
if (!loadedClasses.isEmpty()) {
|
||||||
|
return loadedClasses[0].classObject().asValue()
|
||||||
|
}
|
||||||
return invokeStaticMethod(
|
return invokeStaticMethod(
|
||||||
MethodDescription(
|
MethodDescription(
|
||||||
CLASS.getInternalName(),
|
CLASS.getInternalName(),
|
||||||
"forName",
|
"forName",
|
||||||
"(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/Class;",
|
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;",
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
listOf(classLoader.asValue())
|
listOf(
|
||||||
|
vm.mirrorOf(classType.getInternalName().replace('/', '.')).asValue(),
|
||||||
|
boolean(true),
|
||||||
|
classLoader.asValue()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user