From e0b26e1c3cb186c9b42c3dcbd18a4737063c3509 Mon Sep 17 00:00:00 2001 From: liufengkai Date: Thu, 2 Sep 2021 11:52:53 +0800 Subject: [PATCH] [bugfix]: check recursive cls impls. --- libredex/DexTypeEnvironment.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libredex/DexTypeEnvironment.cpp b/libredex/DexTypeEnvironment.cpp index 7359275caec..70c0c291a42 100644 --- a/libredex/DexTypeEnvironment.cpp +++ b/libredex/DexTypeEnvironment.cpp @@ -18,10 +18,14 @@ bool implements(const DexClass* cls, const DexType* intf) { if (is_interface(cls)) { return false; } - for (const auto interface : cls->get_interfaces()->get_type_list()) { - if (interface == intf) { - return true; + auto parent = cls; + while (parent) { + for (const auto interface : parent->get_interfaces()->get_type_list()) { + if (interface == intf) { + return true; + } } + parent = type_class(parent->get_super_class()); } return false; }