src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: Otavio Santana <otaviojava@java.net>

@@ -779,11 +779,11 @@
          */
         if (signature != null) {
             type.setSignature(signature);
         }
 
-        typesByID.put(new Long(id), type);
+        typesByID.put(id, type);
         typesBySignature.add(type);
 
         if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
            vm.printTrace("Caching new ReferenceType, sig=" + signature +
                          ", id=" + id);

@@ -807,11 +807,11 @@
             ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
             int comp = signature.compareTo(type.signature());
             if (comp == 0) {
                 matches++;
                 iter.remove();
-                typesByID.remove(new Long(type.ref()));
+                typesByID.remove(type.ref());
                 if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
                    vm.printTrace("Uncaching ReferenceType, sig=" + signature +
                                  ", id=" + type.ref());
                 }
 /* fix for 4359077 , don't break out. list is no longer sorted

@@ -893,11 +893,11 @@
             return null;
         } else {
             ReferenceTypeImpl retType = null;
             synchronized (this) {
                 if (typesByID != null) {
-                    retType = (ReferenceTypeImpl)typesByID.get(new Long(id));
+                    retType = (ReferenceTypeImpl)typesByID.get(id);
                 }
                 if (retType == null) {
                     retType = addReferenceType(id, tag, signature);
                 }
             }

@@ -1245,11 +1245,11 @@
 
         if (id == 0) {
             return null;
         }
         ObjectReferenceImpl object = null;
-        Long key = new Long(id);
+        Long key = id;
 
         /*
          * Attempt to retrieve an existing object object reference
          */
         SoftObjectReference ref = objectsByID.get(key);

@@ -1311,11 +1311,11 @@
     synchronized void removeObjectMirror(ObjectReferenceImpl object) {
 
         // Handle any queue elements that are not strongly reachable
         processQueue();
 
-        SoftObjectReference ref = objectsByID.remove(new Long(object.ref()));
+        SoftObjectReference ref = objectsByID.remove(object.ref());
         if (ref != null) {
             batchForDispose(ref);
         } else {
             /*
              * If there's a live ObjectReference about, it better be part