[GR-57827] Move the initialization of security providers from build time to run time and place it behind the --future-defaults
flag.
#10143
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.
Motivation:
Currently, security providers are initialized at build time, which leads to several unwanted side effects, such as pulling unnecessary objects into the image heap and snapshotting values from the builder's JVM... (see #8674 and #5950). The only aspect related to the provider that still needs to happen at build time is provider verification. Since we can now initialize a class twice in Native Image (once at build time and again at run time), this gives us the opportunity to move their initialization to run time.
Code Walkthrough:
SecurityServicesFeature.java
).ServiceLoaderFeature.java
).SecurityProvidersSupport
), avoiding the need to keep provider objects in the image heap (seeSecuritySubstitutions
).SecuritySubstitutions
.XMLDSigRI
fromTrustStoreManager
.SecurityServiceTest
to align with the new changes.CHANGELOG.md
entry.Note: The feature is now hidden behind the --future-defaults=all or --future-defaults=run-time-initialized-jdk flag (take a look here for more details).