Skip to content

Commit 2c5e0b8

Browse files
author
Matthias Güdemann
committed
Return bound if no concrete instantiation is found
1 parent 26e5433 commit 2c5e0b8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

jbmc/src/java_bytecode/select_pointer_type.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ pointer_typet select_pointer_typet::specialize_generics(
9494
{
9595
return result.value();
9696
}
97-
throw "no infinite recursion";
97+
else
98+
{
99+
// return pointer type of generic parameter bound
100+
return java_reference_type(parameter.subtype());
101+
}
98102
}
99103

100104
// generic parameters can be adopted from outer classes or superclasses so
@@ -204,9 +208,8 @@ optionalt<pointer_typet> select_pointer_typet::get_instantiated_type(
204208
const auto &replacements =
205209
generic_parameter_specialization_map.find(parameter_name)->second;
206210

207-
// max depth reached and nothing found, TODO return bound
208-
if(replacements.size() <= depth)
209-
return {};
211+
INVARIANT(
212+
depth < replacements.size(), "cannot access elements outside stack");
210213

211214
// Check if there is a recursion loop, if yes return with nothing found
212215
if(visited.find(parameter_name) != visited.end())

0 commit comments

Comments
 (0)