You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2015/02/25 21:37:04 UTC

[jira] [Updated] (AMQ-5616) Declare variables as ConcurrentMap not ConcurrentHashMap to avoid issues after compiling on Java 8

     [ https://issues.apache.org/jira/browse/AMQ-5616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQ-5616:
------------------------------
    Attachment: AMQ5616.patch

Initial pass at this task, need to validate and test full suite.

> Declare variables as ConcurrentMap not ConcurrentHashMap to avoid issues after compiling on Java 8
> --------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-5616
>                 URL: https://issues.apache.org/jira/browse/AMQ-5616
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.11.1
>            Reporter: Timothy Bish
>            Assignee: Timothy Bish
>            Priority: Minor
>             Fix For: 5.12.0
>
>         Attachments: AMQ5616.patch
>
>
> Java 8 redefines the method keySet() on ConcurrentHashMap to return a narrower type than the standard return type given in the Map interface. If the code is compiled in Java 8 and then run under Java 7 this causes linking issues.  We don't depend on the narrowed type and can live with the standard for our usages of ConcurrentHashMap
> We can avoid these issues by always declaring the instances of ConcurrentHashMap where we need method like putIfAbsent in terms of the interface ConcurrentMap



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