Skip to content

Commit 6424db6

Browse files
committed
Review fixes
1 parent 05ce652 commit 6424db6

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/UtSettings.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,18 @@ object UtSettings : AbstractSettings(
382382
* and test generation.
383383
*/
384384
var useSandbox by getBooleanProperty(true)
385+
386+
/**
387+
* If this options set in true, all soot classes will be removed from a Soot Scene,
388+
* therefore, you will be unable to test soot classes.
389+
*/
390+
var removeSootClassesFromHierarchy by getBooleanProperty(true)
391+
392+
/**
393+
* If this options set in true, all soot classes will be removed from a Soot Scene,
394+
* therefore, you will be unable to test soot classes.
395+
*/
396+
var removeUtBotClassesFromHierarchy by getBooleanProperty(true)
385397
}
386398

387399
/**

utbot-framework/src/main/kotlin/org/utbot/engine/DataClasses.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ class TypeStorage private constructor(val leastCommonType: Type, val possibleCon
140140
): TypeStorage = TypeStorage(leastCommonType, possibleConcreteTypes)
141141

142142
/**
143-
* Constructs a type storage with some type. In this case [possibleConcreteTypes] might contains
144-
* abstract class or interface. Usually it means such typeStorage represents wrapper object type.
143+
* Constructs a type storage with some type. In this case [possibleConcreteTypes] might contain
144+
* an abstract class or an interface. Usually it means such typeStorage represents wrapper object type.
145145
*/
146146
fun constructTypeStorageWithSingleType(
147147
leastCommonType: Type

utbot-framework/src/main/kotlin/org/utbot/engine/Memory.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ data class Memory( // TODO: split purely symbolic memory and information about s
365365
*/
366366
class TypeRegistry {
367367
init {
368-
// TODO mistake
369368
// initializes type storage for OBJECT_TYPE from current scene
370369
objectTypeStorage = TypeStorage.constructTypeStorageUnsafe(
371370
OBJECT_TYPE,
@@ -616,10 +615,9 @@ class TypeRegistry {
616615
fun createClassRef(baseType: Type, numDimensions: Int = 0): MethodResult {
617616
val addr = classRefBiMap.getOrPut(baseType) { nextClassRefAddr() }
618617

619-
val objectTypeStorage = TypeStorage.constructTypeStorageWithSingleType(CLASS_REF_TYPE)
618+
val classRefTypeStorage = TypeStorage.constructTypeStorageWithSingleType(CLASS_REF_TYPE)
620619
val objectValue = ObjectValue(objectTypeStorage, addr)
621620

622-
val classRefTypeStorage = TypeStorage.constructTypeStorageWithSingleType(CLASS_REF_TYPE)
623621
val typeConstraint = typeConstraint(addr, classRefTypeStorage).all()
624622

625623
val typeId = mkInt(findTypeId(baseType))

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.utbot.framework.util
33
import org.utbot.common.FileUtil
44
import org.utbot.engine.jimpleBody
55
import org.utbot.engine.pureJavaSignature
6+
import org.utbot.framework.UtSettings
67
import org.utbot.framework.plugin.api.ExecutableId
78
import org.utbot.framework.plugin.services.JdkInfo
89
import soot.G
@@ -93,7 +94,7 @@ private fun initSoot(buildDirs: List<Path>, classpath: String?, jdkInfo: JdkInfo
9394
val isUtBotPackage = it.packageName.startsWith(UTBOT_PACKAGE_PREFIX)
9495

9596
// remove our own classes from the soot scene
96-
if (isUtBotPackage) {
97+
if (UtSettings.removeUtBotClassesFromHierarchy && isUtBotPackage) {
9798
val isOverriddenPackage = it.packageName.startsWith(UTBOT_OVERRIDDEN_PACKAGE_PREFIX)
9899
val isExamplesPackage = it.packageName.startsWith(UTBOT_EXAMPLES_PACKAGE_PREFIX)
99100
val isApiPackage = it.packageName.startsWith(UTBOT_API_PACKAGE_PREFIX)
@@ -106,7 +107,7 @@ private fun initSoot(buildDirs: List<Path>, classpath: String?, jdkInfo: JdkInfo
106107
}
107108

108109
// remove soot's classes from the scene, because we don't wont to analyze them
109-
if (it.packageName.startsWith(SOOT_PACKAGE_PREFIX)) {
110+
if (UtSettings.removeSootClassesFromHierarchy && it.packageName.startsWith(SOOT_PACKAGE_PREFIX)) {
110111
Scene.v().removeClass(it)
111112
return@forEach
112113
}

0 commit comments

Comments
 (0)