Local variable names in inner class methods aren't fixed when they conflict with outer names
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the FernFlower-Patches/0037-Do-not-rebuild-variable-names-in-lambdas.patch context, then inspect VarNamesCollector.setNewOuterNames and getFreeName(). Compare the current behavior with the earlier naming behavior described in the issue. Done means conflicting local names in inner methods are handled correctly without breaking the nested-scope behavior.
Written by the indexing model from the issue text.
Description
This is due to https://github.com/MinecraftForge/ForgeFlower/blob/master/FernFlower-Patches/0037-Do-not-rebuild-variable-names-in-lambdas.patch
For background on what that code is doing (re: the patch message):
That allows the decompiler to fix variable names in a nested class or lambda expression which clashes with the name of an outer variable.
What's happening is it's checking the names for the current method against the variable names defined in the outer scope. That's why setNewOuterNames is passed to VarNamesCollector, then checked for in VarNamesCollector.getFreeName() - the outer names are compared against the names for the nested method.
What FernFlower's code originally did was append x to local variable names when conflicts came up - but now it doesn't do that because of that patch. Considering that's the only thing that method is actually doing I don't know what the patch is actually trying to fix. The commit which added the patch said it fixes #88, but there is no issue 88 yet.
This comes up relatively infrequently, and I guess never in MCP due to how LVT is handled, but it causes an issue with my usage. This quick and dirty fix is because of this issue - previous versions of FernFlower would rename the inner i variable to ix. https://github.com/PaperMC/Paper/blob/mappings/mojang/Spigot-Server-Patches/0266-Optimize-BlockPosition-helper-methods.patch#L113-L134
- Dominant language
- No language data
- Stars
- 110
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MinecraftForge/ForgeFlower
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
MinecraftForge/ForgeFlower#131 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
MinecraftForge/ForgeFlower#85 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
MinecraftForge/ForgeFlower#76 · 1 comment · 3 reactions ·
All issues in MinecraftForge/ForgeFlower
Similar issues
-
`String.Parser.chompUntilEndOr` leaves the column one short when it runs to the end past a newline Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
enhancement PyCDE
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
llvm:support
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
llvm/llvm-project#226296 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
abseil/abseil-cpp#2176 ·