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 @@ -467,7 +467,7 @@ void java_bytecode_convert_classt::convert(
467467 {
468468 convert_annotations (
469469 f.annotations ,
470- static_cast <annotated_typet & >(new_symbol.type ).get_annotations ());
470+ type_checked_cast <annotated_typet>(new_symbol.type ).get_annotations ());
471471 }
472472
473473 // Do we have the static field symbol already?
Original file line number Diff line number Diff line change @@ -392,7 +392,7 @@ void java_bytecode_convert_method_lazy(
392392 {
393393 convert_annotations (
394394 m.annotations ,
395- static_cast <annotated_typet & >(static_cast <typet &>(member_type))
395+ type_checked_cast <annotated_typet>(static_cast <typet &>(member_type))
396396 .get_annotations ());
397397 }
398398
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 @@ -82,6 +82,22 @@ class annotated_typet : public typet
8282 }
8383};
8484
85+ inline const annotated_typet &to_annotated_type (const typet &type)
86+ {
87+ return static_cast <const annotated_typet &>(type);
88+ }
89+
90+ inline annotated_typet &to_annotated_type (typet &type)
91+ {
92+ return static_cast <annotated_typet &>(type);
93+ }
94+
95+ template <>
96+ inline bool can_cast_type<annotated_typet>(const typet &type)
97+ {
98+ return true ;
99+ }
100+
85101class java_class_typet :public class_typet
86102{
87103 public:
@@ -129,7 +145,7 @@ class java_class_typet:public class_typet
129145
130146 std::vector<java_annotationt> &get_annotations ()
131147 {
132- return static_cast <annotated_typet & >(
148+ return type_checked_cast <annotated_typet>(
133149 static_cast <typet &>(*this )).get_annotations ();
134150 }
135151};
You can’t perform that action at this time.
0 commit comments