MinecraftForge / ForgeFlower

Forge's modifications to FernFlower. Fixing various bugs/inconsistencies. Main Repo: https://github.com/MinecraftForge/FernFlower
Apache License 2.0
80 stars 44 forks source link

Changes for 21w19a+/J16 #96

Closed zml2008 closed 2 years ago

zml2008 commented 3 years ago

With 21w19a, Mojang changed a lot of their build toolchain around. This PR aims to patch up the decompiler for some of the bytecode changes that resulted.

Objects.requireNonNull

This is the simplest change -- javac generates nullness checks a bit differently. FF is patched to support both the old .getClass() and new Objects.requireNonNull() variants.

Inner classes

It appears that a lot of inner classes have gained a Signature attribute, which causes generic signature processing to activate. This exposed some issues in its handling of synthetic constructor parameters, which I think I've taken care of enough to correctly

(not sure how these changes would react if someone disabled enum handling though)

Visibility changes

There have been broad changes to field and method visibility anywhere inner classes are involved, which appears to be done by a tool that results in inconsistent inner class attributes. I've added an option to suppress that warning, -win=0

try-with-resources (not done yet)

looks like FF isn't collapsing finally blocks properly -- there are a bunch of changes to exception ranges in the bytecode that may be related, haven't looked too much

nextGaussian (not done yet)

89, will look at applying the proposed fix more properly


I've tested this based off of diffs of 21w19a -- once I make it through the list of issues above I'll do a more thorough comparison on 1.16.5 to ensure nothing regressed on that end.

cc @SuperCoder7979 who I discussed a lot of this with

kashike commented 3 years ago

Please include a diff to show what changes during a decompile with these changes.

zml2008 commented 3 years ago

will do once i get through the list, this PR is mostly for tracking purposes.

a 21w19a old -> 21w19a new diff would be super noisy anyways, due to the sheer number of decompile errors. i intend to do before -> after on both 1.16.5 and 21w19a once my work is wrapped up here though.

ideally someone with more free time in their life would take a stab at updating mcpconfig to the latest snapshot and seeing what sort of issues they run into with this PR when I finish my list -- i don't have the time for that though.

LexManos commented 3 years ago

Tho these are all rather needed fixes, I would prefer them all to be seperate PRs and contain the isolated diffs. For both documentation and simplicities sake. Some of these are JDK related changes, be them simple Objects.requireNotNull. Or the more complex access/nest changes. That one will be a bit more complex to support and should be addressed carefully.

No idea about the inner class signature thing, haven't looked into it.

zml2008 commented 2 years ago

No longer relevant really