Skip to content

Commit 042d42c

Browse files
authored
Extract option values from forEach loop (#2565)
1 parent 638f803 commit 042d42c

File tree

1 file changed

+5
-2
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/framework/util

1 file changed

+5
-2
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/util/SootUtils.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@ private fun initSoot(buildDirs: List<Path>, classpath: String?, jdkInfo: JdkInfo
9696

9797
Scene.v().loadNecessaryClasses()
9898
PackManager.v().runPacks()
99+
// these options are moved out from forEach loop because they are slow due to rd communication
100+
val removeUtBotClassesFromHierarchy = UtSettings.removeUtBotClassesFromHierarchy
101+
val removeSootClassesFromHierarchy = UtSettings.removeSootClassesFromHierarchy
99102
// we need this to create hierarchy of classes
100103
Scene.v().classes.toList().forEach {
101104
val isUtBotPackage = it.packageName.startsWith(UTBOT_PACKAGE_PREFIX)
102105

103106
// remove our own classes from the soot scene
104-
if (UtSettings.removeUtBotClassesFromHierarchy && isUtBotPackage) {
107+
if (removeUtBotClassesFromHierarchy && isUtBotPackage) {
105108
val isOverriddenPackage = it.packageName.startsWith(UTBOT_OVERRIDDEN_PACKAGE_PREFIX)
106109
val isExamplesPackage = it.packageName.startsWith(UTBOT_EXAMPLES_PACKAGE_PREFIX)
107110
val isApiPackage = it.packageName.startsWith(UTBOT_API_PACKAGE_PREFIX)
@@ -115,7 +118,7 @@ private fun initSoot(buildDirs: List<Path>, classpath: String?, jdkInfo: JdkInfo
115118
}
116119

117120
// remove soot's classes from the scene, because we don't wont to analyze them
118-
if (UtSettings.removeSootClassesFromHierarchy && it.packageName.startsWith(SOOT_PACKAGE_PREFIX)) {
121+
if (removeSootClassesFromHierarchy && it.packageName.startsWith(SOOT_PACKAGE_PREFIX)) {
119122
Scene.v().removeClass(it)
120123
return@forEach
121124
}

0 commit comments

Comments
 (0)