[cdi-dev] [JBoss JIRA] (CDI-527) allow proxying of classes with non-private final methods

Martin Kouba (JIRA) issues at jboss.org
Wed Dec 16 03:47:01 EST 2015

    [ https://issues.jboss.org/browse/CDI-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13141673#comment-13141673 ] 

Martin Kouba commented on CDI-527:

+1 for A
-1 for introducing a system property

>From the user point of view - creating a producer for a third-party class is always risky (and it's not only about final methods, consider for example passivation scopes). For now there are two workarounds for JDK's HashMap/ConcurrentHashMap and similar use-cases:
# use the Map/ConcurrentMap interface as the bean class field/return type - bean author
# inject the Map/ConcurrentMap interface - bean consumer (see also my comment https://issues.jboss.org/browse/CDI-527?focusedCommentId=13120531&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13120531)

bq. We need to provide a way for the applications to continue working.
Emily, I understand your point. But I don't think it's a good solution to transfer responsibility to CDI.

> allow proxying of classes with non-private final methods
> --------------------------------------------------------
>                 Key: CDI-527
>                 URL: https://issues.jboss.org/browse/CDI-527
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Beans
>    Affects Versions: 1.2.Final
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.0 (proposed)
> Currently we explicitly disallow proxying of classes with non-private final methods. 
> EJB _does_ allow this. And there are a few final methods in the JDK and other libs. E.g. HashMap#initHashSeedAsNeeded. Currently we cannot have a producer method for it.
> We might rethink our decision and allow it. Probably with an own annotation like @AllowProxying which disables this check for certain cases (subclass managed-beans or producers).

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list