Skip to content

Commit

Permalink
fixup! Fix generic_type_index
Browse files Browse the repository at this point in the history
  • Loading branch information
romainbrenguier committed Apr 30, 2018
1 parent 3199fe6 commit 9369bbe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/java_bytecode/java_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,16 @@ class java_generic_symbol_typet : public symbol_typet
/// in the vector of generic types.
/// \param type The type we are looking for.
/// \return The index of the type in the vector of generic types.
optionalt<size_t> generic_type_index(const reference_typet &type) const
optionalt<size_t>
generic_type_index(const java_generic_parametert &type) const
{
const auto type_variables = type.find(ID_type_variables);
for(std::size_t i = 0; i < generic_types().size(); ++i)
const auto &type_variable = type.type_variable();
const auto &generics = generic_types();
for(std::size_t i = 0; i < generics.size(); ++i)
{
if(type_variables == generic_types()[i].find(ID_type_variables))
if(
is_java_generic_parameter(generics[i]) &&
to_java_generic_parameter(generics[i]).type_variable() == type_variable)
return i;
}
return {};
Expand Down

0 comments on commit 9369bbe

Please sign in to comment.