diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java index 282acdbe07b..5e73e051e69 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.swt.graphics; -import java.util.*; - import org.eclipse.swt.widgets.*; /** @@ -53,19 +51,12 @@ public Monitor getMonitor() { @Override public boolean equals(Object object) { - if (this == object) { - return true; - } - if (!super.equals(object)) { - return false; - } - MonitorAwarePoint other = (MonitorAwarePoint) object; - return Objects.equals(this.monitor, other.monitor); + return super.equals(object); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), monitor); + return super.hashCode(); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java index f20d620e356..c71ea94a389 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.swt.graphics; -import java.util.*; - import org.eclipse.swt.widgets.*; /** @@ -55,19 +53,12 @@ public Monitor getMonitor() { @Override public boolean equals(Object object) { - if (this == object) { - return true; - } - if (!super.equals(object)) { - return false; - } - MonitorAwareRectangle other = (MonitorAwareRectangle) object; - return Objects.equals(this.monitor, other.monitor); + return super.equals(object); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), monitor); + return super.hashCode(); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java index 6de7f344460..2aef2d06820 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java @@ -84,10 +84,9 @@ public boolean equals (Object object) { if (object == this) { return true; } - if (object.getClass() != this.getClass()) { + if (!(object instanceof Point other)) { return false; } - Point other = (Point) object; return (other.x == this.x) && (other.y == this.y); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java index b8e78d3b8da..e8060493d7e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java @@ -162,10 +162,9 @@ public boolean equals(Object object) { if (object == this) { return true; } - if (object.getClass() != this.getClass()) { + if (!(object instanceof Rectangle other)) { return false; } - Rectangle other = (Rectangle) object; return (other.x == this.x) && (other.y == this.y) && (other.width == this.width) && (other.height == this.height); }