Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2022 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -93,11 +93,20 @@ public CachedTextKey(BitmapFont font, String text/*, ColorRGBA color*/) {
}

@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
Expand Down