Permalink
Browse files

Eval4J: loadClass should return prepared class, otherwise ClassNotPre…

…paredException fails in invokeMethod

 #KT-12641 Fixed
  • Loading branch information...
1 parent f6bb70a commit fca58345570498aeec6ea1de1bea54bc1ff1b961 @NataliaUkhorskaya NataliaUkhorskaya committed Aug 12, 2016
Showing with 4 additions and 3 deletions.
  1. +4 −3 eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt
@@ -53,9 +53,10 @@ class JDIEval(
fun loadClass(classType: Type, classLoader: ClassLoaderReference?): Value {
val loadedClasses = vm.classesByName(classType.internalName)
if (!loadedClasses.isEmpty()) {
- val loadedClass = loadedClasses[0]
- if (classType.descriptor in BOOTSTRAP_CLASS_DESCRIPTORS || loadedClass.classLoader() == classLoader) {
- return loadedClass.classObject().asValue()
+ for (loadedClass in loadedClasses) {
+ if (loadedClass.isPrepared && (classType.descriptor in BOOTSTRAP_CLASS_DESCRIPTORS || loadedClass.classLoader() == classLoader)) {
+ return loadedClass.classObject().asValue()
+ }
}
}
if (classLoader == null) {

0 comments on commit fca5834

Please sign in to comment.