Skip to content

Commit d4bf5b4

Browse files
committed
Changed behavior according to review
1 parent 70b31dd commit d4bf5b4

File tree

1 file changed

+6
-8
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/engine

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,14 +2347,12 @@ class Traverser(
23472347
// better than engine.
23482348
val types = instanceOfConstraint?.typeStorage?.possibleConcreteTypes ?: instance.possibleConcreteTypes
23492349

2350-
val allConcreteInvocationTargets = findMethodInvocationTargets(types, methodSubSignature)
2351-
val libraryTargets = findLibraryTargets(instance.type, methodSubSignature)
2352-
2353-
// to choose only "good" targets take only library targets in case they present in all targets,
2354-
// otherwise take all targets
2355-
val methodInvocationTargets = libraryTargets?.takeIf {
2356-
allConcreteInvocationTargets.containsAll(it)
2357-
} ?: allConcreteInvocationTargets
2350+
val allPossibleConcreteTypes = typeRegistry.findInheritorsIncludingTypes(instance.type) { setOf(instance.type) }
2351+
2352+
val methodInvocationTargets = findLibraryTargets(instance.type, methodSubSignature)?.takeIf {
2353+
// we have no specified types, so we can take only library targets (if present) for optimization purposes
2354+
types.size == allPossibleConcreteTypes.size
2355+
} ?: findMethodInvocationTargets(types, methodSubSignature)
23582356

23592357
return methodInvocationTargets
23602358
.map { (method, implementationClass, possibleTypes) ->

0 commit comments

Comments
 (0)