Skip to content

Backport "Avoid NPE when calling hashCode on a value class wrapping null" to 3.8.2#25192

Merged
WojciechMazur merged 1 commit intorelease-3.8.2from
release-3.8.2_backport-25110
Feb 5, 2026
Merged

Backport "Avoid NPE when calling hashCode on a value class wrapping null" to 3.8.2#25192
WojciechMazur merged 1 commit intorelease-3.8.2from
release-3.8.2_backport-25110

Conversation

@WojciechMazur
Copy link
Copy Markdown
Contributor

Backports #25110 to the 3.8.2-RC2.

PR submitted by the release tooling.
[skip ci]

Change the synthetic hashCode for value classes from

  def hashCode(): Int = this.underlying.hashCode

to

  def hashCode(): Int = java.util.Objects.hashCode(this.underlying)

(unless the underlying value is primitive)

Forward-port of scala/scala#11204

[Cherry-picked eb274c2]
Base automatically changed from release-3.8.2_backport-25064 to release-3.8.2 February 5, 2026 15:43
@WojciechMazur
Copy link
Copy Markdown
Contributor Author

No regressions detected in the community build up to release-3.8.2_backport-25135.

Reference

@WojciechMazur WojciechMazur merged commit 008e74e into release-3.8.2 Feb 5, 2026
60 checks passed
@WojciechMazur WojciechMazur deleted the release-3.8.2_backport-25110 branch February 5, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants