Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed

Conversation

RogerRiggs
Copy link
Collaborator

@RogerRiggs RogerRiggs commented Sep 18, 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.


Progress

  • 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

…grated classes

Serialization and deerialization of value classes.
For java.base value classes being 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.
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2024

👋 Welcome back rriggs! A progress list of the required criteria for merging this PR into lworld will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 18, 2024

@RogerRiggs This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the lworld branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the lworld branch, type /integrate in a new comment.

@RogerRiggs RogerRiggs marked this pull request as ready for review September 20, 2024 19:51
@mlbridge
Copy link

mlbridge bot commented Sep 20, 2024

Webrevs

@openjdk
Copy link

openjdk bot commented Sep 24, 2024

@RogerRiggs this pull request can not be integrated into lworld due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout 8340409-simple-value-deserialize
git fetch https://git.openjdk.org/valhalla.git lworld
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge lworld"
git push

iae.printStackTrace();
return null;
}})
.filter(m -> matchFactoryParamTypes(clazz, m, fields))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m can be null here, so matchFactoryParamTypes needs to check that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After setAccessible IAE should never happen; change to throw InternalError.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds good. 👍

Tidy up unreachable IllegalAccessException after setAccessible; throw InternalError.
Move declaration of local into for loop header.
Cleanup TRACE Property parsing.
Improve test output readability.
@RogerRiggs
Copy link
Collaborator Author

Are there any more review comments; I'd like to get this integrated.

@RogerRiggs
Copy link
Collaborator Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 24, 2024

Going to push as commit e02c628.
Since your change was applied there has been 1 commit pushed to the lworld branch:

  • 72472c4: 8342276: [lworld] Apply LIBRARY.properties to stabiliize --enable-preview for tests

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated label Oct 24, 2024
@openjdk openjdk bot closed this Oct 24, 2024
@openjdk
Copy link

openjdk bot commented Oct 24, 2024

@RogerRiggs Pushed as commit e02c628.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants