From bef276a18112f9e75b0d2e2f012b86f35764aeac Mon Sep 17 00:00:00 2001 From: Bert Maher Date: Tue, 11 Oct 2016 09:42:10 -0700 Subject: [PATCH] Update stringly-typed method refs to account for colon Summary: We added a colon to the method descriptor string used by ProguardMap and the canonical-name form of DexMethod::get_method. This is why using strings to represent complex data is bad. This was causing remove-unreachable to go haywire, since it's driven by seeds information, which is in turn parsed using these assumptions. Reviewed By: satnam6502 Differential Revision: D4000864 fbshipit-source-id: 561b67794f518d534cce16dab6ee9580bfb44ff6 --- libredex/DexClass.cpp | 4 ++-- libredex/ReachableClasses.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libredex/DexClass.cpp b/libredex/DexClass.cpp index 40a9fa5cbdd..9084c3be1cd 100644 --- a/libredex/DexClass.cpp +++ b/libredex/DexClass.cpp @@ -447,8 +447,8 @@ std::vector split_args(std::string args) { DexMethod* DexMethod::get_method(std::string canon) { auto cls_end = canon.find('.'); auto name_start = cls_end + 1; - auto name_end = canon.find('(', name_start); - auto args_start = name_end + 1; + auto name_end = canon.find(':', name_start); + auto args_start = name_end + 2; auto args_end = canon.find(')', args_start); auto rtype_start = args_end + 1; auto cls_str = canon.substr(0, cls_end); diff --git a/libredex/ReachableClasses.cpp b/libredex/ReachableClasses.cpp index 292a750fd83..e66dee2c9c4 100644 --- a/libredex/ReachableClasses.cpp +++ b/libredex/ReachableClasses.cpp @@ -533,7 +533,7 @@ struct SeedsParser { return convert_type(cls) + "." + name - + "(" + convert_args(args) + ")" + + ":(" + convert_args(args) + ")" + convert_type(type); }