Skip to content

Commit 20da923

Browse files
committed
Correct a check for models in packages
1 parent bb27aeb commit 20da923

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ class AssembleModelGenerator(private val packageName: String) {
100100
* Note: Two identity equal [UtModel]s are represented by one instance model.
101101
*/
102102
fun createAssembleModels(models: List<UtModel>): IdentityHashMap<UtModel, UtModel> {
103-
val allModelsAreLocatedInPackage = models.all { it.classId.packageName.startsWith(packageName)}
104-
if (!UtSettings.useAssembleModelGenerator || !allModelsAreLocatedInPackage) {
103+
if (!UtSettings.useAssembleModelGenerator) {
105104
return IdentityHashMap<UtModel, UtModel>().apply { models.forEach { put(it, it) } }
106105
}
107106

@@ -172,7 +171,13 @@ class AssembleModelGenerator(private val packageName: String) {
172171
private fun assembleModel(utModel: UtModel): UtModel {
173172
val collectedCallChain = callChain.toMutableList()
174173

175-
// we cannot create an assemble model for an anonymous class instance
174+
// We cannot create an assemble model for a class located out of
175+
// the package that generator is instantiated for
176+
if (utModel.classId.packageName.startsWith(packageName)) {
177+
return utModel
178+
}
179+
180+
// We cannot create an assemble model for an anonymous class instance
176181
if (utModel.classId.isAnonymous) {
177182
return utModel
178183
}

0 commit comments

Comments
 (0)