Prevent null pointer exceptions in NextLabelCause #372
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.
Prevent null pointer exceptions in NextLabelCause
The equals method and the hashCode method both would throw a null pointer exception if the label in the constructor was null. I doubt that the label in the constructor has ever been null, but it is easy to safeguard those two methods so that they are null-safe.
The test code incorrectly tested the equals contract of the wrong class due to my copy and paste error. Test the correct class.
Uses the simple() verifier because the UpstreamCause class seems to have complications related to its superclass and I'd rather not spend the time to investigate further. The simple() verifier detected the null pointer exceptions, so it is still better than not testing.
Special thanks to @code-arnab for detecting and reporting the mistake in #371 (comment)
Testing done
Automated tests pass locally on Linux. Rely on ci.jenkins.io to test Windows.
Submitter checklist