Commit 4e4086a
authored
Fix missing hashCode implementations for SpotBugs compliance (#4316)
* 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.
* Fix SpotBugs warnings: Implement proper hashCode and equals for core classes
- Implemented consistent `hashCode()` and `equals()` for:
- `Geofence`: uses id, location, radius, expiration.
- `PropertyBase`: uses name.
- `Font`: uses native font or attributes.
- `Border` / `CSSBorder` / `RoundBorder`: uses fields or identity where appropriate.
- `Style`: manual hash calculation for primitive arrays (margin/padding) to avoid missing Arrays utility in CLDC.
- `TarEntry`: added `equals(Object)` override and `hashCode` based on header name.
- `Transform`: uses type and matrix values.
- `ImageDownloadService`: uses cacheId.
- `BoxLayout`: added `align` to equals/hashCode to fix layout update issues.
- `BorderLayout`, `FlowLayout`, `GridLayout`, `TableLayout`: uses configuration fields.
- Fixed `BoxLayout` equality check to include alignment, resolving layout update regression.
- Manual array hashing in `Style` ensures CLDC 1.1 compatibility.
* Fix SpotBugs hashCode warnings while preserving legacy behavior
- Reverted `Style.hashCode` to use `System.identityHashCode(this)` to prevent regressions in layout and caching caused by value-based hashing of mutable UI state.
- Reverted `BoxLayout` equality to ignore `align` (matching previous behavior) to resolve test failures.
- Implemented consistent `hashCode()` for:
- `Geofence`: uses id, location, radius, expiration.
- `PropertyBase`: uses name.
- `Font`: uses native font or attributes.
- `Border` / `CSSBorder` / `RoundBorder`: uses fields or identity where appropriate.
- `TarEntry`: added `equals(Object)` override and `hashCode`.
- `Transform`: uses type and matrix values.
- `ImageDownloadService`: uses cacheId.
- `BorderLayout`, `FlowLayout`, `GridLayout`, `TableLayout`: uses configuration fields.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent 1680c6e commit 4e4086a
File tree
17 files changed
+461
-295
lines changed- CodenameOne/src/com/codename1
- io
- services
- tar
- location
- properties
- ui
- layouts
- plaf
- table
17 files changed
+461
-295
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
934 | 934 | | |
935 | 935 | | |
936 | 936 | | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
937 | 944 | | |
938 | 945 | | |
939 | 946 | | |
| |||
0 commit comments