< prev index next >
src/java.desktop/share/classes/java/awt/Font.java
Print this page
rev 14936 : 8160721: Avoid deoptimizations in Font.equals.
@@ -1811,12 +1811,11 @@
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
- if (obj != null) {
- try {
+ if (obj != null && obj instanceof Font) {
Font font = (Font)obj;
if (size == font.size &&
style == font.style &&
nonIdentityTx == font.nonIdentityTx &&
hasLayoutAttributes == font.hasLayoutAttributes &&
@@ -1838,13 +1837,10 @@
} else {
return values.equals(font.getAttributeValues());
}
}
}
- catch (ClassCastException e) {
- }
- }
return false;
}
/**
* Converts this {@code Font} object to a {@code String}
< prev index next >