Proof of Concept: Transformer-less EventBus - #617
Draft
ZZZank wants to merge 8 commits into
Draft
Conversation
written by AI
Ecdcaeb
reviewed
Aug 21, 2026
|
|
||
| ListenerList result = null; | ||
| try { | ||
| var method_getListenerList = eventType.getDeclaredMethod("getListenerList"); |
Contributor
There was a problem hiding this comment.
still need call getListenerList here? another way needed
| // walks superclass, until (exclusive) the first method implementation | ||
| Class<?> checkEnd = method.getDeclaringClass(); | ||
| for (var c = type; c != checkEnd; c = c.getSuperclass()) { | ||
| if (type.isAnnotationPresent(target)) { |
Contributor
There was a problem hiding this comment.
Suggested change
| if (type.isAnnotationPresent(target)) { | |
| if (c.isAnnotationPresent(target)) { |
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.
This PR removed two EventBus related transformers:
EventSubscriptionTransformerandEventSubscriberTransformer, and added lambda-based listener registration.Removal of
EventSubscriptionTransformerEventSubscriptionTransformerworks by injecting.getListenerList(),.isCancelable(), and.hasResult()implementation for event class, and make use of JVM method dispatch to handle inheritance of event properties.To get rid of this transformer while still recognize custom implementation, three
ClassValueis used for caching the result of three previously mentioned methods, each containing some reflection tricks to use custom implementation when possible. SeeEventPropertiesclass in this PR for more detail.Removal of
EventSubscriberTransformerEventSubscriberTransformerscans every method in every class to find those with@SubscribeEvent, then make the method, and the declaring class, public.To get rid of this transformer, method searching logic in
EventBusis rewritten, to include all declared methods as candidate, instead of only public methods.EventListenerFactoryis also modified to handle non-public method.New method searching logic should also be faster when working on static listener class.
Lambda-based listener
Full method:
The "Infer event type from handler" feature is not implemented yet.
Tests mostly written by AI, see this commit