activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMQ-5616) Declare variables as ConcurrentMap not ConcurrentHashMap to avoid issues after compiling on Java 8
Date Wed, 25 Feb 2015 19:22:04 GMT
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)

Mime
View raw message