-
Notifications
You must be signed in to change notification settings - Fork 46
Support hidden fields in code generation #763
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
Conversation
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
d832bd7
to
eaed6fa
Compare
178b6fd
to
630b3e5
Compare
Damtev
requested changes
Sep 1, 2022
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.
A problem with RequiresTypeCast?
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/CgStatementConstructor.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/CgStatementConstructor.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/CgStatementConstructor.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/CgStatementConstructor.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/CgStatementConstructor.kt
Outdated
Show resolved
Hide resolved
630b3e5
to
37ea66e
Compare
Damtev
requested changes
Sep 7, 2022
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
Show resolved
Hide resolved
37ea66e
to
caba5d1
Compare
Damtev
approved these changes
Sep 7, 2022
This was referenced Sep 7, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR fixes issue #646. Hidden fields have been supported in the engine by @volivan239 . This PR adds support for them on the code generation side.
Let's consider an example. We have
class A { int x; }
andclass B extends A { int x; }
. These fieldsx
have the same name, but they are different fields. Let's say we have a variable (of typeA
orB
) and we want to access fieldx
(from classA
orB
). There are 4 cases:A
accessingx
of typeA
. Here field can be accessed directly.A
accessingx
of typeB
. Here we need a cast to typeB
and then we are able to access the field.B
accessingx
of typeA
. Here we also need a cast, but to typeA
.B
accessingx
of typeB
. Here field can be accessed directly.This logic is now implemented in
CgCallableAccessManagerImpl
. This class checks if we can call a method with the given arguments and if we can access a field using the given object. Previously, there were no checks for fields, only for methods. Now we check field for accessibility. There are 3 cases:myObj.field
)((MyClass) myObj).field
)Type of Change
How Has This Been Tested?
Automated Testing
These tests check the hidden fields functionality.
org.utbot.examples.objects.HiddenFieldAccessModifiersTest
org.utbot.examples.objects.HiddenFieldExampleTest
Manual Scenario
TODO
Checklist (remove irrelevant options):