[cdi-dev] [JBoss JIRA] (CDI-476) Inheritance of private observer and initializer methods

Martin Kouba (JIRA) issues at jboss.org
Mon Sep 15 09:59:02 EDT 2014


Martin Kouba created CDI-476:
--------------------------------

             Summary: Inheritance of private observer and initializer methods
                 Key: CDI-476
                 URL: https://issues.jboss.org/browse/CDI-476
             Project: CDI Specification Issues
          Issue Type: Clarification
          Components: Inheritance and Specialization
    Affects Versions: 1.2.Final
            Reporter: Martin Kouba


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"
{quote}
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.
{quote}

"4.2. Inheritance of member-level metadata" (simplified):
{quote}
* 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().
{quote}
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?




--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the cdi-dev mailing list