Commit a3661a5 authored and committed Nov 28, 2023
1 parent f65058e commit a3661a5 Copy full SHA for a3661a5
File tree 1 file changed +10
-3
lines changed
src/java.desktop/share/classes/sun/font
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,19 @@ public abstract class PhysicalFont extends Font2D {
41
41
protected Object nativeNames ;
42
42
43
43
public boolean equals (Object o ) {
44
- return (o != null && o .getClass () == this .getClass () &&
45
- ((Font2D )o ).fullName .equals (this .fullName ));
44
+ if (o == null || o .getClass () != this .getClass ()) {
45
+ return false ;
46
+ }
47
+ PhysicalFont other = (PhysicalFont )o ;
48
+ return
49
+ (this .fullName .equals (other .fullName )) &&
50
+ ((this .platName == null && other .platName == null ) ||
51
+ (this .platName != null && this .platName .equals (other .platName )));
46
52
}
47
53
48
54
public int hashCode () {
49
- return fullName .hashCode ();
55
+ return fullName .hashCode () +
56
+ (platName != null ? platName .hashCode () : 0 );
50
57
}
51
58
52
59
/**
You can’t perform that action at this time.
0 commit comments