@@ -89,9 +89,31 @@ private fun initSoot(buildDirs: List<Path>, classpath: String?, jdkInfo: JdkInfo
8989 Scene .v().loadNecessaryClasses()
9090 PackManager .v().runPacks()
9191 // we need this to create hierarchy of classes
92- Scene .v().classes.forEach {
93- if (it.resolvingLevel() < SootClass .HIERARCHY )
92+ Scene .v().classes.toList().forEach {
93+ val isUtBotPackage = it.packageName.startsWith(UTBOT_PACKAGE_PREFIX )
94+
95+ // remove our own classes from the soot scene
96+ if (isUtBotPackage) {
97+ val isOverriddenPackage = it.packageName.startsWith(UTBOT_OVERRIDDEN_PACKAGE_PREFIX )
98+ val isExamplesPackage = it.packageName.startsWith(UTBOT_EXAMPLES_PACKAGE_PREFIX )
99+ val isApiPackage = it.packageName.startsWith(UTBOT_API_PACKAGE_PREFIX )
100+
101+ // remove if it is not a part of the examples (CUT), not a part of our API and not an override
102+ if (! isOverriddenPackage && ! isExamplesPackage && ! isApiPackage) {
103+ Scene .v().removeClass(it)
104+ return @forEach
105+ }
106+ }
107+
108+ // remove soot's classes from the scene, because we don't wont to analyze them
109+ if (it.packageName.startsWith(SOOT_PACKAGE_PREFIX )) {
110+ Scene .v().removeClass(it)
111+ return @forEach
112+ }
113+
114+ if (it.resolvingLevel() < SootClass .HIERARCHY ) {
94115 it.setResolvingLevel(SootClass .HIERARCHY )
116+ }
95117 }
96118}
97119
@@ -171,4 +193,10 @@ private val classesToLoad = arrayOf(
171193 org.utbot.engine.overrides.stream.IntStream ::class ,
172194 org.utbot.engine.overrides.stream.LongStream ::class ,
173195 org.utbot.engine.overrides.stream.DoubleStream ::class ,
174- ).map { it.java }.toTypedArray()
196+ ).map { it.java }.toTypedArray()
197+
198+ private const val UTBOT_PACKAGE_PREFIX = " org.utbot"
199+ private const val UTBOT_EXAMPLES_PACKAGE_PREFIX = " $UTBOT_PACKAGE_PREFIX .examples"
200+ private const val UTBOT_API_PACKAGE_PREFIX = " $UTBOT_PACKAGE_PREFIX .api"
201+ private const val UTBOT_OVERRIDDEN_PACKAGE_PREFIX = " $UTBOT_PACKAGE_PREFIX .engine.overrides"
202+ private const val SOOT_PACKAGE_PREFIX = " soot."
0 commit comments