File tree 4 files changed +14
-41
lines changed
java_bytecode_convert_method
4 files changed +14
-41
lines changed Original file line number Diff line number Diff line change @@ -284,16 +284,21 @@ class java_method_typet : public code_typet
284
284
}
285
285
};
286
286
287
+ template <>
288
+ inline bool can_cast_type<java_method_typet>(const typet &type)
289
+ {
290
+ return type.id () == ID_code && type.get_bool (ID_C_java_method_type);
291
+ }
292
+
287
293
inline const java_method_typet &to_java_method_type (const typet &type)
288
294
{
289
- PRECONDITION (type. id () == ID_code );
295
+ PRECONDITION (can_cast_type<java_method_typet>(type) );
290
296
return static_cast <const java_method_typet &>(type);
291
297
}
292
298
293
299
inline java_method_typet &to_java_method_type (typet &type)
294
300
{
295
- PRECONDITION (type.id () == ID_code);
296
- type.set (ID_C_java_method_type, true );
301
+ PRECONDITION (can_cast_type<java_method_typet>(type));
297
302
return static_cast <java_method_typet &>(type);
298
303
}
299
304
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ SRC += java_bytecode/goto-programs/class_hierarchy_output.cpp \
21
21
java_bytecode/java_types/erase_type_arguments.cpp \
22
22
java_bytecode/java_types/generic_type_index.cpp \
23
23
java_bytecode/java_types/java_generic_symbol_type.cpp \
24
- java_bytecode/java_types/java_method_type.cpp \
25
24
java_bytecode/java_types/java_type_from_string.cpp \
26
25
java_bytecode/java_utils_test.cpp \
27
26
java_bytecode/load_method_by_regex.cpp \
Original file line number Diff line number Diff line change @@ -30,8 +30,12 @@ SCENARIO(
30
30
symbol_table.lookup_ref (method_name + " :(Ljava/lang/Object;)I" );
31
31
32
32
const java_method_typet &function_type =
33
- require_type::require_code (function_symbol.type );
34
- THEN (" The method should be marked as a bridge method" )
33
+ require_type::require_java_method (function_symbol.type );
34
+ THEN (" The method symbol should be of java_method_typet" )
35
+ {
36
+ REQUIRE (function_type.get_bool (ID_C_java_method_type));
37
+ }
38
+ THEN (" And the method should be marked as a bridge method" )
35
39
{
36
40
REQUIRE (function_type.get_bool (ID_is_bridge_method));
37
41
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments