Skip to content

Commit 4b9ca2d

Browse files
Avoid remembering and restoring enum constants #1397 #306 (#1416)
1 parent 57a7454 commit 4b9ca2d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

utbot-framework-test/src/test/kotlin/org/utbot/examples/enums/ComplexEnumExamplesTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.utbot.examples.enums
22

3+
import org.junit.jupiter.api.Disabled
34
import org.junit.jupiter.api.Test
45
import org.utbot.examples.enums.ComplexEnumExamples.Color
56
import org.utbot.examples.enums.ComplexEnumExamples.Color.BLUE
@@ -74,6 +75,7 @@ class ComplexEnumExamplesTest : UtValueTestCaseChecker(
7475
}
7576

7677
@Test
78+
@Disabled("TODO: nested anonymous classes are not supported: https://github.com/UnitTestBot/UTBotJava/issues/617")
7779
fun testFindState() {
7880
check(
7981
ComplexEnumExamples::findState,

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,12 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte
13611361
// TODO: remove this line when SAT-1273 is completed
13621362
execution.displayName = execution.displayName?.let { "${executableId.name}: $it" }
13631363
testMethod(testMethodName, execution.displayName) {
1364-
val statics = currentExecution!!.stateBefore.statics
1364+
//Enum constants are static, but there is no need to store and recover value for them
1365+
val statics = currentExecution!!.stateBefore
1366+
.statics
1367+
.filterNot { it.value is UtEnumConstantModel }
1368+
.filterNot { it.value.classId.outerClass?.isEnum == true }
1369+
13651370
rememberInitialStaticFields(statics)
13661371
val stateAnalyzer = ExecutionStateAnalyzer(execution)
13671372
val modificationInfo = stateAnalyzer.findModifiedFields()

0 commit comments

Comments
 (0)