-
Notifications
You must be signed in to change notification settings - Fork 47
Initial implementations of the adapter from JcExecution to UtExecution #2677
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
EgorkaKulikov
merged 31 commits into
usvm_competitions_2024
from
egor/jc_to_ut_models_converter
Nov 9, 2023
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
6d4f05c
Some awful attempts
EgorkaKulikov 4aa8a10
Initially implemented a converter of UTestInst to UtModel
EgorkaKulikov ddcf870
Refactor JcToUtModelConverter basing on UTestInst2UtModel converter
EgorkaKulikov 9532b8a
Some steps to implement JcToUtExecutionConverter
EgorkaKulikov d79ea8b
Implement minimalistic jc to ut execution conversion, enable codegen
IlyaMuravjov 8e30b30
Some improvements
EgorkaKulikov 5935d7b
DeepMapper for models is used
EgorkaKulikov 535abb0
Corrections
EgorkaKulikov 509cb73
Some improvements to JcToUtModelConverter
EgorkaKulikov 21bde03
Further improvements to JcToUtModelConverter
EgorkaKulikov 6471f07
Another converter little improvement
EgorkaKulikov c14067f
Improve `UtExecutionFailure` creation
IlyaMuravjov 20967a9
Finish implementing `JcToUtModelConverter`
IlyaMuravjov bf6d497
Refactor nullability in `JcToUtModelConverter` and `JcToUtExecutionCo…
IlyaMuravjov 1a893ad
First version of JC to UT converters without overusing `Descriptor2Va…
IlyaMuravjov 1717235
Processed forgotten call method expression
EgorkaKulikov f2debe4
Make conversion more class-friendly (do not fail if one method cause …
EgorkaKulikov c191ed3
Make it possible to use samples in ContestEstimator
EgorkaKulikov e61cef4
Tested on all primitives
EgorkaKulikov bb82a6b
contrflow tests added
EgorkaKulikov 13ee51e
More test classes added
EgorkaKulikov b01d6b3
Add `build/output/test/samples` to `utbot-junit-contest` test projects
IlyaMuravjov 61c1608
Steps to avoid duplicating statements
EgorkaKulikov f455f99
Merge remote-tracking branch 'origin/egor/jc_to_ut_models_converter' …
EgorkaKulikov a31d6b1
Make it working correct on IntExamples.max
EgorkaKulikov 98b4398
Remove OptimizeImportsProcessor (seems it was not called, but a sourc…
EgorkaKulikov 0ca848a
Process UTestStaticMethodCall
EgorkaKulikov 9442c72
Comment out includes for IDE related projects in `settings.gradle.kts`
IlyaMuravjov f37c1eb
Avoid using burningwave to export modules on Java 8
IlyaMuravjov cea02dd
Fix review comments
EgorkaKulikov 813c2d6
Fix review comments
EgorkaKulikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/ConverterUtils.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.utbot.contest.usvm | ||
|
||
import org.jacodb.analysis.library.analyzers.thisInstance | ||
import org.jacodb.api.JcClassOrInterface | ||
import org.jacodb.api.JcField | ||
import org.jacodb.api.JcMethod | ||
import org.jacodb.api.JcType | ||
import org.jacodb.api.TypeName | ||
import org.usvm.instrumentation.testcase.api.UTestInst | ||
import org.usvm.instrumentation.testcase.descriptor.UTestObjectDescriptor | ||
import org.usvm.instrumentation.testcase.descriptor.UTestValueDescriptor | ||
import org.usvm.instrumentation.util.toJavaClass | ||
import org.usvm.instrumentation.util.toJavaField | ||
import org.utbot.framework.plugin.api.ClassId | ||
import org.utbot.framework.plugin.api.ConstructorId | ||
import org.utbot.framework.plugin.api.ExecutableId | ||
import org.utbot.framework.plugin.api.FieldId | ||
import org.utbot.framework.plugin.api.MethodId | ||
import org.utbot.framework.plugin.api.util.fieldId | ||
import org.utbot.framework.plugin.api.util.id | ||
import org.utbot.framework.plugin.api.util.objectClassId | ||
import org.utbot.framework.plugin.api.util.utContext | ||
|
||
fun JcMethod.toExecutableId(): ExecutableId { | ||
val type = this.thisInstance.type.classId | ||
val parameters = this.parameters.map { it.type.classId } | ||
|
||
if (isConstructor) { | ||
return ConstructorId(type, parameters) | ||
} | ||
|
||
return MethodId(type, this.name, this.returnType.classId, parameters) | ||
} | ||
|
||
val JcType?.classId: ClassId | ||
get() = this?.toJavaClass(utContext.classLoader)?.id | ||
?: error("Can not construct classId for $this") | ||
|
||
val JcClassOrInterface.classId: ClassId | ||
get() = this.toJavaClass(utContext.classLoader).id | ||
|
||
//TODO usvm-sbft: incorrectly converts types of com.google.common.util.concurrent.AtomicDoubleArray.<init> parameters | ||
val TypeName.classId: ClassId | ||
get() = ClassId(this.typeName) | ||
|
||
val JcField.fieldId: FieldId | ||
get() = toJavaField(utContext.classLoader)!!.fieldId | ||
|
||
val UTestValueDescriptor.origin: UTestInst? | ||
get() = (this as? UTestObjectDescriptor)?.originUTestExpr |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least add
TODO usvm-sbft: incorrectly converts types of com.google.common.util.concurrent.AtomicDoubleArray.<init> parameters