On Wed, 11 Jun 2025 15:08:09 GMT, Kevin Walls <kev...@openjdk.org> wrote:

> Hashcode needs to be reset to -1 to force its recalculation on next call, 
> after deserialization.
> 
> The change in the readResolve() method is the fix for this problem.  While 
> here I added similar lines in other methods that may update fields (although 
> these are noted as not supported, as they change a class supposedly 
> "immutable").
> 
> Added a test.  There is a test for serialization for this class, but I found 
> it clearer to add the test for this specific recently discovered issue in its 
> own test file.

This pull request has now been integrated.

Changeset: 12196baf
Author:    Kevin Walls <kev...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/12196baf6700d00c244747cfa22767e532a4a963
Stats:     82 lines in 2 files changed: 82 ins; 0 del; 0 mod

8358624: ImmutableDescriptor violates equals/hashCode contract after 
deserialization

Reviewed-by: cjplummer, sspitsyn

-------------

PR: https://git.openjdk.org/jdk/pull/25758

Reply via email to