File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -455,7 +455,7 @@ void java_bytecode_convert_classt::convert(
455455 {
456456 convert_annotations (
457457 f.annotations ,
458- static_cast <annotated_typet & >(new_symbol.type ).get_annotations ());
458+ type_checked_cast <annotated_typet>(new_symbol.type ).get_annotations ());
459459 }
460460
461461 // Do we have the static field symbol already?
Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ void java_bytecode_convert_method_lazy(
374374 {
375375 convert_annotations (
376376 m.annotations ,
377- static_cast <annotated_typet & >(static_cast <typet &>(member_type))
377+ type_checked_cast <annotated_typet>(static_cast <typet &>(member_type))
378378 .get_annotations ());
379379 }
380380
Original file line number Diff line number Diff line change @@ -47,8 +47,7 @@ void java_qualifierst::read(const typet &src)
4747void java_qualifierst::write (typet &src) const
4848{
4949 c_qualifierst::write (src);
50- auto &annotated_type = static_cast <annotated_typet &>(src);
51- annotated_type.get_annotations () = annotations;
50+ type_checked_cast<annotated_typet>(src).get_annotations () = annotations;
5251}
5352
5453qualifierst &java_qualifierst::operator +=(const qualifierst &other)
Original file line number Diff line number Diff line change @@ -81,6 +81,22 @@ class annotated_typet : public typet
8181 }
8282};
8383
84+ inline const annotated_typet &to_annotated_type (const typet &type)
85+ {
86+ return static_cast <const annotated_typet &>(type);
87+ }
88+
89+ inline annotated_typet &to_annotated_type (typet &type)
90+ {
91+ return static_cast <annotated_typet &>(type);
92+ }
93+
94+ template <>
95+ inline bool can_cast_type<annotated_typet>(const typet &type)
96+ {
97+ return true ;
98+ }
99+
84100class java_class_typet :public class_typet
85101{
86102 public:
@@ -102,7 +118,7 @@ class java_class_typet:public class_typet
102118
103119 std::vector<java_annotationt> &get_annotations ()
104120 {
105- return static_cast <annotated_typet & >(
121+ return type_checked_cast <annotated_typet>(
106122 static_cast <typet &>(*this )).get_annotations ();
107123 }
108124};
You can’t perform that action at this time.
0 commit comments