Skip to content

Commit 8e65334

Browse files
committed
Visualization refactorings
1 parent 816e736 commit 8e65334

File tree

3 files changed

+155
-113
lines changed

3 files changed

+155
-113
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ val SootClass.isUtMock: Boolean
429429
val SootClass.isOverridden: Boolean
430430
get() = packageName.startsWith(UTBOT_OVERRIDE_PACKAGE_NAME)
431431

432+
val SootClass.isLibraryNonOverriddenClass: Boolean
433+
get() = isLibraryClass && !isOverridden
434+
432435
/**
433436
* Returns a state from the list that has [UtSolverStatusSAT] status.
434437
* Inside it calls UtSolver.check if required.

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
3939
private val edgesCache = mutableMapOf<ExceptionalUnitGraph, List<Edge>>()
4040

4141
val stmts: MutableSet<Stmt> = graph.stmts.toMutableSet()
42-
val registeredEdges: MutableSet<Edge> = graph.edges.toMutableSet()
42+
private val registeredEdges: MutableSet<Edge> = graph.edges.toMutableSet()
4343
// this field is required for visualization
44-
val allEdges: MutableSet<Edge> = graph.edges.toMutableSet()
44+
private val allExplicitEdges: MutableSet<Edge> = graph.edges.toMutableSet()
45+
46+
val allEdges: Set<Edge> get() = allExplicitEdges + implicitEdges
47+
4548
/**
4649
* Used in [org.utbot.engine.selectors.nurs.InheritorsSelector] for a fast search of Virtual invoke successors.
4750
*/
@@ -128,11 +131,9 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
128131
outgoingEdgesCount += graph.outgoingEdgesCount
129132
stmts += joinedStmts
130133

131-
allEdges += graph.edges
134+
allExplicitEdges += graph.edges
132135
allEdgesCount += graph.outgoingEdgesCount
133-
allEdgesCount.computeIfPresent(stmt) { _, value ->
134-
value + 1
135-
}
136+
allEdgesCount.computeIfPresent(stmt) { _, value -> value + 1 }
136137

137138
if (registerEdges) {
138139
registeredMethods += method
@@ -153,7 +154,7 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
153154
}
154155

155156
registeredEdges += invokeEdge
156-
allEdges += invokeEdge
157+
allExplicitEdges += invokeEdge
157158

158159
outgoingEdgesCount.computeIfPresent(stmt) { _, value ->
159160
value + 1
@@ -207,7 +208,7 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
207208
}
208209

209210
// We don't want to cover all the exceptions in not overridden library classes
210-
if (declaringClass.isLibraryClass && !declaringClass.isOverridden) {
211+
if (declaringClass.isLibraryNonOverriddenClass) {
211212
return emptySet()
212213
}
213214

@@ -257,6 +258,7 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
257258
/**
258259
* attach new statistics to graph before any modifying operations
259260
*/
261+
@Suppress("UNREACHABLE_CODE")
260262
fun attach(statistics: TraverseGraphStatistics) {
261263
if (!attachAllowed) {
262264
throw error("Cannot attach new statistics. Graph have modified.")

0 commit comments

Comments
 (0)