@@ -6,6 +6,7 @@ import org.utbot.common.withAccessibility
66import org.utbot.framework.concrete.constructors.UtCompositeModelStrategy
77import org.utbot.framework.concrete.constructors.UtModelConstructor
88import org.utbot.framework.plugin.api.ClassId
9+ import org.utbot.framework.plugin.api.EnvironmentModels
910import org.utbot.framework.plugin.api.FieldId
1011import org.utbot.framework.plugin.api.TimeoutException
1112import org.utbot.framework.plugin.api.UtConcreteValue
@@ -58,11 +59,20 @@ class ModelConstructionContext(
5859 constructor .construct(it.value, it.clazz.id)
5960 }
6061
61- fun constructStatics (staticFields : Set <FieldId >): Map <FieldId , UtModel > =
62- staticFields.associateWith { fieldId ->
62+ fun constructStatics (
63+ stateBefore : EnvironmentModels ,
64+ staticFields : Map <FieldId , UtConcreteValue <* >>
65+ ): Map <FieldId , UtModel > =
66+ staticFields.keys.associateWith { fieldId ->
6367 fieldId.jField.run {
6468 val computedValue = withAccessibility { get(null ) }
65- constructor .construct(computedValue, fieldId.type)
69+ val knownModel = stateBefore.statics[fieldId]
70+ val knownValue = staticFields[fieldId]?.value
71+ if (knownModel != null && knownValue != null && knownValue == computedValue) {
72+ knownModel
73+ } else {
74+ constructor .construct(computedValue, fieldId.type)
75+ }
6676 }
6777 }
6878
0 commit comments