-
Notifications
You must be signed in to change notification settings - Fork 134
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
NonComparableStreamSort validates direct types #1070
Conversation
Previously NonComparableStreamSort only failed on types which would cause a compilation error casting to Comparable. Now we validate that the stream type is a subtype of Comparable. This commit reduces the severity to WARNING because it's possible that the check will flag code that happens to work today, but we strongly recommend against sorting streams of a type that is not directly comparable without a custom comparator becuase it is likely to break later due to lack of enforcement by the type system.
Generate changelog in
|
This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days. |
not stale, just awaiting review |
Before this PR
Previously NonComparableStreamSort only failed on types which
would cause a compilation error casting to Comparable. Now we
validate that the stream type is a subtype of Comparable.
After this PR
==COMMIT_MSG==
Improve
NonComparableStreamSort
to validate that stream types implement comparable, as opposed to validating that casting to comparable does not cause a compiler error.This commit reduces the severity to WARNING because it's
possible that the check will flag code that happens to work
today, but we strongly recommend against sorting streams of
a type that is not directly comparable without a custom
comparator because it is likely to break later due to lack
of enforcement by the type system.
==COMMIT_MSG==
Possible downsides?
Possible this will cause friction if it flags new things. That friction is substantially lower than failures at runtime.