Skip to content

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

Open
WojciechMazur wants to merge 1 commit intorelease-3.8.2_backport-25064from
release-3.8.2_backport-25110
Open

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

Conversation

@WojciechMazur
Copy link
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]
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