Store the final status of fields in componentt#2976
Conversation
kroening
left a comment
There was a problem hiding this comment.
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.
So ... what would you recommend instead?
There was a problem hiding this comment.
FYI we already use (s|g)et_is_final for methods. So whatever we choose we should remain consistent.
5283c05 to
7592833
Compare
| else | ||
| component.set_access(ID_default); | ||
|
|
||
| component.set_is_final(f.is_final); |
There was a problem hiding this comment.
💡 If the class is opaque the is_final flag should be set to true.
There was a problem hiding this comment.
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. :) |
thk123
left a comment
There was a problem hiding this comment.
@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()); |
|
|
||
| class ClassWithFields { | ||
| final boolean final1 = true; | ||
| final Boolean final2 = false; |
There was a problem hiding this comment.
💡 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
allredj
left a comment
There was a problem hiding this comment.
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