Skip to content

Validation of wildcard Event and Instance injection is too strict #3362

@manovotn

Description

@manovotn

ATM (and since forever) Weld has been rejecting injection of any Event/Instance with wildcard in it.
However, as has been pointed out recently in jakartaee/cdi#888 (comment), this is theoretically incorrect.
I say theoretically, because there is no actual added value in being able to @Inject Event<? super Something> versus just @Inject Event<Something>. You'd still fire the same events from both.

That said, Event is naturally contravariant and should therefore allow ? super X, while Instance is covariant and should allow ? extends Y.
At the same time, we want to keep rejecting all the other variants such as unbound wildcard.

This change should go to Weld 6 and 7 alike.
CDI TCK - jakartaee/cdi-tck#727
CDI - jakartaee/cdi#982

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions