Fix ambiguous bean resolution for sub resource interfaces with multiple implementations #47197
+132
−1
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.
Sub resource interfaces need to be scanned because of tests like this https://github.com/quarkusio/quarkus/blob/main/extensions/resteasy-reactive/rest/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorBaseResource.java#L50
Essentially, no implemting class of the interface exists, only a
Proxy.newProxyInstance
. The spec does not mention that this is allowed. I have personally never seen anyone use this sort of pattern - but this is a test that was copied from resteasy classic. So propably someone does use this.So instead of removing the test, and not scanning the sub resource interface anymore for the resource methods, no endpoint factory is created anymore for interfaces.
The result of a sub resource locator method, where the interface might have been used in practice, already returns an instance. So there is need for the endpoint factory for interfaces.
The same might be true for abstract classes with multiple implementations. However, #47003, prevents the ambiguous bean resolution error for them. I added a test case for abstract classes, to make sure they stay working at least.
closes #47107