Skip to content

Initiate concrete execution if a wrapper method is missing #392

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 1 commit into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
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 @@ -10,6 +10,7 @@ import org.utbot.engine.overrides.collections.UtHashSet
import org.utbot.engine.overrides.collections.UtLinkedList
import org.utbot.engine.pc.UtAddrExpression
import org.utbot.engine.pc.UtExpression
import org.utbot.engine.pc.UtFalse
import org.utbot.engine.pc.select
import org.utbot.engine.symbolic.asHardConstraint
import org.utbot.engine.z3.intValue
Expand Down Expand Up @@ -84,10 +85,15 @@ abstract class BaseOverriddenWrapper(protected val overriddenClassName: String)

val overriddenMethod = overriddenClass.findMethodOrNull(method.subSignature)

val jimpleBody = overriddenMethod?.jimpleBody() ?: method.jimpleBody()
val graphResult = GraphResult(jimpleBody.graph())

return listOf(graphResult)
if (overriddenMethod == null) {
// No overridden method has been found, switch to concrete execution
pathLogger.warn("Method ${overriddenClass.name}::${method.subSignature} not found, executing concretely")
return emptyList()
} else {
val jimpleBody = overriddenMethod.jimpleBody()
val graphResult = GraphResult(jimpleBody.graph())
return listOf(graphResult)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3079,6 +3079,11 @@ class UtBotSymbolicEngine(

instanceAsWrapperOrNull?.run {
val results = invoke(instance as ObjectValue, invocation.method, invocation.parameters)
if (results.isEmpty()) {
// Drop the branch and switch to concrete execution
statesForConcreteExecution += environment.state
queuedSymbolicStateUpdates += UtFalse.asHardConstraint()
}
return OverrideResult(success = true, results)
}

Expand Down