diff --git a/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Descriptor2ValueConverter.kt b/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Descriptor2ValueConverter.kt index 0e942e889c..36002bab50 100644 --- a/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Descriptor2ValueConverter.kt +++ b/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Descriptor2ValueConverter.kt @@ -96,7 +96,7 @@ class Descriptor2ValueConverter(private val workerClassLoader: ClassLoader) { private fun `enum`(descriptor: UTestEnumValueDescriptor): Any { val klass = descriptor.type.toJavaClass(workerClassLoader) - val enumValue = klass.enumConstants.find { it.toString() == descriptor.enumValueName } + val enumValue = klass.enumConstants.find { (it as Enum<*>).name == descriptor.enumValueName } ?: error("Can't build descriptor for enum") for ((jcField, jcFieldDescr) in descriptor.fields) { val jField = jcField.toJavaField(workerClassLoader) ?: continue diff --git a/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Value2DescriptorConverter.kt b/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Value2DescriptorConverter.kt index e87b52c9ee..9c3e3e3e1e 100644 --- a/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Value2DescriptorConverter.kt +++ b/usvm-jvm-instrumentation/src/main/kotlin/org/usvm/instrumentation/testcase/descriptor/Value2DescriptorConverter.kt @@ -258,11 +258,11 @@ open class Value2DescriptorConverter( ) } - private fun `enum`(value: Any, depth: Int): UTestEnumValueDescriptor { + private fun `enum`(value: Enum<*>, depth: Int): UTestEnumValueDescriptor { val enumValueJcClass = jcClasspath.findClass(value::class.java.name) val jcClass = if (!enumValueJcClass.isEnum) enumValueJcClass.superClass!! else enumValueJcClass val fields = mutableMapOf() - val enumValueName = value.toString() + val enumValueName = value.name val jcType = jcClass.toType() val uTestEnumValueDescriptor = UTestEnumValueDescriptor(jcType, enumValueName, fields, System.identityHashCode(value))