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

java.util.HashSet.contains() JavaDoc does not mirror implementation.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 7u55
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      JavaDoc

      A DESCRIPTION OF THE PROBLEM :
      The JavaDoc for HashSet.contains() explicitly states the method uses the native Object.equals() method for comparison between Set items, however, if you look at the source code you'll notice it explicitly compares the Set items hashCodes, not the items themselves as stated in the JavaDoc.
      The JavaDoc should be updated for this class (and possibly others?)

      This has no impact, but only after you waste some time debugging, just to finally download the sources and prove the javadoc wrong.

      Thank you


      REPRODUCIBILITY :
      This bug can be reproduced always.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: