[ 
https://issues.apache.org/jira/browse/SLING-3923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14132690#comment-14132690
 ] 

ASF GitHub Bot commented on SLING-3923:
---------------------------------------

GitHub user kwin opened a pull request:

    https://github.com/apache/sling/pull/27

    SLING-3923, support method overriding in postconstruct

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kwin/sling 
SLING-3923-postconstructoroverridding

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/sling/pull/27.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #27
    
----
commit 37381578b1a3f71b886864151fdd2294d3971f6a
Author: Konrad Windszus <[email protected]>
Date:   2014-09-13T13:04:08Z

    SLING-3923, support method overriding in postconstruct

----


> PostConstruct method may be called multiple times for one instance
> ------------------------------------------------------------------
>
>                 Key: SLING-3923
>                 URL: https://issues.apache.org/jira/browse/SLING-3923
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Sling Models Implementation 1.1.0
>            Reporter: Konrad Windszus
>              Labels: models
>
> The problem is in 
> https://github.com/apache/sling/blob/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java#L732.
> There all @PostConstruct annotated methods are being collected (starting from 
> current class, but including also all super classes). Now you might end up 
> with 2 methods (one in the current and one in the super class).
> The problem appears if those methods have the same signature (i.e. name and 
> parametrization) because then you are not able to call the post construct in 
> the super class (compare with 
> https://blogs.oracle.com/sundararajan/entry/calling_overriden_superclass_method_on).
> Therefore I would propose the following fix:
> Only add post construct methods from superclasses if they have a different 
> signature.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to