Skip to content

Commit 68cbef1

Browse files
authored
Use ClassId in UtClassRefModel (#2314)
1 parent 6b40a44 commit 68cbef1

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ data class UtEnumConstantModel(
456456
data class UtClassRefModel(
457457
override val id: Int,
458458
override val classId: ClassId,
459-
val value: Class<*>
459+
val value: ClassId
460460
) : UtReferenceModel(id, classId) {
461461
// Model id is included for debugging purposes
462462
override fun toString(): String = "$value@$id"

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/constructor/ValueConstructor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class ValueConstructor {
187187
is UtNullModel -> UtConcreteValue(null, model.classId.jClass)
188188
is UtPrimitiveModel -> UtConcreteValue(model.value, model.classId.jClass)
189189
is UtEnumConstantModel -> UtConcreteValue(model.value)
190-
is UtClassRefModel -> UtConcreteValue(model.value)
190+
is UtClassRefModel -> UtConcreteValue(model.value.jClass)
191191
is UtCompositeModel -> UtConcreteValue(constructObject(model), model.classId.jClass)
192192
is UtArrayModel -> UtConcreteValue(constructArray(model))
193193
is UtAssembleModel -> UtConcreteValue(constructFromAssembleModel(model))

utbot-framework/src/main/kotlin/org/utbot/engine/Resolver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ class Resolver(
686686
val modeledNumDimensions = holder.eval(numDimensionsArray.select(addrExpression)).intValue()
687687

688688
val classRef = classRefByName(modeledType, modeledNumDimensions)
689-
val model = UtClassRefModel(addr, CLASS_REF_CLASS_ID, classRef)
689+
val model = UtClassRefModel(addr, CLASS_REF_CLASS_ID, classRef.id)
690690
addConstructedModel(addr, model)
691691

692692
return model

utbot-framework/src/main/kotlin/org/utbot/external/api/UtModelFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class UtModelFactory(
6969
fun produceClassRefModel(clazz: Class<*>) = UtClassRefModel(
7070
modelIdCounter.incrementAndGet(),
7171
classIdForType(clazz),
72-
clazz
72+
clazz.id
7373
)
7474
}
7575

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ open class CgVariableConstructor(val context: CgContext) :
467467
}
468468

469469
private fun constructClassRef(model: UtClassRefModel, baseName: String?): CgVariable {
470-
val classId = model.value.id
470+
val classId = model.value
471471
val init = if (classId.isAccessibleFrom(testClassPackageName)) {
472472
CgGetJavaClass(classId)
473473
} else {

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/instrumentation/execution/constructors/MockValueConstructor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class MockValueConstructor(
105105
is UtNullModel -> UtConcreteValue(null, model.classId.jClass)
106106
is UtPrimitiveModel -> UtConcreteValue(model.value, model.classId.jClass)
107107
is UtEnumConstantModel -> UtConcreteValue(constructEnum(model))
108-
is UtClassRefModel -> UtConcreteValue(model.value)
108+
is UtClassRefModel -> UtConcreteValue(model.value.jClass)
109109
is UtCompositeModel -> UtConcreteValue(constructObject(model), model.classId.jClass)
110110
is UtArrayModel -> UtConcreteValue(constructArray(model))
111111
is UtAssembleModel -> UtConcreteValue(constructFromAssembleModel(model), model.classId.jClass)

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/instrumentation/execution/constructors/UtModelConstructor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class UtModelConstructor(
252252

253253
private fun constructFromClass(clazz: Class<*>): UtModel =
254254
constructedObjects.getOrElse(clazz) {
255-
val utModel = UtClassRefModel(handleId(clazz), clazz::class.java.id, clazz)
255+
val utModel = UtClassRefModel(handleId(clazz), clazz::class.java.id, clazz.id)
256256
constructedObjects[clazz] = utModel
257257
utModel
258258
}

0 commit comments

Comments
 (0)