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

Roger Riggs rriggs at openjdk.org
Wed Oct 9 18:17:34 UTC 2024


> 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.

Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:

  From review comments.
  Tidy up unreachable IllegalAccessException after setAccessible; throw InternalError.
  Move declaration of local into for loop header.
  Cleanup TRACE Property parsing.
  Improve test output readability.

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1248/files
  - new: https://git.openjdk.org/valhalla/pull/1248/files/df2b4ef8..9ec46a99

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=1248&range=02
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1248&range=01-02

  Stats: 18 lines in 3 files changed: 7 ins; 3 del; 8 mod
  Patch: https://git.openjdk.org/valhalla/pull/1248.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1248/head:pull/1248

PR: https://git.openjdk.org/valhalla/pull/1248


More information about the valhalla-dev mailing list