-
-
Couldn't load subscription status.
- Fork 37
[6.2.x] Skip redundant wrapped post-time listener checks in more cases #98
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: 6.2.x
Are you sure you want to change the base?
[6.2.x] Skip redundant wrapped post-time listener checks in more cases #98
Conversation
Enhances MinecraftForge#85 to support also checking the permitted subclasses when running on Java 17+ and the event type is sealed.
|
If you are interested in making EventBus 6 Multi-Release, see my setup for Download Utils, using dedicated projects to aid in Eclipse compatibility. |
|
I'm not sure if legacy SecureJarHandler properly supports MR jars, so I took the safe approach of reflection for this one method. |
|
Roger. Keep in mind that I plan on updating ModLauncher and SecureModules on those older versions at some point. Although, it will be a bit of a challenge as I'll need to update all dependencies that rely on them. ForgeGradle 6 is not too fond of dependency namespace changes, as it only information the consumer of dependencies via a POM file, which fails to take into account dependency capabilities. |
| .findVirtual(Class.class, "getPermittedSubclasses", methodType) | ||
| .asType(methodType.insertParameterTypes(0, Class.class)); | ||
| } catch (Exception e) { | ||
| throw new ExceptionInInitializerError(e); |
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.
Please, if possible, add a message stating that you tried to grab the permitted subclasses here.
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.
This currently looks like:
Exception in thread "main" java.lang.ExceptionInInitializerError
at Scratch.<clinit>(scratch_10.java:17)
Caused by: java.lang.NoSuchMethodException: no such method: java.lang.Class.getPermittedSubclasses()Class[]/invokeVirtual
at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:976)
at java.base/java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1117)
at java.base/java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:3649)
at java.base/java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:2680)
at Scratch.<clinit>(scratch_10.java:14)
Caused by: java.lang.NoSuchMethodError: 'java.lang.Class[] java.lang.Class.getPermittedSubclasses()'
at java.base/java.lang.invoke.MethodHandleNatives.resolve(Native Method)
at java.base/java.lang.invoke.MemberName$Factory.resolve(MemberName.java:1085)
at java.base/java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1114)
... 3 more
Would you like me to add a message anyway?
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.
Yes, because it's not initially clear that it is EventBus 6 that is requesting this member.
Enhances #85 to support also checking the permitted subclasses when running on Java 17+ and the event type is sealed.
For example:
Previously, we could not apply this optimisation to listeners of
MouseButtonEventbecause checking the permitted subclasses was not supported, but with this PR we now can as long as we're running on Java 17+.