Skip to content

Commit 055d30f

Browse files
fixup! Change get/set for thrown exceptions
1 parent 828bc6a commit 055d30f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,8 @@ void java_bytecode_convert_methodt::convert(
587587
method_symbol.location=m.source_location;
588588
method_symbol.location.set_function(method_identifier);
589589

590-
std::vector<irept> &exceptions_list = method_type.throws_exceptions();
591590
for(const auto &exception_name : m.throws_exception_table)
592-
exceptions_list.push_back(irept(exception_name));
591+
method_type.add_throws_exceptions(irept(exception_name));
593592

594593
const std::string signature_string = pretty_signature(method_type);
595594

jbmc/src/java_bytecode/java_types.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,17 @@ inline bool can_cast_type<java_class_typet>(const typet &type)
245245
class java_method_typet : public code_typet
246246
{
247247
public:
248-
const std::vector<irept> &throws_exceptions() const
248+
const std::vector<irep_idt> throws_exceptions() const
249249
{
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;
251254
}
252255

253-
std::vector<irept> &throws_exceptions()
256+
void add_throws_exceptions(irept exception)
254257
{
255-
return add(ID_exceptions_thrown_list).get_sub();
258+
add(ID_exceptions_thrown_list).get_sub().push_back(exception);
256259
}
257260
};
258261

0 commit comments

Comments
 (0)