Skip to content

Java frontend: get qualified generic types of static fields #4137

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

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Feb 8, 2019

Before it would unintentionally erase SomeClass.field from A<B> to just the unqualified A type.

Needs tests adding, of course.

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: 81b3148).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100277615

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.

As you say - this of course needs a test

const symbol_exprt symbol_expr(
get_static_field(arg0.get_string(ID_class), field_name), arg0.type());

INVARIANT(
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ This looks like useful context for this symbol not existing that goes away by folding it into lookup_ref - do you disagree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems pointless to have an invariant that can never fail, and I think a symbol table lookup returning a reference is widely recognised as find-or-die?

Copy link
Contributor

Choose a reason for hiding this comment

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

My point is "getstatic symbol should have been created before method conversion" is more useful than simply a symbol not existing. Like without that message you might (wrongly) conclude that this conversion should actually be adding to the symbol table

I'm suggesting the invariant goes about the call to lookup_ref in case that wasn't clear. Like,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a clarifying comment

Before it would unintentionally erase SomeClass.field from A<B> to just the unqualified A type.
@smowton
Copy link
Contributor Author

smowton commented Feb 12, 2019

@thk123 test added

@smowton smowton force-pushed the smowton/fix/java-static-field-generic-types branch from 81b3148 to a208cce Compare February 12, 2019 12:18
const symbol_exprt symbol_expr(
get_static_field(arg0.get_string(ID_class), field_name), arg0.type());

INVARIANT(
Copy link
Contributor

Choose a reason for hiding this comment

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

My point is "getstatic symbol should have been created before method conversion" is more useful than simply a symbol not existing. Like without that message you might (wrongly) conclude that this conversion should actually be adding to the symbol table

I'm suggesting the invariant goes about the call to lookup_ref in case that wasn't clear. Like,

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: a208cce).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100610260

Avoid the suggestion that `get_static_field` might be expected to create them -- it doesn't,
java_bytecode_convert_class does and we should be able to safely assume they exist
during convert_method.
@smowton smowton force-pushed the smowton/fix/java-static-field-generic-types branch from a19d819 to 35213c4 Compare February 12, 2019 16:26
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: 35213c4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100644186

@smowton smowton merged commit 3f0f776 into diffblue:develop Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants