Skip to content

Commit e93f76f

Browse files
committed
Make SpringNonNullSpeculator and SpringTypeReplacer actually call their delegates
1 parent 6a61824 commit e93f76f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringNonNullSpeculator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ class SpringNonNullSpeculator(
1212
private val springApplicationContext: SpringApplicationContext
1313
) : NonNullSpeculator {
1414
override fun speculativelyCannotProduceNullPointerException(field: SootField, classUnderTest: ClassId): Boolean =
15-
// TODO add ` || delegateNonNullSpeculator.speculativelyCannotProduceNullPointerException(field, classUnderTest)`
16-
// (TODO is added as a part of only equivalent transformations refactoring PR and should be completed in the follow up PR)
1715
field.fieldId in classUnderTest.allDeclaredFieldIds && field.type.classId !in springApplicationContext.allInjectedSuperTypes
18-
16+
|| delegateNonNullSpeculator.speculativelyCannotProduceNullPointerException(field, classUnderTest)
1917
}

utbot-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringTypeReplacer.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ class SpringTypeReplacer(
1313
private val springApplicationContext: SpringApplicationContext
1414
) : TypeReplacer {
1515
override val typeReplacementMode: TypeReplacementMode =
16-
// TODO add ` || delegateTypeReplacer.typeReplacementMode == TypeReplacementMode.KnownImplementor`
17-
// (TODO is added as a part of only equivalent transformations refactoring PR and should be completed in the follow up PR)
18-
if (springApplicationContext.beanDefinitions.isNotEmpty()) TypeReplacementMode.KnownImplementor
19-
else TypeReplacementMode.NoImplementors
16+
if (springApplicationContext.beanDefinitions.isNotEmpty() ||
17+
delegateTypeReplacer.typeReplacementMode == TypeReplacementMode.KnownImplementor)
18+
TypeReplacementMode.KnownImplementor
19+
else
20+
TypeReplacementMode.NoImplementors
2021

2122
override fun replaceTypeIfNeeded(type: RefType): ClassId? =
22-
// TODO add `delegateTypeReplacer.replaceTypeIfNeeded(type) ?: `
23-
// (TODO is added as a part of only equivalent transformations refactoring PR and should be completed in the follow up PR)
2423
if (type.isAbstractType) springApplicationContext.injectedTypes.singleOrNull { it.isSubtypeOf(type.id) }
25-
else null
24+
else delegateTypeReplacer.replaceTypeIfNeeded(type)
2625
}

0 commit comments

Comments
 (0)