Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5616

Declare variables as ConcurrentMap not ConcurrentHashMap to avoid issues after compiling on Java 8

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.11.1
    • 5.12.0
    • Broker
    • None

    Description

      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

      Attachments

        1. AMQ5616.patch
          99 kB
          Timothy A. Bish

        Activity

          People

            tabish Timothy A. Bish
            tabish Timothy A. Bish
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: