Skip to content

Commit 3887356

Browse files
committed
Remove obsolete hashCode/equals for Region
This commit removes the obsolete equals and hashCode methods for Region. For the upcoming changes for win32 the current implementation cannot be used anymore because all handles will be created on demand. As the current implementation is equal in their behavior to the base behavior for these methods inherited from Object they will be removed.
1 parent 0368a6b commit 3887356

File tree

3 files changed

+0
-97
lines changed

3 files changed

+0
-97
lines changed

bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -424,23 +424,6 @@ void destroy() {
424424
handle = 0;
425425
}
426426

427-
/**
428-
* Compares the argument to the receiver, and returns true
429-
* if they represent the <em>same</em> object using a class
430-
* specific comparison.
431-
*
432-
* @param object the object to compare with this object
433-
* @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
434-
*
435-
* @see #hashCode
436-
*/
437-
@Override
438-
public boolean equals(Object object) {
439-
if (this == object) return true;
440-
if (!(object instanceof Region region)) return false;
441-
return handle == region.handle;
442-
}
443-
444427
/**
445428
* Returns a rectangle which represents the rectangular
446429
* union of the collection of polygons the receiver
@@ -499,21 +482,6 @@ long regionToRects(long message, long rgn, long r, long path) {
499482
return 0;
500483
}
501484

502-
/**
503-
* Returns an integer hash code for the receiver. Any two
504-
* objects that return <code>true</code> when passed to
505-
* <code>equals</code> must return the same value for this
506-
* method.
507-
*
508-
* @return the receiver's hash
509-
*
510-
* @see #equals
511-
*/
512-
@Override
513-
public int hashCode() {
514-
return (int)handle;
515-
}
516-
517485
/**
518486
* Intersects the given rectangle to the collection of polygons
519487
* the receiver maintains to describe its area.

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -298,24 +298,6 @@ void destroy() {
298298
handle = 0;
299299
}
300300

301-
/**
302-
* Compares the argument to the receiver, and returns true
303-
* if they represent the <em>same</em> object using a class
304-
* specific comparison.
305-
*
306-
* @param object the object to compare with this object
307-
* @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
308-
*
309-
* @see #hashCode
310-
*/
311-
@Override
312-
public boolean equals(Object object) {
313-
if (this == object) return true;
314-
if (!(object instanceof Region)) return false;
315-
Region region = (Region)object;
316-
return handle == region.handle;
317-
}
318-
319301
/**
320302
* Returns a rectangle which represents the rectangular
321303
* union of the collection of polygons the receiver
@@ -359,21 +341,6 @@ public static Region gtk_new(Device device, long handle) {
359341
return new Region(device, handle);
360342
}
361343

362-
/**
363-
* Returns an integer hash code for the receiver. Any two
364-
* objects that return <code>true</code> when passed to
365-
* <code>equals</code> must return the same value for this
366-
* method.
367-
*
368-
* @return the receiver's hash
369-
*
370-
* @see #equals
371-
*/
372-
@Override
373-
public int hashCode() {
374-
return (int)handle;
375-
}
376-
377344
/**
378345
* Intersects the given rectangle to the collection of polygons
379346
* the receiver maintains to describe its area.

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -241,24 +241,6 @@ void destroyHandlesExcept(Set<Integer> zoomLevels) {
241241
});
242242
}
243243

244-
/**
245-
* Compares the argument to the receiver, and returns true
246-
* if they represent the <em>same</em> object using a class
247-
* specific comparison.
248-
*
249-
* @param object the object to compare with this object
250-
* @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
251-
*
252-
* @see #hashCode
253-
*/
254-
@Override
255-
public boolean equals (Object object) {
256-
if (this == object) return true;
257-
if (!(object instanceof Region)) return false;
258-
Region rgn = (Region)object;
259-
return getHandleForInitialZoom() == rgn.getHandleForInitialZoom();
260-
}
261-
262244
/**
263245
* Returns a rectangle which represents the rectangular
264246
* union of the collection of polygons the receiver
@@ -283,20 +265,6 @@ Rectangle getBoundsInPixels() {
283265
return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
284266
}
285267

286-
/**
287-
* Returns an integer hash code for the receiver. Any two
288-
* objects that return <code>true</code> when passed to
289-
* <code>equals</code> must return the same value for this
290-
* method.
291-
*
292-
* @return the receiver's hash
293-
*
294-
* @see #equals
295-
*/
296-
@Override
297-
public int hashCode () {
298-
return (int)getHandleForInitialZoom();
299-
}
300268

301269
/**
302270
* Intersects the given rectangle to the collection of polygons

0 commit comments

Comments
 (0)