-
Notifications
You must be signed in to change notification settings - Fork 12
Improve signals dispatching #1343
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
Conversation
…OK to return an empty set. Only throw exceptions if a particular handler is required.
Codecov Report
@@ Coverage Diff @@
## master #1343 +/- ##
============================================
+ Coverage 90.98% 91.05% +0.07%
+ Complexity 4768 4767 -1
============================================
Files 614 614
Lines 15139 15135 -4
Branches 860 858 -2
============================================
+ Hits 13774 13781 +7
+ Misses 1090 1085 -5
+ Partials 275 269 -6 |
@armiol PTAL. |
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.
@yuri-sergiichuk LGTM with a minor comment to address.
.map(StateSubscriberMethod::stateType) | ||
.map(StateClass::from) | ||
.collect(toImmutableSet()); | ||
ImmutableSet<StateClass> result = stateHandlers |
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.
Could you please format it like this:
ImmutableSet<StateClass> result =
stateHandlers
.stream()
.filter(StateSubscriberMethod.class::isInstance)
.map(StateSubscriberMethod.class::cast)
.filter(external ? HandlerMethod::isExternal : HandlerMethod::isDomestic)
.map(StateSubscriberMethod::stateType)
.map(StateClass::from)
.collect(toImmutableSet());
This PR fixes #1318.
In the PR I have relaxed the
HandlerMap
check on missing handlers while it is totally OK to not have a specific handler within a specific class. It's then up to the caller to verify and check how to behave when a handler is missing. In our case, all the respective callers already do check and filter out situations when no handlers are available. The only change one may notice is the error text available via theHandlerFailedUnexpectedly
event, instead of theIllegalStateException
, we'll see theEventValidationError
with theUNSUPPORTED_EVENT
code.