Skip to content

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

Merged
merged 2 commits into from
Sep 21, 2018

Conversation

thomasspriggs
Copy link
Contributor

@thomasspriggs thomasspriggs commented Sep 18, 2018

Store the final status of fields in componentt

  • Each commit message has a non-empty body, explaining why the change was made.
  • My contribution is formatted in line with CODING_STANDARD.md.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Member

@kroening kroening left a 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)
Copy link
Contributor

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.

Copy link
Collaborator

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about set_final?

Copy link
Contributor

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.

@@ -753,6 +753,8 @@ void java_bytecode_convert_classt::convert(
else
component.set_access(ID_default);

component.set_is_final(f.is_final);
Copy link
Contributor

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.

Copy link
Contributor

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.

@tautschnig
Copy link
Collaborator

@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.

@thomasspriggs
Copy link
Contributor Author

@tautschnig Yes, I just raised this PR, there was a template added and I deleted it.

@thomasspriggs
Copy link
Contributor Author

@kroening I have added the unit test to the makefile, please re-review.

@tautschnig
Copy link
Collaborator

[...] there was a template added and I deleted it.

Which part of the template suggested that it can safely be deleted?

@thomasspriggs
Copy link
Contributor Author

@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. :)

Copy link
Contributor

@thk123 thk123 left a 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());
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Contributor

@allredj allredj left a 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

@tautschnig
Copy link
Collaborator

@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.

I have taken the liberty to just copy&paste from .github/pull_request_template.md (the template got added via PR #2973).

@thk123 thk123 merged commit 3e95498 into diffblue:develop Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants