@@ -6,6 +6,7 @@ import org.utbot.common.withAccessibility
6
6
import org.utbot.framework.concrete.constructors.UtCompositeModelStrategy
7
7
import org.utbot.framework.concrete.constructors.UtModelConstructor
8
8
import org.utbot.framework.plugin.api.ClassId
9
+ import org.utbot.framework.plugin.api.EnvironmentModels
9
10
import org.utbot.framework.plugin.api.FieldId
10
11
import org.utbot.framework.plugin.api.TimeoutException
11
12
import org.utbot.framework.plugin.api.UtConcreteValue
@@ -58,11 +59,20 @@ class ModelConstructionContext(
58
59
constructor .construct(it.value, it.clazz.id)
59
60
}
60
61
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 ->
63
67
fieldId.jField.run {
64
68
val computedValue = withAccessibility { get(null ) }
65
- constructor .construct(computedValue, fieldId.type)
69
+ val knownModel = stateBefore.statics[fieldId]
70
+ val knownValue = staticFields[fieldId]
71
+ if (knownModel != null && knownValue != null && knownValue == computedValue) {
72
+ knownModel
73
+ } else {
74
+ constructor .construct(computedValue, fieldId.type)
75
+ }
66
76
}
67
77
}
68
78
0 commit comments