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 - Using @Typed with illegal values should throw an exception #30452

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

manovotn
Copy link
Contributor

@manovotn manovotn commented Jan 18, 2023

ATM, Arc allows you to use @Typed with arbitrary values and it simply ignores any that aren't part of the transitive closure of bean types.

However, this conflicts the specification:

If a bean class or producer method or field specifies a @typed annotation, and the value member specifies a class which does not correspond to a type in the unrestricted set of bean types of a bean, the container automatically detects the problem and treats it as a definition error.

Therefore, we are now throwing a DefinitionException that looks like this:

javax.enterprise.inject.spi.DefinitionException: Cannot limit bean types to types outside of the transitive closure of bean types. Bean: io.quarkus.arc.test.resolution.broken.ProducedBean produceBean() illegal bean types: [io.quarkus.arc.test.resolution.broken.MyOtherBean]

As usual, the PR also contains tests that showcase it.

Related to #28558

@quarkus-bot quarkus-bot bot added the area/arc Issue related to ARC (dependency injection) label Jan 18, 2023
@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Jan 18, 2023
@quarkus-bot

This comment has been minimized.

@quarkus-bot
Copy link

quarkus-bot bot commented Jan 19, 2023

✔️ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@gsmet
Copy link
Member

gsmet commented Jan 19, 2023

@Ladicek I let you review and merge that one if you're happy.

@Ladicek Ladicek merged commit e3fccfb into quarkusio:main Jan 19, 2023
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Jan 19, 2023
@quarkus-bot quarkus-bot bot added this to the 2.17 - main milestone Jan 19, 2023
@manovotn manovotn deleted the restrictedBeanTypesFix branch January 19, 2023 15:29
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants