Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8132856

HashMap: putAll() method has removed use of public method put()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8u51
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.8.0_31"
      Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7

      A DESCRIPTION OF THE PROBLEM :
      Description:
      Prior to JDK 1.8, putAll() method of HashMap was using public method put() for copying mapping of map as below:

      public void putAll(Map<? extends K, ? extends V> m) {
      [More...]
      for (Map.Entry<? extends K, ? extends V> e : m.entrySet())
      put(e.getKey(), e.getValue());
      }

      But now with the new implementation of HashMap has removed use of put() method and uses putMapEntries() which further uses putval() method in it which are final.


      Here the problem is occurring due to the JDK upgrade to 1.8:
      As in earlier version putAll() method is using put() method inside it.
      Classes which extends java.util.HashMap can override put() method to make a deep copy of a HashMap (as putAll() method was calling it).
      This is impacting the project which was build with old release 1.7 and now running with new jdk 1.8



      REGRESSION. Last worked in version 8u31


      REPRODUCIBILITY :
      This bug can be reproduced always.

      SUPPORT :
      YES

            psandoz Paul Sandoz
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: