Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arc - allow @All injection points for parameterizes types with wildcards #32158

Closed
wants to merge 1 commit into from

Conversation

manovotn
Copy link
Contributor

Fixes #32080

Allow to declare an injection points using @All that contain wildcards in their parameterized types.
Up until now we registered a synthetic bean which contained a wildcard in it - something that our own assignability rules didn't expect. This change inspects the required bean type and changed it by replacing the wildcard with it's bounds or Object type.

Note that directly declaring a wildcard is still prohibited as per our documentation and leads to a deployment error.

@manovotn manovotn requested review from Ladicek and mkouba March 27, 2023 13:56
@quarkus-bot quarkus-bot bot added the area/arc Issue related to ARC (dependency injection) label Mar 27, 2023
if (wildcard.extendsBound() != null && !wildcard.extendsBound().equals(ClassType.OBJECT_TYPE)) {
typeArray[i] = wildcard.extendsBound();
} else if (wildcard.superBound() != null && !wildcard.superBound().equals(ClassType.OBJECT_TYPE)) {
typeArray[i] = wildcard.superBound();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically wrong because it will effectively reduce List<Some<? extends Integer>> to List<Some<Integer>> which in turn means that such list cannot contain items like Some<Number>.
Using upper bounds instead (i.e. List<Some<Object>>) has similar problem because you can then insert items such as Some<String> which is incorrect.

We need to look into how to implement this differently, possibly via a built-in bean.

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 27, 2023

Failing Jobs - Building c357feb

Status Name Step Failures Logs Raw logs
✔️ Gradle Tests - JDK 11
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Gradle Tests - JDK 11 Windows #

📦 integration-tests/gradle

io.quarkus.gradle.devmode.MultiSourceProjectDevModeTest.main line 22 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference, java.util.concurrent.atomic.AtomicReferencejava.lang.String, java.lang.Stringboolean was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

@manovotn
Copy link
Contributor Author

Superseeded by #32179

@manovotn manovotn closed this Mar 28, 2023
@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't inject list of interfaces with wildcards twice into beans
1 participant