-
Notifications
You must be signed in to change notification settings - Fork 273
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
[TG-1157] Add specialised java generic class type. #1576
[TG-1157] Add specialised java generic class type. #1576
Conversation
Previously we only converted types that were precisely a generic parameter. Now we deal with the case where the array is T type'd.
Previously we didn't handle generic fields when we were doing specialisation, meaning they were missed. This resolves this and adds a unit test to demonstrate it.
// new_tag, | ||
// symbol_table, | ||
// message_handler, | ||
// replacement_components); |
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.
should have commented-out code here
{ | ||
java_specialised_generic_class_typet specialised_class; | ||
specialised_class.set_tag(replacement_type.get_tag()); | ||
// NOTE: the tag absolutely has to be BasicGeneric |
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.
what does BasicGeneric
here mean?
{ | ||
return generic_reference.generic_type_variables()[*results]; | ||
} | ||
else |
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.
with the above invariant, is this case possible at all ?
new_type.generic_type_variables()=replaced_type_variables; | ||
return new_type; | ||
} | ||
else if(parameter_type.subtype().id() == ID_symbol) |
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.
what are the cases that can happen here? The only one seems to be arrays, please add a short documentation here.
@@ -403,4 +403,29 @@ inline const optionalt<size_t> java_generics_get_index_for_subtype( | |||
return std::distance(gen_types.cbegin(), iter); | |||
} | |||
|
|||
class java_specialised_generic_class_typet : public java_class_typet | |||
{ | |||
// note the constryctor could take the components and construct it itself |
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.
typo: constructor
// note the constryctor could take the components and construct it itself | ||
// note vector of generic parameter of symbol type | ||
public: | ||
// TODO: to be defined more appropriately. |
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.
TODO for whom?
"java::generic_field_array_instantiation"; | ||
|
||
// We want to test that the specialized/instantiated class has it's field | ||
// type updated, so find the specialized class, not the generic class. | ||
const irep_idt test_class= | ||
const irep_idt test_class = |
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.
does this work with the changed implementation for arrays as generic parameters? These should now be of the form java::array[reference]of_java::inner_type
This is being superseded by #1606. Thanks for your comments everyone. |
No description provided.