[GR-41978] Disallow --initialize-at-build-time without arguments. #5266
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.
Using
--initialize-at-build-time=
without a package or class name is problematic because it does not compose, i.e., a single library can make assumptions that the whole classpath can be safely initialized at build time. That assumption is often incorrect.Since GraalVM 21.3, a warning message is printed when
--initialize-at-build-time=
is used. This PR converts the warning to an error.One exception where
--initialize-at-build-time=
is allowed is the command line, i.e., if you have an application where you know the application and all its dependencies are safe for initialization at build time, then--initialize-at-build-time=
can be provided on the command line.@tomas-langer One known problematic usage is in Helidon MP: https://github.com/helidon-io/helidon/blob/helidon-3.x/microprofile/cdi/src/main/resources/META-INF/native-image/io.helidon.microprofile.cdi/helidon-microprofile-cdi/native-image.properties#L18
All other tests that we have in our test infrastructure passed without the new flag to temporarily convert the error back to a warning.