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

ClassValue.ClassValueMap.type is unused

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 9
    • 9
    • core-libs
    • b15
    • generic
    • generic

      It seems save and correct to remove that field.

      diff -r e554994dd16a src/share/classes/java/lang/ClassValue.java
      --- a/src/share/classes/java/lang/ClassValue.java Fri Dec 13 09:36:06 2013 -0800
      +++ b/src/share/classes/java/lang/ClassValue.java Thu Jan 23 13:00:37 2014 -0800
      @@ -375,10 +375,10 @@ public abstract class ClassValue<T> {
               synchronized (CRITICAL_SECTION) { // private object to avoid deadlocks
                   // happens about once per type
                   if ((map = type.classValueMap) == null)
      - type.classValueMap = map = new ClassValueMap(type);
      + type.classValueMap = map = new ClassValueMap();
               }
      - return map;
      - }
      + return map;
      + }
       
           static <T> Entry<T> makeEntry(Version<T> explicitVersion, T value) {
               // Note that explicitVersion might be different from this.version.
      @@ -398,12 +398,11 @@ public abstract class ClassValue<T> {
       
           // The following class could also be top level and non-public:
       
      - /** A backing map for all ClassValues, relative a single given type.
      + /** A backing map for all ClassValues.
            * Gives a fully serialized "true state" for each pair (ClassValue cv, Class type).
            * Also manages an unserialized fast-path cache.
            */
           static class ClassValueMap extends WeakHashMap<ClassValue.Identity, Entry<?>> {
      - private final Class<?> type;
               private Entry<?>[] cacheArray;
               private int cacheLoad, cacheLoadLimit;
       
      @@ -413,11 +412,10 @@ public abstract class ClassValue<T> {
                */
               private static final int INITIAL_ENTRIES = 32;
       
      - /** Build a backing map for ClassValues, relative the given type.
      + /** Build a backing map for ClassValues.
                * Also, create an empty cache array and install it on the class.
                */
      - ClassValueMap(Class<?> type) {
      - this.type = type;
      + ClassValueMap() {
                   sizeCache(INITIAL_ENTRIES);
               }
       

            twisti Christian Thalinger (Inactive)
            twisti Christian Thalinger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: