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

Initial size of UnicodeBlock map is incorrect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b24
    • CPU:
      generic
    • OS:
      generic

      Description

      The initial load size for UnicodeBlock.map is currently 649 as follows:

      ---
          public static final class UnicodeBlock extends Subset {
              /**
               * 649 - the expected number of entities
               * 0.75 - the default load factor of HashMap
               */
              private static Map<String, UnicodeBlock> map =
                      new HashMap<>((int)(649 / 0.75f + 1.0f));
      ---

      However, actually it is 667 in the latest 12 build. The discrepancy comes from incorrect upgrading of Unicode version, which did not count for extra aliases.
      Although this does not affect the actual performance (HashMap aligns initial capacity to a power of 2 size (= 1024 in both cases), this fix is desired for correctness.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              naoto Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: