md-5 / SpecialSource

Automatic generator and renamer of jar obfuscation mappings.
Other
202 stars 51 forks source link

Class#getDeclaredField not remappable with Proguard mappings #87

Open Jikoo opened 1 year ago

Jikoo commented 1 year ago

Class#getDeclaredField is supposed to be remappable. It turns out that that doesn't work using SpecialSource or SpecialSourceMP because the remapping needs to be done by a preprocessor so that the owning class name is still the old class name. SS via command line and SSMP both only support post-processors (and require an access transformer file to enable that, though that's fine because supplying an empty file works). I started working on a change to add a parameter for preprocessing only to find out that SS is also incapable of correctly matching fields from Mojang's Proguard mappings.

RemapperProcessor#remapGetDeclaredField calls JarMapping#tryClimb with a null descriptor. JarMapping#tryClimb assembles that info into a key used in Map#get. For the other mapping types, this is fine, but for Proguard mappings the key includes the descriptor. We don't know what the actual type is from the bytecode because it's being accessed via reflection, so we can never create a valid key.