< prev index next >

src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -143,17 +143,29 @@
                  return true;
              }
          }
      }
  
+     /* No longer needed, but kept for future reference
+     boolean isValueObject() {
+         if (referenceType() instanceof ClassTypeImpl classType) {
+             return classType.isValueClass();
+         }
+         return false;
+     }
+     */
+ 
      public boolean equals(Object obj) {
          if (obj instanceof ObjectReferenceImpl other) {
-             return (ref() == other.ref()) &&
-                    super.equals(obj);
-         } else {
-             return false;
+             if (!super.equals(obj)) { // checks if the references belong to the same VM
+                 return false;
+             }
+             if (ref() == other.ref()) {
+                 return true;
+             }
          }
+         return false;
      }
  
      @Override
      public int hashCode() {
          return Long.hashCode(ref());
< prev index next >