Recently we came up across an observer resolution issue which concerns 10.3.1. Assignability of type variables, raw and parameterized types.

      What happens when you are trying to assign a non-parameterized subclass to a parameterized superclass?
      Here is a bit of code, we have following two classes:

      public interface QualifiedEvent<T> {
       // some methods
      public class EventImpl implements QualifiedEvent { //NOTE - implements raw type
       // some method impls

      Here is observer code:

          void listenForChildEvent(@Observes QualifiedEvent<Bar> foo) {
            // stuff going on here...

      And your event type is:

      new EventImpl(clazz);

      In this scenario, the spec is IMO unclear on what should happen in this particular case.

      Looking at other parts of spec, we already have this covered in, for instance, delegate injection point assignability, where it says:

      A raw bean type is considered assignable to a parameterized delegate type if the raw types are identical and all type parameters of the delegate type are either unbounded type variables or java.lang.Object.

      I think we should add a similar sentence to 10.3.1. Assignability of type variables, raw and parameterized types. That way the spec will behave coherently and the above observer/event assignability should not work.

      Side note - for the sample above to work, you would need to change the observed types to QualifiedEvent<?>.

        Gliffy Diagrams




              • Assignee:
                manovotn Matěj Novotný
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: