eirikbakke commented on code in PR #8235:
URL: https://github.com/apache/netbeans/pull/8235#discussion_r1951841547


##########
platform/openide.util.ui/src/org/openide/util/ImageUtilities.java:
##########
@@ -1086,29 +1049,7 @@ private static ColorModel colorModel(int transparency) {
     /**
      * Key used for composite images -- it holds image identities
      */
-    private static class CompositeImageKey {
-        Image baseImage;
-        Image overlayImage;
-        int x;
-        int y;
-
-        CompositeImageKey(Image base, Image overlay, int x, int y) {
-            this.x = x;
-            this.y = y;
-            this.baseImage = base;
-            this.overlayImage = overlay;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof CompositeImageKey)) {
-                return false;
-            }
-
-            CompositeImageKey k = (CompositeImageKey) other;
-
-            return (x == k.x) && (y == k.y) && (baseImage == k.baseImage) && 
(overlayImage == k.overlayImage);
-        }
+    private record CompositeImageKey(Image baseImage, Image overlayImage, int 
x, int y) {

Review Comment:
   Switching this to record will change the comparison of Image from identity 
comparison to comparison using equals(). That may be fine since BufferedImage 
does not actually define equals or hashCode. But then we should remove the 
custom hashCode() implementation as well for consistency.



##########
platform/openide.util.ui/src/org/openide/util/ImageUtilities.java:
##########
@@ -1127,23 +1068,7 @@ public String toString() {
     /**
      * Key used for ToolTippedImage
      */
-    private static class ToolTipImageKey {
-        Image image;
-        String str;
-
-        ToolTipImageKey(Image image, String str) {
-            this.image = image;
-            this.str = str;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof ToolTipImageKey)) {
-                return false;
-            }
-            ToolTipImageKey k = (ToolTipImageKey) other;
-            return (str.equals(k.str)) && (image == k.image);
-        }
+    private record ToolTipImageKey(Image image, String str) {

Review Comment:
   Same thing here; we should not define a custom hashCode when we are using 
record, no?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to