File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -452,31 +452,33 @@ class java_generic_typet:public reference_typet
452
452
}
453
453
};
454
454
455
+ template <>
456
+ inline bool can_cast_type<java_generic_typet>(const typet &type)
457
+ {
458
+ return is_reference (type) && type.get_bool (ID_C_java_generic_type);
459
+ }
460
+
455
461
// / \param type: the type to check
456
462
// / \return true if type is java type containing with generics, e.g., List<T>
457
463
inline bool is_java_generic_type (const typet &type)
458
464
{
459
- return type. get_bool (ID_C_java_generic_type );
465
+ return can_cast_type<java_generic_typet>(type );
460
466
}
461
467
462
468
// / \param type: source type
463
469
// / \return cast of type into java type with generics
464
470
inline const java_generic_typet &to_java_generic_type (
465
471
const typet &type)
466
472
{
467
- PRECONDITION (
468
- type.id ()==ID_pointer &&
469
- is_java_generic_type (type));
473
+ PRECONDITION (can_cast_type<java_generic_typet>(type));
470
474
return static_cast <const java_generic_typet &>(type);
471
475
}
472
476
473
477
// / \param type: source type
474
478
// / \return cast of type into java type with generics
475
479
inline java_generic_typet &to_java_generic_type (typet &type)
476
480
{
477
- PRECONDITION (
478
- type.id ()==ID_pointer &&
479
- is_java_generic_type (type));
481
+ PRECONDITION (can_cast_type<java_generic_typet>(type));
480
482
return static_cast <java_generic_typet &>(type);
481
483
}
482
484
You can’t perform that action at this time.
0 commit comments