< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/StampPair.java

Print this page

        

@@ -22,10 +22,12 @@
  */
 
 
 package org.graalvm.compiler.core.common.type;
 
+import java.util.Objects;
+
 /**
  * A pair of stamp with one being the stamp that can be trusted and the other one being a guess that
  * needs a dynamic check to be used.
  */
 public final class StampPair {

@@ -61,6 +63,24 @@
             return trustedStamp.toString();
         } else {
             return trustedStamp + " (unchecked=" + uncheckedStamp + ")";
         }
     }
+
+    @Override
+    public int hashCode() {
+        return trustedStamp.hashCode() + 11 + (uncheckedStamp != null ? uncheckedStamp.hashCode() : 0);
+
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (obj instanceof StampPair) {
+            StampPair other = (StampPair) obj;
+            return trustedStamp.equals(other.trustedStamp) && Objects.equals(uncheckedStamp, other.uncheckedStamp);
+        }
+        return false;
+    }
 }
< prev index next >