Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-476

Inheritance of private observer and initializer methods

XMLWordPrintable

    • Icon: Clarification Clarification
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 1.2.Final
    • None

      Initializer and observer methods may be private. In Java, private members are not inherited. However, the spec is not entirely clear in this area.

      "4. Inheritance and specialization"

      Member-level metadata is not inherited. However, injected fields, initializer methods, lifecycle callback methods and non-static observer methods are inherited by beans from their superclasses.

      "4.2. Inheritance of member-level metadata" (simplified):

      • If X declares an initializer or non-static observer method x() then Y inherits x() if and only if neither Y nor any intermediate class that is a subclass of X and a superclass of Y overrides the method x().

      There is no mention we strictly follow the JSL here. At first glance, it seems the private members should not be inherited. However, these may be part of a bean initialization. And what happens if we specialize a bean with such private members?

              Unassigned Unassigned
              mkouba@redhat.com Martin Kouba
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: