Skip to content

Commit

Permalink
Return bound if no concrete instantiation is found
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Güdemann committed Jun 6, 2018
1 parent 26e5433 commit 2c5e0b8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jbmc/src/java_bytecode/select_pointer_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ pointer_typet select_pointer_typet::specialize_generics(
{
return result.value();
}
throw "no infinite recursion";
else
{
// return pointer type of generic parameter bound
return java_reference_type(parameter.subtype());
}
}

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

// max depth reached and nothing found, TODO return bound
if(replacements.size() <= depth)
return {};
INVARIANT(
depth < replacements.size(), "cannot access elements outside stack");

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

0 comments on commit 2c5e0b8

Please sign in to comment.