Skip to content

Commit 4426ca6

Browse files
Fix SpotBugs warnings for missing or inconsistent hashCode
Implemented proper hashCode() methods in classes overriding equals(): - Geofence: Uses ID, radius, expiration, and location coordinates. - PropertyBase: Uses name. - Font: Uses font properties (face, size, style) or native font hash. - Border: Uses type, color, thickness, arc, etc. - Style: Uses visual properties (colors, font, background). - TarEntry: Added equals(Object) and hashCode based on header name. - CustomFont: Uses charset and cutOffsets. - Transform: Uses type and transformation matrix values. - CSSBorder (and inner classes): Uses identity hash or field hashes. - RoundBorder/RoundRectBorder: Uses identity hash (consistent with equals). - ImageDownloadService: Uses cacheId. - Layouts (Border, Box, Flow, Grid, Table): Use layout properties.
1 parent f4e9392 commit 4426ca6

File tree

17 files changed

+471
-295
lines changed

17 files changed

+471
-295
lines changed

CodenameOne/src/com/codename1/io/services/ImageDownloadService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,13 @@ public boolean equals(Object o) {
934934
((ImageDownloadService) o).cacheId.equals(cacheId);
935935
}
936936

937+
/**
938+
* {@inheritDoc}
939+
*/
940+
public int hashCode() {
941+
return cacheId != null ? cacheId.hashCode() : 0;
942+
}
943+
937944
/**
938945
* @return the maintainAspectRatio
939946
*/

0 commit comments

Comments
 (0)