@@ -5,6 +5,7 @@ import kotlinx.collections.immutable.persistentHashSetOf
55import kotlinx.collections.immutable.persistentListOf
66import kotlinx.collections.immutable.persistentSetOf
77import kotlinx.collections.immutable.toPersistentList
8+ import kotlinx.collections.immutable.toPersistentMap
89import kotlinx.collections.immutable.toPersistentSet
910import org.utbot.common.WorkaroundReason.HACK
1011import org.utbot.framework.UtSettings.ignoreStaticsFromTrustedLibraries
@@ -1936,7 +1937,6 @@ class Traverser(
19361937 val touchedStaticFields = persistentListOf(staticFieldMemoryUpdate)
19371938 queuedSymbolicStateUpdates + = MemoryUpdate (staticFieldsUpdates = touchedStaticFields)
19381939
1939- // TODO filter enum constant static fields JIRA:1681
19401940 if (! environment.method.isStaticInitializer && isStaticFieldMeaningful(field)) {
19411941 queuedSymbolicStateUpdates + = MemoryUpdate (meaningfulStaticFields = persistentSetOf(fieldId))
19421942 }
@@ -3579,6 +3579,7 @@ class Traverser(
35793579 val declaringClassId = declaringClass.id
35803580
35813581 val staticFieldsUpdates = updates.staticFieldsUpdates.toMutableList()
3582+ val fieldValuesUpdates = updates.fieldValues.toMutableMap()
35823583 val updatedFields = staticFieldsUpdates.mapTo(mutableSetOf ()) { it.fieldId }
35833584 val objectUpdates = mutableListOf<UtNamedStore >()
35843585
@@ -3591,6 +3592,7 @@ class Traverser(
35913592 // remove updates from clinit, because we'll replace those values
35923593 // with new unbounded symbolic variable
35933594 staticFieldsUpdates.removeAll { update -> update.fieldId == it.fieldId }
3595+ fieldValuesUpdates.keys.removeAll { key -> key.fieldId == it.fieldId }
35943596
35953597 val value = createConst(it.type, it.name)
35963598 val valueToStore = if (value is ReferenceValue ) {
@@ -3610,6 +3612,7 @@ class Traverser(
36103612 return updates.copy(
36113613 stores = updates.stores.addAll(objectUpdates),
36123614 staticFieldsUpdates = staticFieldsUpdates.toPersistentList(),
3615+ fieldValues = fieldValuesUpdates.toPersistentMap(),
36133616 classIdToClearStatics = declaringClassId
36143617 )
36153618 }
0 commit comments