Fix SmallRye Fault Tolerance build-time class loading #19609
Merged
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.
The Fault Tolerance extension performs discovery at build time.
It finds bean classes that use fault tolerance annotations and
passes that information to runtime (where SmallRye Fault Tolerance
applies runtime configuration). To represent types, SmallRye
Fault Tolerance uses
Class
objects, and so the discovery processused to load bean classes from the deployment classloader.
This works fine, unless one of the bean classes is generated
by another Quarkus extension. These generated classes are stored
in memory and the deployment classloader doesn't know about them.
Naturally, attempting to load the class fails and aborts the build.
This commit fixes the problem by not loading the classes at all.
Instead, a class proxy is generated for each class. This still lets
us use
Class
objects to represent types, but they are never loadedduring build, only at runtime.
The class proxy construct is marked as deprecated, because loading
classes at build time is possible (it wasn't in the past). In this
situation, though, where the class potentially isn't available,
it's a perfect fit.
Fixes #19606.