Skip to content

Commit 405fe5f

Browse files
author
Matthias Güdemann
committed
Use generic signature for local variables with entry in LVTT
This uses the generic type information of the local variable type table for the type of local variables. Before, no local variable was considered to a have generic type.
1 parent f9a09d8 commit 405fe5f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

jbmc/src/java_bytecode/java_local_variable_table.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,20 @@ void java_bytecode_convert_methodt::setup_local_variables(
768768
<< " name " << v.var.name << " v.var.descriptor '"
769769
<< v.var.descriptor << "' holes " << v.holes.size() << eom;
770770
#endif
771-
typet t;
772-
// TODO: might need changing once descriptor/signature issue is resolved
773-
t=java_type_from_string(v.var.descriptor);
771+
772+
const std::string &method_name = id2string(method_id);
773+
const size_t method_name_end = method_name.rfind(":(");
774+
const size_t class_name_end = method_name.rfind('.', method_name_end);
775+
INVARIANT(
776+
method_name_end != std::string::npos &&
777+
class_name_end != std::string::npos,
778+
"Java method name does not have the right format.");
779+
const std::string class_name = method_name.substr(0, class_name_end);
780+
781+
const typet t = v.var.signature.has_value()
782+
? java_type_from_string_with_exception(
783+
v.var.descriptor, v.var.signature, class_name)
784+
: java_type_from_string(v.var.descriptor);
774785

775786
std::ostringstream id_oss;
776787
id_oss << method_id << "::" << v.var.start_pc << "::" << v.var.name;

0 commit comments

Comments
 (0)