valhalla icon indicating copy to clipboard operation
valhalla copied to clipboard

8340409: [lworld] Simple serialization and deserialization of core migrated classes

Open RogerRiggs opened this issue 5 months ago • 4 comments

Serialization and deerialization of value classes. For java.base value classes migrated from identity classes:

  • Must be annotated with jdk.internal.MigratedValueClass (in tests too)
  • Must have a constructor or static factory method:
    • annotated with jdk.internal.value.DeserializeConstrucctor
    • constructor parameters must match order and types of serializable fields of the class
  • Value class must not have superclass with fields; only Object or abstract w/o fields
  • Uses same technique as for Records to extract and concat values from stream to invoke constructor
  • Migrated value classes are serialized using the same format/fields as the identity class

Non-migrated value classes throw InvalidClassException

Along the way, refactored code to break out different modes of deserialization: full custom deserialization with custom data, default deserialization only, externalizable, no local class, record, and then added mode to deserialize a value class.

Updates to value class tests and added a combo test to check many combinations of value and identity classes with different parameters.


Progress

  • [x] Change must not contain extraneous whitespace

Issue

  • JDK-8340409: [lworld] Simple serialization and deserialization of core migrated classes (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1248/head:pull/1248
$ git checkout pull/1248

Update a local copy of the PR:
$ git checkout pull/1248
$ git pull https://git.openjdk.org/valhalla.git pull/1248/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1248

View PR using the GUI difftool:
$ git pr show -t 1248

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1248.diff

Webrev

Link to Webrev Comment

RogerRiggs avatar Sep 18 '24 20:09 RogerRiggs