Skip to content

Commit 3be383d

Browse files
committed
A fix for potential performance problem
1 parent 481991f commit 3be383d

File tree

1 file changed

+6
-1
lines changed
  • utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import org.utbot.framework.plugin.api.TypeReplacementMode.*
6161
import org.utbot.framework.plugin.api.util.allDeclaredFieldIds
6262
import org.utbot.framework.plugin.api.util.fieldId
6363
import org.utbot.framework.plugin.api.util.isSubtypeOf
64+
import org.utbot.framework.plugin.api.util.objectClassId
6465
import org.utbot.framework.plugin.api.util.utContext
6566
import org.utbot.framework.process.OpenModulesContainer
6667
import soot.SootField
@@ -1200,7 +1201,6 @@ enum class TypeReplacementMode {
12001201
* @param mockFrameworkInstalled shows if we have installed framework dependencies
12011202
* @param staticsMockingIsConfigured shows if we have installed static mocking tools
12021203
*/
1203-
@Suppress("KDocUnresolvedReference")
12041204
open class ApplicationContext(
12051205
val mockFrameworkInstalled: Boolean = true,
12061206
staticsMockingIsConfigured: Boolean = true,
@@ -1278,6 +1278,11 @@ class SpringApplicationContext(
12781278
.map { fqn -> utContext.classLoader.loadClass(fqn) }
12791279
.filterNot { it.isAbstract || it.isInterface || it.isLocalClass || it.isMemberClass && !it.isStatic }
12801280
.mapTo(mutableSetOf()) { it.id }
1281+
1282+
// This is done to be sure that this storage is not empty after the first class loading iteration.
1283+
// So, even if all loaded classes were filtered out, we will not try to load them again.
1284+
// Having `Object` in a list of injected classes is harmless from the point of abstract types replacements.
1285+
springInjectedClassesStorage += objectClassId
12811286
}
12821287

12831288
return springInjectedClassesStorage

0 commit comments

Comments
 (0)