[GR-49525] Mechanism to move JDK initialization to run time. #10531
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are reducing build-time initialization of the JDK in following GraalVM versions. This means that many substitutions for run-time-initialized parts of the JDK will not be needed anymore.
Problems:
How to avoid code breakage
We introduce
-H:+InitializeJDKAtBuildTimeMigration
that will keep the previous initialization functionality. This flag will simply enable a feature that build-time initializes the same set of classes as the previous GraalVM versions.The build-time initialization error message would be augmented with a note that they can use the previous behavior with
-H:+InitializeJDKAtBuildTimeMigration
until they introduce all required-initialize-at-build-time=<class>
.How to support build-time initialized projects
Introduce a separate package for build-time initialization substitutions and make them available only if the class is initialized at build time.
This will require a slight change in the way we handle
TargetClass
:If needed we will provide an API for
markedAsBuildTimeInitialized
inRuntimeClassInitialization
.This package will be maintained by the GraalVM team until the JDK initialization minimization is complete. After that, it would be handed over for maintenance to the community.
The same package would be moved into a spearate community maintained project when we remove
-H:+MigrationInitializeJDKAtBuildTime
.Example usage: #10537