File tree 4 files changed +20
-5
lines changed
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(
467
467
{
468
468
convert_annotations (
469
469
f.annotations ,
470
- static_cast <annotated_typet & >(new_symbol.type ).get_annotations ());
470
+ type_checked_cast <annotated_typet>(new_symbol.type ).get_annotations ());
471
471
}
472
472
473
473
// 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(
392
392
{
393
393
convert_annotations (
394
394
m.annotations ,
395
- static_cast <annotated_typet & >(static_cast <typet &>(member_type))
395
+ type_checked_cast <annotated_typet>(static_cast <typet &>(member_type))
396
396
.get_annotations ());
397
397
}
398
398
Original file line number Diff line number Diff line change @@ -47,8 +47,7 @@ void java_qualifierst::read(const typet &src)
47
47
void java_qualifierst::write (typet &src) const
48
48
{
49
49
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;
52
51
}
53
52
54
53
qualifierst &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
82
82
}
83
83
};
84
84
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
+
85
101
class java_class_typet :public class_typet
86
102
{
87
103
public:
@@ -129,7 +145,7 @@ class java_class_typet:public class_typet
129
145
130
146
std::vector<java_annotationt> &get_annotations ()
131
147
{
132
- return static_cast <annotated_typet & >(
148
+ return type_checked_cast <annotated_typet>(
133
149
static_cast <typet &>(*this )).get_annotations ();
134
150
}
135
151
};
You can’t perform that action at this time.
0 commit comments