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 20:22:04 UTC
[jira] [Created] (AMQ-5616) Declare variables as ConcurrentMap not
ConcurrentHashMap to avoid issues after compiling on Java 8
Timothy Bish created AMQ-5616:
---------------------------------
Summary: 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
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)