@@ -8,7 +8,6 @@ import kotlinx.collections.immutable.toPersistentMap
88import kotlinx.collections.immutable.toPersistentSet
99import org.utbot.common.WorkaroundReason.HACK
1010import org.utbot.common.WorkaroundReason.REMOVE_ANONYMOUS_CLASSES
11- import org.utbot.common.findField
1211import org.utbot.common.unreachableBranch
1312import org.utbot.common.withAccessibility
1413import org.utbot.common.workaround
@@ -90,8 +89,9 @@ import org.utbot.framework.plugin.api.MethodId
9089import org.utbot.framework.plugin.api.UtMethod
9190import org.utbot.framework.plugin.api.classId
9291import org.utbot.framework.plugin.api.id
93- import org.utbot.framework.plugin.api.util.id
92+ import org.utbot.framework.plugin.api.util.jField
9493import org.utbot.framework.plugin.api.util.jClass
94+ import org.utbot.framework.plugin.api.util.id
9595import org.utbot.framework.plugin.api.util.signature
9696import org.utbot.framework.plugin.api.util.utContext
9797import org.utbot.framework.util.executableId
@@ -580,7 +580,7 @@ class Traverser(
580580 declaringClass : SootClass ,
581581 stmt : Stmt
582582 ): SymbolicStateUpdate {
583- val concreteValue = extractConcreteValue(field, declaringClass )
583+ val concreteValue = extractConcreteValue(field)
584584 val (symbolicResult, symbolicStateUpdate) = toMethodResult(concreteValue, field.type)
585585 val symbolicValue = (symbolicResult as SymbolicSuccess ).value
586586
@@ -632,13 +632,21 @@ class Traverser(
632632 // Some fields are inaccessible with reflection, so we have to instantiate it by ourselves.
633633 // Otherwise, extract it from the class.
634634 // TODO JIRA:1593
635- private fun extractConcreteValue (field : SootField , declaringClass : SootClass ): Any? =
635+ private fun extractConcreteValue (field : SootField ): Any? =
636636 when (field.signature) {
637637 SECURITY_FIELD_SIGNATURE -> SecurityManager ()
638638 // todo change to class loading
639639 // FIELD_FILTER_MAP_FIELD_SIGNATURE -> mapOf(Reflection::class to arrayOf("fieldFilterMap", "methodFilterMap"))
640640 METHOD_FILTER_MAP_FIELD_SIGNATURE -> emptyMap<Class <* >, Array <String >>()
641- else -> declaringClass.id.jClass.findField(field.name).let { it.withAccessibility { it.get(null ) } }
641+ else -> {
642+ val fieldId = field.fieldId
643+ val jField = fieldId.jField
644+ jField.let {
645+ it.withAccessibility {
646+ it.get(null )
647+ }
648+ }
649+ }
642650 }
643651
644652 private fun isStaticInstanceInMethodResult (id : ClassId , methodResult : MethodResult ? ) =
0 commit comments