Skip to content

Commit ccd3f20

Browse files
committed
Make naming of SpringApplicationContext properties more consistent
1 parent b801da6 commit ccd3f20

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ interface SpringApplicationContext : ApplicationContext, SpringCodeGenerationCon
1616
* Describes bean definitions (bean name, type, some optional additional data)
1717
*/
1818
val beanDefinitions: List<BeanDefinitionData>
19-
val springInjectedClasses: Set<ClassId>
20-
val allInjectedTypes: Set<ClassId>
19+
val injectedTypes: Set<ClassId>
20+
val allInjectedSuperTypes: Set<ClassId>
2121

2222
override var springContextLoadingResult: SpringContextLoadingResult?
2323
fun getBeansAssignableTo(classId: ClassId): List<BeanDefinitionData>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import org.utbot.framework.plugin.api.ClassId
1212
import org.utbot.framework.plugin.api.SpringContextLoadingResult
1313
import org.utbot.framework.plugin.api.SpringSettings
1414
import org.utbot.framework.plugin.api.SpringTestType
15-
import org.utbot.framework.plugin.api.UtError
1615
import org.utbot.framework.plugin.api.util.allSuperTypes
1716
import org.utbot.framework.plugin.api.util.id
1817
import org.utbot.framework.plugin.api.util.jClass
@@ -50,7 +49,7 @@ class SpringApplicationContextImpl(
5049
}
5150

5251
// Classes representing concrete types that are actually used in Spring application
53-
override val springInjectedClasses: Set<ClassId>
52+
override val injectedTypes: Set<ClassId>
5453
get() {
5554
if (!areAllInjectedSuperTypesInitialized) {
5655
for (beanTypeName in beanDefinitions.map { it.beanTypeName }) {
@@ -80,10 +79,10 @@ class SpringApplicationContextImpl(
8079
return _injectedTypes
8180
}
8281

83-
override val allInjectedTypes: Set<ClassId>
82+
override val allInjectedSuperTypes: Set<ClassId>
8483
get() {
8584
if (!areInjectedTypesInitialized) {
86-
_allInjectedSuperTypes = springInjectedClasses.flatMap { it.allSuperTypes() }.toSet()
85+
_allInjectedSuperTypes = injectedTypes.flatMap { it.allSuperTypes() }.toSet()
8786
areInjectedTypesInitialized = true
8887
}
8988

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class SpringNonNullSpeculator(
1414
override fun speculativelyCannotProduceNullPointerException(field: SootField, classUnderTest: ClassId): Boolean =
1515
// TODO add ` || delegateNonNullSpeculator.speculativelyCannotProduceNullPointerException(field, classUnderTest)`
1616
// (TODO is added as a part of only equivalent transformations refactoring PR and should be completed in the follow up PR)
17-
field.fieldId in classUnderTest.allDeclaredFieldIds && field.type.classId !in springApplicationContext.allInjectedTypes
17+
field.fieldId in classUnderTest.allDeclaredFieldIds && field.type.classId !in springApplicationContext.allInjectedSuperTypes
1818

1919
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class SpringTypeReplacer(
2121
override fun replaceTypeIfNeeded(type: RefType): ClassId? =
2222
// TODO add `delegateTypeReplacer.replaceTypeIfNeeded(type) ?: `
2323
// (TODO is added as a part of only equivalent transformations refactoring PR and should be completed in the follow up PR)
24-
if (type.isAbstractType) springApplicationContext.springInjectedClasses.singleOrNull { it.isSubtypeOf(type.id) }
24+
if (type.isAbstractType) springApplicationContext.injectedTypes.singleOrNull { it.isSubtypeOf(type.id) }
2525
else null
2626
}

0 commit comments

Comments
 (0)