[
https://issues.apache.org/jira/browse/SLING-3923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Edelson updated SLING-3923:
----------------------------------
Fix Version/s: Sling Models Impl 1.2.0
> 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
> Assignee: Justin Edelson
> Labels: models
> Fix For: Sling Models Impl 1.2.0
>
> Original Estimate: 0h
> Remaining Estimate: 0h
>
> 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)