-
Notifications
You must be signed in to change notification settings - Fork 274
Store the final status of fields in componentt
#2976
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
Conversation
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.
The test needs to be added to the Makefile.
return get_bool(ID_final); | ||
} | ||
|
||
void set_is_final(const bool is_final) |
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.
The name makes me cry.
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.
So ... what would you recommend instead?
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.
How about set_final
?
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.
FYI we already use (s|g)et_is_final
for methods. So whatever we choose we should remain consistent.
5283c05
to
7592833
Compare
@@ -753,6 +753,8 @@ void java_bytecode_convert_classt::convert( | |||
else | |||
component.set_access(ID_default); | |||
|
|||
component.set_is_final(f.is_final); |
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.
💡 If the class is opaque the is_final
flag should be set to true.
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.
After discussion with @thomasspriggs, we worked out that dealing with fields of opaque classes may not be as straightforward than I thought. So my comment can be ignored.
@thomasspriggs Asking for debugging reasons: It seems the PR comment is missing the bits of information that .github/pull_request_template.md should have added. Were those not presented to you when creating the PR, or did you just create this PR quite a while ago? It seemed to work in #2975. |
@tautschnig Yes, I just raised this PR, there was a template added and I deleted it. |
7592833
to
5874f53
Compare
@kroening I have added the unit test to the makefile, please re-review. |
Which part of the template suggested that it can safely be deleted? |
@tautschnig It superficially appeared to be standard operating procedures for working on a PR, rather than something which needed to be filled out and left in a PR description. I assumed that if it couldn't be safely deleted someone would complain. :) |
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.
@tautschnig The addition of the template was not communicated to me so sorry about that
@thomasspriggs suggest opening a new PR to copy the template in and add to this PR.
REQUIRE(java_class.get_component("final1").get_is_final()); | ||
REQUIRE(java_class.get_component("final2").get_is_final()); | ||
REQUIRE(java_class.get_component("final3").get_is_final()); | ||
REQUIRE(!java_class.get_component("nonFinal1").get_is_final()); |
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.
⛏️ Prefer REQUIRE_FALSE
|
||
class ClassWithFields { | ||
final boolean final1 = true; | ||
final Boolean final2 = false; |
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.
💡 I'd have probably picked different accessibility and/or different ways of setting them (i.e. in the constructor). You might also like to add tests for fields that hide inherited fields
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.
Passed Diffblue compatibility checks (cbmc commit: 5874f53).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85166768
I have taken the liberty to just copy&paste from .github/pull_request_template.md (the template got added via PR #2973). |
Store the final status of fields in
componentt