8199865: Avoid initializing ShortCache in ProxyGenerator
authorredestad
Wed, 21 Mar 2018 10:13:14 +0100
changeset 49272 e137b71166c4
parent 49271 7b35d2a59fb3
child 49273 af8ab4f90a32
8199865: Avoid initializing ShortCache in ProxyGenerator Reviewed-by: mchung
src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java
--- a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java	Wed Mar 21 09:06:45 2018 +0000
+++ b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java	Wed Mar 21 10:13:14 2018 +0100
@@ -1726,7 +1726,7 @@
          * This map is used to look up the index of an existing entry for
          * values of all types.
          */
-        private Map<Object,Short> map = new HashMap<>(16);
+        private Map<Object,Integer> map = new HashMap<>(16);
 
         /** true if no new constant pool entries may be added */
         private boolean readOnly = false;
@@ -1878,7 +1878,7 @@
          *      java.lang.Double        CONSTANT_DOUBLE
          */
         private short getValue(Object key) {
-            Short index = map.get(key);
+            Integer index = map.get(key);
             if (index != null) {
                 return index.shortValue();
             } else {
@@ -1887,7 +1887,7 @@
                         "late constant pool addition: " + key);
                 }
                 short i = addEntry(new ValueEntry(key));
-                map.put(key, i);
+                map.put(key, (int)i);
                 return i;
             }
         }
@@ -1897,7 +1897,7 @@
          * references to other constant pool entries.
          */
         private short getIndirect(IndirectEntry e) {
-            Short index = map.get(e);
+            Integer index = map.get(e);
             if (index != null) {
                 return index.shortValue();
             } else {
@@ -1905,7 +1905,7 @@
                     throw new InternalError("late constant pool addition");
                 }
                 short i = addEntry(e);
-                map.put(e, i);
+                map.put(e, (int)i);
                 return i;
             }
         }