@@ -265,6 +265,9 @@ void java_bytecode_convert_classt::convert(
265
265
class_type.set_tag (c.name );
266
266
class_type.set (ID_base_name, c.name );
267
267
class_type.set (ID_abstract, c.is_abstract );
268
+ class_type.set (ID_is_annotation, c.is_annotation );
269
+ class_type.set (ID_interface, c.is_interface );
270
+ class_type.set (ID_synthetic, c.is_synthetic );
268
271
class_type.set_final (c.is_final );
269
272
if (c.is_enum )
270
273
{
@@ -875,8 +878,9 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
875
878
876
879
bool java_bytecode_convert_classt::is_overlay_method (const methodt &method)
877
880
{
878
- return java_bytecode_parse_treet::does_annotation_exist (
879
- method.annotations , ID_overlay_method);
881
+ return java_bytecode_parse_treet::find_annotation (
882
+ method.annotations , ID_overlay_method)
883
+ .has_value ();
880
884
}
881
885
882
886
bool java_bytecode_convert_class (
@@ -1015,24 +1019,48 @@ static void find_and_replace_parameters(
1015
1019
// / \param annotations: The java_annotationt collection to populate
1016
1020
void convert_annotations (
1017
1021
const java_bytecode_parse_treet::annotationst &parsed_annotations,
1018
- std::vector<java_annotationt> &annotations )
1022
+ std::vector<java_annotationt> &java_annotations )
1019
1023
{
1020
1024
for (const auto &annotation : parsed_annotations)
1021
1025
{
1022
- annotations .emplace_back (annotation.type );
1026
+ java_annotations .emplace_back (annotation.type );
1023
1027
std::vector<java_annotationt::valuet> &values =
1024
- annotations .back ().get_values ();
1028
+ java_annotations .back ().get_values ();
1025
1029
std::transform (
1026
1030
annotation.element_value_pairs .begin (),
1027
1031
annotation.element_value_pairs .end (),
1028
1032
std::back_inserter (values),
1029
- [](const decltype (annotation.element_value_pairs )::value_type &value)
1030
- {
1033
+ [](const decltype (annotation.element_value_pairs )::value_type &value) {
1031
1034
return java_annotationt::valuet (value.element_name , value.value );
1032
1035
});
1033
1036
}
1034
1037
}
1035
1038
1039
+ // / Convert java annotations, e.g. as retrieved from the symbol table, back
1040
+ // / to type annotationt (inverse of convert_annotations())
1041
+ // / \param java_annotations: The java_annotationt collection to convert
1042
+ // / \param annotations: The annotationt collection to populate
1043
+ void convert_java_annotations (
1044
+ const std::vector<java_annotationt> &java_annotations,
1045
+ java_bytecode_parse_treet::annotationst &annotations)
1046
+ {
1047
+ for (const auto &java_annotation : java_annotations)
1048
+ {
1049
+ annotations.emplace_back (java_bytecode_parse_treet::annotationt ());
1050
+ auto &annotation = annotations.back ();
1051
+ annotation.type = java_annotation.get_type ();
1052
+
1053
+ std::transform (
1054
+ java_annotation.get_values ().begin (),
1055
+ java_annotation.get_values ().end (),
1056
+ std::back_inserter (annotation.element_value_pairs ),
1057
+ [](const java_annotationt::valuet &value)
1058
+ -> java_bytecode_parse_treet::annotationt::element_value_pairt {
1059
+ return {value.get_name (), value.get_value ()};
1060
+ });
1061
+ }
1062
+ }
1063
+
1036
1064
// / Checks if the class is implicitly generic, i.e., it is an inner class of
1037
1065
// / any generic class. All uses of the implicit generic type parameters within
1038
1066
// / the inner class are updated to point to the type parameters of the
0 commit comments