Integrated: 8358624: ImmutableDescriptor violates equals/hashCode contract after deserialization
Kevin Walls
kevinw at openjdk.org
Fri Jun 27 15:02:34 UTC 2025
On Wed, 11 Jun 2025 15:08:09 GMT, Kevin Walls <kevinw at 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 <kevinw at 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
More information about the serviceability-dev
mailing list