Closed Lanchon closed 4 years ago
You could still trivially override the DexRewriter class, and provide an overridden implementation of rewriteDexFile. But I agree it's cleaner to have it using the same mechanism as all the other rewriters. :)
Implemented in 12b95235e3ccf4e71243b728e7e168c34397fbc3
there is no reason why this rewriter should be hard-coded in DexRewriter.
impact: if you want to filter or add classes in a RewriterModule, you cannot.
i know you have chosen to hard-code collection rewriters, but i can still get to them by rewriting the collection owner object. except in the case of DexFile: DexFile is a type that owns a collection and still cannot be rewritten. this breaks symmetry and makes a RewriterModule not capable of some rewrites. the dexlib2 client then needs to resort to custom code.
easy fix, but breaks backwards compatibility of Rewriters interface.
if you are tempted to do the change and break compat, i say go for it.