Adjust local variable names if param mappings conflict + other fixes#35
Merged
Conversation
If a method parameter mapping exists which will conflict with an existing local variable after remap, Mercury will now adjust that local variable name by appending a number (starting from 1) to the name of the local variable. This commit attempts to fix local variables defined in the method itself as well as any local variables defined in lambda expressions contained by said methods.
MiniDigger
approved these changes
Dec 11, 2020
Param name mappings require resolving method mappings just as method mappings do, which means to fully handle all cases we have to complete the inheritance information in class mappings when we are trying to find new mappings for method parameters.
Inner classes which aren't in the mappings was causing the import context to incorrectly place unknown inner classes in the obfuscated outer class's FQN rather than the deobfuscated name. Using `computeClassMapping` fixes this automatically.
There were 2 issues here. First, the conditional was inverted, so classes which _were_ in the same package were getting skipped, rather than the other way around. Then the second issue was the package names weren't normalized to the same format.
While this can be helpful for incomplete mappings, for complete mappings it doesn't help, and the option to disable it can help.
jamierocks
approved these changes
Dec 18, 2020
Member
jamierocks
left a comment
There was a problem hiding this comment.
Imports aside, all looks good.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a method parameter mapping exists which will conflict with an
existing local variable after remap, Mercury will now adjust that local
variable name by appending a number (starting from 1) to the name of the
local variable.
This commit attempts to fix local variables defined in the method itself
as well as any local variables defined in lambda expressions contained
by said methods.
I've pushed a couple more commits, one is a simple misc fix in
AccessTransformerRewriter, and the other is another fix related to param mapping.Okay I added another commit which fixes a quirk with inner class remapping.
And last commit fixes an issue with implicit imports of package-private inner classes of super classes.