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(
451
451
{
452
452
convert_annotations (
453
453
f.annotations ,
454
- static_cast <annotated_typet & >(new_symbol.type ).get_annotations ());
454
+ type_checked_cast <annotated_typet>(new_symbol.type ).get_annotations ());
455
455
}
456
456
457
457
// 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(
371
371
{
372
372
convert_annotations (
373
373
m.annotations ,
374
- static_cast <annotated_typet & >(static_cast <typet &>(member_type))
374
+ type_checked_cast <annotated_typet>(static_cast <typet &>(member_type))
375
375
.get_annotations ());
376
376
}
377
377
Original file line number Diff line number Diff line change @@ -78,8 +78,7 @@ void java_qualifierst::read(const typet &src)
78
78
void java_qualifierst::write (typet &src) const
79
79
{
80
80
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;
83
82
}
84
83
85
84
c_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
81
81
}
82
82
};
83
83
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
+
84
100
class java_class_typet :public class_typet
85
101
{
86
102
public:
@@ -102,7 +118,7 @@ class java_class_typet:public class_typet
102
118
103
119
std::vector<java_annotationt> &get_annotations ()
104
120
{
105
- return static_cast <annotated_typet & >(
121
+ return type_checked_cast <annotated_typet>(
106
122
static_cast <typet &>(*this )).get_annotations ();
107
123
}
108
124
};
You can’t perform that action at this time.
0 commit comments