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 @@ -451,7 +451,7 @@ void java_bytecode_convert_classt::convert(
451451 {
452452 convert_annotations (
453453 f.annotations ,
454- static_cast <annotated_typet & >(new_symbol.type ).get_annotations ());
454+ type_checked_cast <annotated_typet>(new_symbol.type ).get_annotations ());
455455 }
456456
457457 // Do we have the static field symbol already?
Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ void java_bytecode_convert_method_lazy(
371371 {
372372 convert_annotations (
373373 m.annotations ,
374- static_cast <annotated_typet & >(static_cast <typet &>(member_type))
374+ type_checked_cast <annotated_typet>(static_cast <typet &>(member_type))
375375 .get_annotations ());
376376 }
377377
Original file line number Diff line number Diff line change @@ -78,8 +78,7 @@ void java_qualifierst::read(const typet &src)
7878void java_qualifierst::write (typet &src) const
7979{
8080 c_qualifierst::write (src);
81- auto &annotated_type = static_cast <annotated_typet &>(src);
82- annotated_type.get_annotations () = annotations;
81+ type_checked_cast<annotated_typet>(src).get_annotations () = annotations;
8382}
8483
8584c_qualifierst &java_qualifierst::operator +=(const c_qualifierst &c_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