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

Incorrect use of ConcurrentHashMap.contains in SunFontManager.java

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 9
    • None
    • client-libs
    • 2d
    • b117
    • generic
    • linux

      SunFontManager.java invokes ConcurrentHashMap.contains(Object), which is denigrated.
      If you change that method to be @Deprecated, the build fails with

      jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java:1847: warning: [deprecation] contains(Object) in ConcurrentHashMap has been deprecated
                  !registeredFonts.contains(file)) {

      contains is equivalent to containsValue and that would be a good change to make, except that it looks like the intent was to check for a key, i.e. the author intended a call to containsKey(Object) and fell into the contains trap.

            prr Philip Race
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: