Skip to content

Add getter/setter for ID_enumeration in java_class_typet #4572

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

jeannielynnmoulton
Copy link
Contributor

Adding getter/setter to avoid direct irept access

  • [ x] Each commit message has a non-empty body, explaining why the change was made.
  • [x ] Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • 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).
  • [ x] My PR is restricted to a single feature or bugfix.
  • [ x] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Adding getter/setter to avoid direct irept access
@kroening
Copy link
Member

Assuming that this is to determine that a class is an enum type, why not simply check that the base is java.lang.enum?

@jeannielynnmoulton
Copy link
Contributor Author

This is very much possible. There are a few places where we check get_bool(ID_enumeration) from a typet, so I thought that it might be more elegant to have the solution here than to check the base each time (or create a function outside of JBMC that does it)

@antlechner
Copy link
Contributor

antlechner commented Apr 26, 2019

@jeannielynnmoulton Some of those checks might have been added by me. I actually started with checks for "is the base java.lang.Enum" and at some point it was requested in a review to check the ID_enumeration instead, but I don't know if one way would really be better than the other.

Copy link
Contributor

@thomasspriggs thomasspriggs left a comment

Choose a reason for hiding this comment

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

👍 An improvement. It would be nice if we had a catch test that checked the flag is set properly in the parsing and class conversion.

@jeannielynnmoulton jeannielynnmoulton merged commit 176c960 into diffblue:develop Apr 26, 2019
@jeannielynnmoulton jeannielynnmoulton deleted the jeannie/java_is_enumeration branch April 26, 2019 15:38
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.

5 participants