Add opt-in link-at-build-time option to fail fast on NoClassDefFound #9856
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.
This is a resurrection of #6725 as #6253 turns out to not be completely fixed after all (see #6253 (comment)).
According to @fniephaus in #6753 (comment)
So I asked for more details to see if I can implement that idea and get a proper fix in.
In the meantime, #6253 (originally reported in #4661) is a long standing issue for Quarkus users and we would really like a fix for it (even a work around like the one I propose). Note that by default Quarkus initializes and links all classes at build time, so this is not a corner case for Quarkus.
This PR works around #6253, by providing users the option to fail fast if a class is missing and they are linking at build time. The option is intentionally made an opt-in in order to not alter the current behavior till a proper fix is available and it should be completely removed once we get that in.
To try this out you may run:
Passing `-H:+LinkAtBuildTimeFailFast` results in the following output:
while without it we get: