File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed
utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/instrumentation/execution Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,6 @@ object UtExecutionInstrumentation : Instrumentation<UtConcreteExecutionResult> {
84
84
delegateInstrumentation,
85
85
timeout
86
86
).computeConcreteExecutionResult {
87
- var savedStatics: Map <FieldId , Any ?>? = null
88
-
89
87
try {
90
88
val (params, statics, cache) = this .executePhaseInTimeout(valueConstructionPhase) {
91
89
val params = constructParameters(stateBefore)
@@ -100,7 +98,7 @@ object UtExecutionInstrumentation : Instrumentation<UtConcreteExecutionResult> {
100
98
// invariants:
101
99
// 1. phase must always complete if started as static reset relies on it
102
100
// 2. phase must be fast as there are no incremental changes
103
- savedStatics = preparationPhase.start {
101
+ postprocessingPhase. savedStatics = preparationPhase.start {
104
102
val result = setStaticFields(statics)
105
103
resetTrace()
106
104
result
@@ -146,13 +144,10 @@ object UtExecutionInstrumentation : Instrumentation<UtConcreteExecutionResult> {
146
144
coverage
147
145
)
148
146
} finally {
149
- // postprocessing
150
- savedStatics?.let {
151
- postprocessingPhase.start {
152
- resetStaticFields(it)
153
- }
147
+ postprocessingPhase.start {
148
+ resetStaticFields()
149
+ valueConstructionPhase.resetMockMethods()
154
150
}
155
- valueConstructionPhase.resetMockMethods()
156
151
}
157
152
}
158
153
}
Original file line number Diff line number Diff line change @@ -10,10 +10,18 @@ import org.utbot.framework.plugin.api.util.jField
10
10
*/
11
11
class PostprocessingPhase : ExecutionPhase {
12
12
13
+ private var savedStaticsInstance: Map <FieldId , Any ?>? = null
14
+
15
+ var savedStatics: Map <FieldId , Any ?>
16
+ get() = savedStaticsInstance!!
17
+ set(value) {
18
+ savedStaticsInstance = value
19
+ }
20
+
13
21
override fun wrapError (e : Throwable ): ExecutionPhaseException = ExecutionPhaseError (this .javaClass.simpleName, e)
14
22
15
- fun resetStaticFields (staticFields : Map < FieldId , Any ?> ) {
16
- staticFields .forEach { (fieldId, value) ->
23
+ fun resetStaticFields () {
24
+ savedStatics .forEach { (fieldId, value) ->
17
25
fieldId.jField.run {
18
26
withAccessibility {
19
27
set(null , value)
Original file line number Diff line number Diff line change @@ -56,8 +56,6 @@ dependencies {
56
56
implementation project(" :utbot-analytics" )
57
57
58
58
59
- implementation group : ' com.jetbrains.rd' , name : ' rd-framework' , version : rdVersion
60
- implementation group : ' com.jetbrains.rd' , name : ' rd-core' , version : rdVersion
61
59
implementation(" org.unittestbot.soot:soot-utbot-fork:${ sootVersion} " ) {
62
60
exclude group :' com.google.guava' , module :' guava'
63
61
}
You can’t perform that action at this time.
0 commit comments