File tree 3 files changed +13
-10
lines changed
unit/java_bytecode/java_bytecode_parser
3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -587,9 +587,8 @@ void java_bytecode_convert_methodt::convert(
587
587
method_symbol.location =m.source_location ;
588
588
method_symbol.location .set_function (method_identifier);
589
589
590
- std::vector<irept> &exceptions_list = method_type.throws_exceptions ();
591
590
for (const auto &exception_name : m.throws_exception_table )
592
- exceptions_list. push_back ( irept ( exception_name) );
591
+ method_type. add_throws_exceptions ( exception_name);
593
592
594
593
const std::string signature_string = pretty_signature (method_type);
595
594
Original file line number Diff line number Diff line change @@ -245,14 +245,17 @@ inline bool can_cast_type<java_class_typet>(const typet &type)
245
245
class java_method_typet : public code_typet
246
246
{
247
247
public:
248
- const std::vector<irept> & throws_exceptions () const
248
+ const std::vector<irep_idt> throws_exceptions () const
249
249
{
250
- return find (ID_exceptions_thrown_list).get_sub ();
250
+ std::vector<irep_idt> exceptions;
251
+ for (const auto &e : find (ID_exceptions_thrown_list).get_sub ())
252
+ exceptions.push_back (e.id ());
253
+ return exceptions;
251
254
}
252
255
253
- std::vector<irept> & throws_exceptions ( )
256
+ void add_throws_exceptions (irep_idt exception )
254
257
{
255
- return add (ID_exceptions_thrown_list).get_sub ();
258
+ add (ID_exceptions_thrown_list).get_sub (). push_back ( irept ( exception ) );
256
259
}
257
260
};
258
261
Original file line number Diff line number Diff line change @@ -612,17 +612,18 @@ SCENARIO(
612
612
new_symbol_table.lookup_ref (" java::ThrowsExceptions.test:()V" );
613
613
const java_method_typet method =
614
614
to_java_method_type (method_symbol.type );
615
- const std::vector<irept > exceptions = method.throws_exceptions ();
615
+ const std::vector<irep_idt > exceptions = method.throws_exceptions ();
616
616
REQUIRE (exceptions.size () == 2 );
617
617
REQUIRE (
618
618
std::find (
619
- exceptions.begin (), exceptions.end (), irept (" CustomException" )) !=
620
- exceptions.end ());
619
+ exceptions.begin (),
620
+ exceptions.end (),
621
+ irept (" CustomException" ).id ()) != exceptions.end ());
621
622
REQUIRE (
622
623
std::find (
623
624
exceptions.begin (),
624
625
exceptions.end (),
625
- irept (" java.io.IOException" )) != exceptions.end ());
626
+ irept (" java.io.IOException" ). id () ) != exceptions.end ());
626
627
}
627
628
}
628
629
}
You can’t perform that action at this time.
0 commit comments