Cache: fix CacheInterceptor in case of non-ArC interceptor bindings #43832
+4
−3
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.
RESTEasy Classic's MP RestClient implementation produces annotations at runtime, so they are not created by ArC and therefore don't extend
AbstractAnnotationLiteral
. At the same time, that implementation produces anArcInvocationContext
and puts interceptor bindings into its context map under the ArC key.Some places may expect that an
ArcInvocationContext
would always contain ArC-createdAbstractAnnotationLiteral
instances, but alas, per the description above, that is not the case.There are multiple options for fixing that collision. My preferred one would be to get rid of
AbstractAnnotationLiteral
and treat all annotations uniformly. That unfortunately has negative performance implications on theCacheInterceptor
, so is not an option yet [1].This commit chooses another path: it modifies the only place in Quarkus that actually depends on
AbstractAnnotationLiteral
to check whether theSet<AbstractAnnotationLiteral>
actually contains instances ofAbstractAnnotationLiteral
. I hope that before more places in Quarkus start depending onAbstractAnnotationLiteral
, we can get rid of it.This commit only checks the first annotation in the set, because if the bindings come from RESTEasy Classic, then none of them are instances of
AbstractAnnotationLiteral
, and if they come from ArC, then all of them are instances ofAbstractAnnotationLiteral
.[1] The performance issue (JDK-8180450) is fixed in JDK 23 and has
not been backported to any LTS release as of this writing.
Fixes #36336