Fix wrapper concrete types#964
Conversation
CaelmBleidd
left a comment
There was a problem hiding this comment.
I have many questions about types choice, I think we need additional documentation or explanations in the code, why it is done this way
dtim
left a comment
There was a problem hiding this comment.
I don't fully understand the logic, and have several concerns about the selection of types. It would be nice to discuss your PR in more details.
| } | ||
|
|
||
| override fun getPotentialPossibleTypes(type: Type): Set<Type> = | ||
| setOf(Scene.v().getSootClass(chooseClassIdWithConstructor(type.classId).canonicalName).type) |
There was a problem hiding this comment.
I suppose that this code can return not only concrete classes but interfaces as well. It seems that it may be a bit dangerous. What do you think?
There was a problem hiding this comment.
Are you sure? chooseClassIdWithConstructor must return class with callable constructor (I suppose) that we use for creation assemble model.
1f3de41 to
c390666
Compare
CaelmBleidd
left a comment
There was a problem hiding this comment.
TBH, I don't have an opinion about this request. Probably, we should discuss it in person before merging
| val possibleObjectTypes = Scene.v().classes.map { it.type } | ||
| return possibleObjectTypes.mapTo(mutableSetOf()) { | ||
| it.arrayType | ||
| } |
There was a problem hiding this comment.
Now it contains all the types, including interfaces, abstract classes, artificial entities, our own classes, etc.
Description
The problem was in wrappers instantiation. Initialized concrete types were incorrect. I've provided method for wrappers witch returns set of possible types in resolving. Now all of set's sizes equals 1.
Fixes #957
Type of Change
How Has This Been Tested?
Automated Testing
org.utbot.examples.casts.InstanceOfExampleTest
Manual Scenario
Described in issue #957
Checklist: