Skip to content

Commit 7850497

Browse files
Fix: review comments
1 parent aeec709 commit 7850497

File tree

14 files changed

+22
-21
lines changed

14 files changed

+22
-21
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
@@ -473,7 +473,7 @@ data class UtArrayModel(
473473
*
474474
* The default constructor is made private to enforce using a safe constructor.
475475
*
476-
* @param instantiationCall is an [UtExecutableCallModel] to instantiate represented object.
476+
* @param instantiationCall is an [UtExecutableCallModel] to instantiate represented object. It **must** not return `null`.
477477
* @param modificationsChain is a chain of [UtStatementModel] to construct object state.
478478
*/
479479
data class UtAssembleModel private constructor(

utbot-framework-test/src/test/kotlin/org/utbot/examples/codegen/deepequals/ClassWithCrossReferenceRelationshipTest.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package org.utbot.examples.codegen.deepequals
22

3-
import org.junit.jupiter.api.Disabled
43
import org.junit.jupiter.api.Test
5-
import org.utbot.tests.infrastructure.DoNotCalculate
6-
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
74
import org.utbot.framework.plugin.api.CodegenLanguage
85
import org.utbot.testcheckers.eq
96
import org.utbot.tests.infrastructure.CodeGeneration
7+
import org.utbot.tests.infrastructure.DoNotCalculate
8+
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
109

1110
class ClassWithCrossReferenceRelationshipTest : UtValueTestCaseChecker(
1211
testClass = ClassWithCrossReferenceRelationship::class,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ data class ThrowableWrapper(val throwable: Throwable) : WrapperInterface {
242242
val modelName = nextModelName(throwable.javaClass.simpleName.decapitalize())
243243

244244
val instantiationCall = when (val message = throwable.message) {
245-
null -> UtExecutableCallModel(null, constructorId(classId), emptyList())
245+
null -> UtExecutableCallModel(instance = null, constructorId(classId), emptyList())
246246
else -> UtExecutableCallModel(
247-
null,
247+
instance = null,
248248
constructorId(classId, stringClassId),
249249
listOf(UtPrimitiveModel(message))
250250
)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ class OptionalWrapper(private val utOptionalClass: UtOptionalClass) : BaseOverri
106106
}
107107
return if (!isPresent) {
108108
UtExecutableCallModel(
109-
null, MethodId(
109+
instance = null,
110+
MethodId(
110111
classId,
111112
"empty",
112113
classId,
@@ -115,7 +116,8 @@ class OptionalWrapper(private val utOptionalClass: UtOptionalClass) : BaseOverri
115116
)
116117
} else {
117118
UtExecutableCallModel(
118-
null, MethodId(
119+
instance = null,
120+
MethodId(
119121
classId,
120122
"of",
121123
classId,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ class Resolver(
550550
val baseModelName = primitiveClassId.name
551551
val constructorId = constructorId(classId, primitiveClassId)
552552
val valueModel = fields[FieldId(classId, "value")] ?: primitiveClassId.defaultValueModel()
553-
val instantiationCall = UtExecutableCallModel(null, constructorId, listOf(valueModel))
553+
val instantiationCall = UtExecutableCallModel(instance = null, constructorId, listOf(valueModel))
554554
UtAssembleModel(addr, classId, nextModelName(baseModelName), instantiationCall)
555555
}
556556
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SecurityManagerWrapper : BaseOverriddenWrapper(utSecurityManagerClass.name
2929
val modelName = nextModelName(baseModelName)
3030

3131
val instantiationCall = UtExecutableCallModel(
32-
null,
32+
instance = null,
3333
System::getSecurityManager.executableId,
3434
emptyList()
3535
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,12 @@ sealed class UtAbstractStringBuilderWrapper(className: String) : BaseOverriddenW
329329
val charValues = CharArray(length) { (values.stores[it] as UtPrimitiveModel).value as Char }
330330
val stringModel = UtPrimitiveModel(String(charValues))
331331
val constructorId = constructorId(wrapper.type.classId, STRING_TYPE.classId)
332-
val instantiationChain = UtExecutableCallModel(
332+
val instantiationCall = UtExecutableCallModel(
333333
instance = null,
334334
constructorId,
335335
listOf(stringModel)
336336
)
337-
return UtAssembleModel(addr, wrapper.type.classId, modelName, instantiationChain)
337+
return UtAssembleModel(addr, wrapper.type.classId, modelName, instantiationCall)
338338
}
339339

340340
private val SootClass.valueField: SootField

utbot-framework/src/main/kotlin/org/utbot/framework/assemble/AssembleModelGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class AssembleModelGenerator(private val methodPackageName: String) {
291291
modelBefore.modelName,
292292
assembleExecutableCallModel(modelBefore.instantiationCall),
293293
modelBefore.origin
294-
).apply {
294+
) {
295295
instantiatedModels[modelBefore] = this
296296
modelBefore.modificationsChain.map { assembleStatementModel(it) }
297297
}
@@ -361,7 +361,7 @@ class AssembleModelGenerator(private val methodPackageName: String) {
361361
assembleModel(fieldModel)
362362
}
363363

364-
return UtExecutableCallModel(null, constructorInfo.constructorId, constructorParams)
364+
return UtExecutableCallModel(instance = null, constructorInfo.constructorId, constructorParams)
365365
}
366366

367367
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ internal class CgVariableConstructor(val context: CgContext) :
201201
}
202202

203203
private fun constructAssemble(model: UtAssembleModel, baseName: String?): CgValue {
204-
val instantiationExecutableCall = model.instantiationCall
205-
processInstantiationStatement(model, instantiationExecutableCall, baseName)
204+
val instantiationCall = model.instantiationCall
205+
processInstantiationStatement(model, instantiationCall, baseName)
206206

207207
for (statementModel in model.modificationsChain) {
208208
when (statementModel) {

utbot-framework/src/main/kotlin/org/utbot/framework/concrete/IterableConstructors.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class CollectionConstructor : UtAssembleModelConstructorBase() {
1919
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
2020
value as java.util.Collection<*>
2121

22-
// If [valueToConstructFrom] constructed incorrectly (some inner transient fields are null, etc.) this may fail.
22+
// If [value] constructed incorrectly (some inner transient fields are null, etc.) this may fail.
2323
// This value will be constructed as UtCompositeModel.
2424
val models = value.map { internalConstructor.construct(it, valueToClassId(it)) }
2525

utbot-framework/src/main/kotlin/org/utbot/framework/concrete/PrimitiveWrapperConstructor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class PrimitiveWrapperConstructor : UtAssembleModelConstructorBase() {
1919
checkClassCast(classId.jClass, value::class.java)
2020

2121
return UtExecutableCallModel(
22-
null,
22+
instance = null,
2323
constructorId(classId, classId.unbox()),
2424
listOf(UtPrimitiveModel(value))
2525
)

utbot-framework/src/main/kotlin/org/utbot/fuzzer/FallbackModelProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ open class FallbackModelProvider(
9898
id = idGenerator.createId(),
9999
kclass.id,
100100
kclass.id.toString(),
101-
UtExecutableCallModel(null, defaultConstructor.executableId, listOf())
101+
UtExecutableCallModel(instance = null, defaultConstructor.executableId, listOf())
102102
)
103103
}
104104
else -> {

utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/objects/AssembleModelUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fun ModelProvider.assembleModel(id: Int, constructorId: ConstructorId, params: L
1515
id,
1616
constructorId.classId,
1717
"${constructorId.classId.name}${constructorId.parameters}#" + id.hex(),
18-
UtExecutableCallModel(null, constructorId, params.map { it.model })
18+
UtExecutableCallModel(instance = null, constructorId, params.map { it.model })
1919
).fuzzed {
2020
summary = "%var% = ${constructorId.classId.simpleName}(${constructorId.parameters.joinToString { it.simpleName }})"
2121
}

utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/providers/CollectionModelProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class CollectionModelProvider(
9292
private fun Class<*>.methodCall(methodName: String, returnType: Class<*>, params: List<Class<*>> = emptyList()) = MethodId(id, methodName, returnType.id, params.map { it.id })
9393

9494
private fun Class<*>.createdBy(init: ExecutableId, params: List<UtModel> = emptyList()): UtAssembleModel {
95-
val instantiationCall = UtExecutableCallModel(null, init, params)
95+
val instantiationCall = UtExecutableCallModel(instance = null, init, params)
9696
val genId = idGenerator.createId()
9797
return UtAssembleModel(
9898
genId,

0 commit comments

Comments
 (0)