Open
Conversation
…pplets in their signature
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.
Fixes #278
This PR attempts to handle the cases of old plugins compiled before the removal of Applets in Java 26 that still reference those methods by remapping plugin classes at runtime to reference stubbed versions*.
The stubbed version of Applet unconditionally throws with an exception saying Applets were removed in the offchance an instance is somehow obtained. Javadoc and deprecation annotations were added where applicable, with placeholders in the Java 26 versions of the classes to specify the IJ version the behavior changed in.
This sets up a system to use Multi-Release Jars. The Java 26 MRJ duplicates the needed classes to allow for the signature of
IJ#getAppletto change since remapping IJ's own classes is trickier. The pre-26 versions of the classes still referenceApplet, so when running on pre-26 versions IJ should behave as it does now.*It is also possible to remap to
Object, and from testing with the Oracle jdk, so long as the plugin properly null checks the applet instance, there is no issue of exceptions being thrown for the nonexistent methods. I do not know how other JVMs will behave, but I imagine it would be the same. See Object version here.Help testing on Java versions before 9 and with plugins using java modules would be appreciated.
Tested by running the following plugin with both Java 21 and 26: