فهرست منبع

RenderDeviceJme: CachedTextKey.equals() lacks a type check (#1768)

Stephen Gold 3 سال پیش
والد
کامیت
2a661dc707
1فایلهای تغییر یافته به همراه14 افزوده شده و 5 حذف شده
  1. 14 5
      jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java

+ 14 - 5
jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java

@@ -94,11 +94,20 @@ public class RenderDeviceJme implements RenderDevice {
         }
 
         @Override
-        public boolean equals(Object other) {
-            CachedTextKey otherKey = (CachedTextKey) other;
-            return font.equals(otherKey.font) &&
-                   text.equals(otherKey.text)/* &&
-                   color.equals(otherKey.color)*/;
+        public boolean equals(Object otherObject) {
+            boolean result;
+            if (otherObject == this) {
+                result = true;
+            } else if (otherObject != null
+                    && otherObject.getClass() == getClass()) {
+                CachedTextKey otherKey = (CachedTextKey) otherObject;
+                result = font.equals(otherKey.font)
+                        && text.equals(otherKey.text);
+            } else {
+                result = false;
+            }
+
+            return result;
         }
 
         @Override