Skip to content

Commit e936a29

Browse files
Fix generic_type_index
This function needs to look at the type_variables comment to known which argument correspondsd to the given type.
1 parent 6b8583d commit e936a29

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/java_bytecode/java_types.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,12 @@ class java_generic_symbol_typet : public symbol_typet
611611
/// \return The index of the type in the vector of generic types.
612612
optionalt<size_t> generic_type_index(const reference_typet &type) const
613613
{
614-
const auto &type_pointer =
615-
std::find(generic_types().begin(), generic_types().end(), type);
616-
if(type_pointer != generic_types().end())
617-
return type_pointer - generic_types().begin();
614+
const auto type_variables = type.find(ID_type_variables);
615+
for(std::size_t i = 0; i < generic_types().size(); ++i)
616+
{
617+
if(type_variables == generic_types()[i].find(ID_type_variables))
618+
return i;
619+
}
618620
return {};
619621
}
620622
};

0 commit comments

Comments
 (0)