Skip to content

Conversation

graalvmbot
Copy link
Collaborator

Serialization metadata is now part of reflection metadata. For a type to be registered as serializable, the field "serializable" must be set to true inside of the type reflection registration. For example, the following reachability-metadata.json file:

{
  "reflection": [
    {
      "type": "fully.qualified.ClassName"
    }
  ],
  "serialization": [
    {
      "type": "fully.qualified.ClassName"
    }
  ]
}

can now be expressed with the much simpler:

{
  "reflection": [
    {
      "type": "fully.qualified.ClassName",
      "serializable": true
    }
  ]
}

As a side effect, types registered for serialization have to be explicitly registered for reflection as well. This was already done in the background, so the change has no image size impact.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 3, 2024
@loicottet loicottet self-assigned this Dec 3, 2024
@zakkak
Copy link
Collaborator

zakkak commented Dec 3, 2024

+1 That makes sense and interestingly it's similar to what Quarkus does.

@loicottet are there plans to backport this to GraalVM for JDK 21 as well?

@graalvmbot graalvmbot force-pushed the lottet/GR-60237-serialize-flag branch 3 times, most recently from 2f0e65a to 7a26b47 Compare December 4, 2024 13:36
@loicottet
Copy link
Member

@loicottet are there plans to backport this to GraalVM for JDK 21 as well?

Yes, reachability-metadata.json files that use "serializable" will be understood by GraalVM for JDK 21

@graalvmbot graalvmbot force-pushed the lottet/GR-60237-serialize-flag branch from 860e870 to 6b4e66a Compare December 13, 2024 11:19
@graalvmbot graalvmbot closed this Dec 13, 2024
@graalvmbot graalvmbot deleted the lottet/GR-60237-serialize-flag branch December 13, 2024 13:43
@graalvmbot graalvmbot merged commit df1ab87 into master Dec 13, 2024
13 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants