Skip to content

Conversation

graalvmbot
Copy link
Collaborator

This PR ensures that java.lang.Class initialization status is stable between layers: it registers the computed initialization kind extracted from the previous layer as the configured init kind in this layer when the AnalysisType is initialized. This will cause base layer types to have a strict initialization kind in this layer which will prevent further changes to the initialization kind, even in ways that would otherwise be considered compatible, e.g., RUN_TIME -> BUILD_TIME. Similarly, if a different initialization kind was already registered in this layer registration will fail.

Additionally this PR removes PersistedAnalysisType.isInitializedAtBuildTime which is redundant.

Note 1: I previously tried serializing the configured init kind for each type and then using that as the configured init in the next layer but that doesn't work: when querying the configured init kind in this layer if a class had a non-strict init kind, i.e., specified via a package prefix, then that config effectively becomes strict in the next layer, i.e., specified via the concrete type. This will prevent switching a non-strict init kind to a strict one when for example a sub-type init kind dictates it.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 2, 2025
@graalvmbot graalvmbot changed the title [GR-62449] Ensure that class initialization status is stable between layers. [GR-62449] Ensure that class initialization status is stable between layers. Jun 2, 2025
@graalvmbot graalvmbot closed this Jun 3, 2025
@graalvmbot graalvmbot deleted the cs/GR-62449-track-class-init-across-layers branch June 3, 2025 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

2 participants