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