Open vjovanov opened 8 months ago
Can there be cases where users want to exclude specific substitutions instead of all substitutions within a native-image.properties
? Should we have a possibility to exclude single substitutions within a native-image.properties
?
@turing85 this is a good question. This also noted by @fniephaus. I think such flag would not hurt as long as it is not an API flag. I will update the writing to add such flag.
- Make it possible to disable erroneous third-party substitutions.
This is implemented in https://github.com/oracle/graal/pull/9743 (not merged yet)
TL;DR
The Native Image substitutions are currently applied if they are found on the image-builder class path. This is problematic for the following reasons:
We need to make the usage of all substitutions explicit. This can be done via a new value
Substitutions
in thenative-image.properties
file. The valueSubstitutions
would be a coma-separated list of all fully-qualified classes annotated with@TargetClass
.The explicitly specified values are susceptible to the
--exclude-config
flag. This will make it possible for people to disable third-party substitutions of a library. In conjuction to--exclude-config
, we will provide-H:DisableSubstitutions=<fully-qualified-name-CSV>
to disable individual substitutions as excluding the whole config of a library requires re-introducing the library configuration that is not related to substitutions.The image build output will be modified to show the number of all user-space substitutions. The full list of classes will also be included into the crash reports for easier debugging.
Goals
Non-Goals
Migration
In the first step, the substitutions that are discovered on the class path but that are not specified in the
Substitutions
value would be output in a warning message:In the next step we would convert the warning into an error message with a possibility to disable the error via a flag.
In the third step there would not even be an error anymore, but the substitutions would simply be ignored.
The time duration between steps 1, 2, and 3 is to be discussed as it depends on the number of substitutions used in the community.