-
Notifications
You must be signed in to change notification settings - Fork 334
Core: resolveAll() must be called before reading resolution results #3064
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
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.
Thanks for fix @flyrain !
| // Set when resolveAll is called | ||
| private ResolverStatus primaryResolverStatus = null; | ||
|
|
||
| private ResolverStatus requirePrimaryResolverStatus() { |
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.
minor : require gives an impression that its just doing assertion, but its additionally returning status how about this
| private ResolverStatus requirePrimaryResolverStatus() { | |
| private ResolverStatus safeGetPrimaryResolverStatus() { |
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.
Refactored a bit. Thanks for the suggestion.
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.
Thx! The new code is much nicer 🙂
|
|
||
| public PolarisResolvedPathWrapper getResolvedReferenceCatalogEntity( | ||
| boolean prependRootContainer) { | ||
| requirePrimaryResolverStatus(); |
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.
[doubt] is just checking status not null sufficient ? or should we bake the assertion that that status != null and status = SUCCESS ?
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.
That's a good point. Removed this line to avoid any behavior change.
dimas-b
left a comment
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.
@flyrain : could you explain why "resolveAll() must be called before reading resolution results"? The PR description provides information about enforcing it, but the rationale for doing that is not very clear... at least to me 😅 Thx!
The result will be invalid, or null if it's not invoked. The concurrent code actually already enforce that. You can find the following code in each place reading the result, but NPE will be threw in case of |
singhpk234
left a comment
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.
LGTM thanks @flyrain !
To fail fast and explicitly when resolveAll() isn't called before reading the results
Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)