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

add idempotent copy operation for Map.Entry

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "9.0.4"
      Java(TM) SE Runtime Environment (build 9.0.4+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.16299.248]

      A DESCRIPTION OF THE PROBLEM :
      java.util.AbstractMap.SimpleImmutableEntry is not actually immutable so methods receiving a SimpleImmutableEntry are forced to make defensive copies, defeating the entire purpose of this class.

      The fact that the class is not final allows malicious sub-classes to declare mutable key2 and value2 and redirect calls to them.

      Please make SimpleImmutableEntry final, or deprecate it and provide an immutable replacement.


      REPRODUCIBILITY :
      This bug can be reproduced always.

            smarks Stuart Marks
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: