Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2338

Revise the check of valid injection points for an extension observer method with observed type java.lang.Object and a qualifier other than @Any

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.0.0.CR2, 2.4.3.Final
    • Component/s: None
    • Labels:
      None

      Description

      Right now, the following observers cannot be declared on an extension:

      void first(@Observes Object foo,  Bar bar) {
      }
      void second(@Observes @Foo Object foo,  Bar bar) {
      }
      

      whereas this one is allowed:

      void third(@Observes Foo foo,  Bar bar) {
      }
      

      Note that the first observer would be notified even for container lifecycle events and so it's considered a container lifecycle event observer. However, the second observer is incorrectly considered a container lifecycle event observer too.

      Observers.isContainerLifecycleObserverMethod() should return false for an observer with observed type java.lang.Object and a qualifier other than @Any.

      Note that all the above observers are defined as non-portable in the spec. The problem is that extensions can communicate using events and so the required beans may be not discovered/available yet.

      However, I think Weld should be consistent here. If third is allowed, the second should be allowed too.

        Attachments

          Activity

            People

            Assignee:
            manovotn Matěj Novotný
            Reporter:
            mkouba Martin Kouba
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: