-
Notifications
You must be signed in to change notification settings - Fork 297
No longer use java.applet as it's scheduled for removal. #1029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine imo, but don't merge before we at least verified it works with a JDK build that has applets removed - unless it substantially improves using these old versions for other reasons.
It doesn't improve much, I made the PR mostly so it's not forgotten about. |
This has been proposed to be removed in J26: https://openjdk.org/projects/jdk/26/ Once there is an EA build for 26 this should be re tested. |
Tested with the latest Java 26 EA build 17 this works fine for most older versions, but 1.4.7 is proving to be a bit tricky as it uses the applet classes in its own obfucated classes that the same gamepatch doesnt cover. I think the solution here is to make a builtin transform that runs on every single class load, to point to the stubbed classes. This has an additional benefit of also patching mods that use applet classes (do any exist?). I may also look into only applying these changes when running with Java 26 or later as there is no point in breaking something that already works. |
// TODO move this transformer into the minecraft specific code. | ||
renames.put("java/applet/Applet", "net/fabricmc/loader/impl/game/minecraft/applet/stub/Applet"); | ||
renames.put("java/applet/AppletStub", "net/fabricmc/loader/impl/game/minecraft/applet/stub/AppletStub"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure keen on how this brings minecraft specific code over into the none minecraft part of loader, this will likely need to be solved by some future refactoring work.
Mixins utilizing Applet don't work with this PR. Such as one seen here: https://github.com/OrnitheMC/ornithe-standard-libraries/blob/main/libraries/entrypoints/entrypoints-client-mca1.0.6-mc12w30e/src/main/java/net/ornithemc/osl/entrypoints/impl/mixin/client/MinecraftAppletMixin.java
|
I don't think this is really fixable easily, for now it seems reasonable to require that the mod adapts to the new hierarchy instead. We chose to enable the applet transform for all JVM version to allow mods to migrate easily with a single code path. |
Seems to work, and wasnt too crazy, this should help ensure future java version support, see: https://openjdk.org/jeps/8345525
Tested only in b1.8.1 so far, needs testing in a wide range of versions.
Can we take this opertunity to fix some of the bugs with the applet versions, especially the incorrectly sized windows?