Skip to content

Extract option values from forEach loop #2565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ private fun initSoot(buildDirs: List<Path>, classpath: String?, jdkInfo: JdkInfo

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

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

// remove soot's classes from the scene, because we don't wont to analyze them
if (UtSettings.removeSootClassesFromHierarchy && it.packageName.startsWith(SOOT_PACKAGE_PREFIX)) {
if (removeSootClassesFromHierarchy && it.packageName.startsWith(SOOT_PACKAGE_PREFIX)) {
Scene.v().removeClass(it)
return@forEach
}
Expand Down