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

Optimize IntHashTable for encapsulation and ease of use

    XMLWordPrintable

Details

    • b22
    • generic
    • generic

    Backports

      Description

        Currently, the class `com.sun.tools.javac.util.IntHashTable` exposes the methods `hash(Object key)` and `lookup(Object key)`. It is not good because they are internal methods to achieve the features.

        On the other hand, the index of the mapping (key or value) is the internal data struct. The javac developers who use this class should not know or use the index outside `IntHashTable`. So the parameters of the following methods could be revised.

        1. lookup(Object key, int hash) -> lookup(Object key)
        2. getFromIndex(int index) -> get(Object key)
        3. putAtIndex(Object key, int value, int index) -> put(Object key, int value)

        And the corresponding places where they are used need to be adjusted too.

        Attachments

          Issue Links

            Activity

              People

                gli Guoxiong Li
                gli Guoxiong Li
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: