Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR resolves multiple SpotBugs warnings regarding missing or inconsistent hashCode() implementations in classes that override equals().

Changes include:

  • Geofence.java: Implemented hashCode using ID, radius, expiration, and lat/long from Location (since Location lacks hashCode).
  • PropertyBase.java: Implemented hashCode using property name.
  • Font.java: Implemented hashCode mirroring equals logic (native font or attributes).
  • Border.java: Implemented hashCode using visual attributes.
  • Style.java: Implemented hashCode using relevant style attributes.
  • TarEntry.java: Added equals(Object) (to fix overloading issue) and hashCode using header name.
  • CustomFont.java: Implemented hashCode using charsets and cutOffsets.
  • Transform.java: Added equals(Object) and hashCode using transformation type and values.
  • CSSBorder.java: Implemented hashCode for main class (identity) and inner classes (field-based).
  • RoundBorder.java / RoundRectBorder.java: Implemented hashCode using identity, matching their identity-based equals.
  • ImageDownloadService.java: Implemented hashCode using cacheId.
  • Layouts: Added hashCode to BorderLayout, BoxLayout, FlowLayout, GridLayout, and TableLayout based on their configuration fields.

PR created automatically by Jules for task 16301786647297229349 started by @shai-almog

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.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@shai-almog
Copy link
Collaborator

shai-almog commented Dec 19, 2025

Compared 30 screenshots: 30 matched.

Native Android coverage

  • 📊 Line coverage: 24.52% (2616/10667 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.09% (12125/50336), branch 15.00% (696/4640), complexity 17.20% (726/4220), method 32.23% (585/1815), class 33.66% (102/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidDB – 0.00% (0/57 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 24.52% (2616/10667 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.09% (12125/50336), branch 15.00% (696/4640), complexity 17.20% (726/4220), method 32.23% (585/1815), class 33.66% (102/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidDB – 0.00% (0/57 lines covered)

…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.
@shai-almog
Copy link
Collaborator

shai-almog commented Dec 19, 2025

iOS screenshot updates

Compared 30 screenshots: 24 matched, 5 updated, 1 missing reference.

  • BrowserComponent — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    BrowserComponent
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as BrowserComponent.png in workflow artifacts.

  • graphics-draw-gradient — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-gradient
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-gradient.png in workflow artifacts.

  • graphics-draw-round-rect — missing reference. Reference screenshot missing at /Users/runner/work/CodenameOne/CodenameOne/scripts/ios/screenshots/graphics-draw-round-rect.png.

    graphics-draw-round-rect
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-round-rect.png in workflow artifacts.

  • graphics-draw-string — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 422x918.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string-decorated
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-string-decorated.png in workflow artifacts.

  • kotlin — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 290 seconds
  • Compilation Time: 67 seconds

- 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.
@github-actions
Copy link

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog shai-almog marked this pull request as ready for review December 20, 2025 04:41
@shai-almog shai-almog merged commit 4e4086a into master Dec 20, 2025
14 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +911 to +914
int hash = 7;
hash = 29 * hash + this.type;
hash = 29 * hash + (this.nativeTransform != null ? this.nativeTransform.hashCode() : 0);
hash = 29 * hash + Float.floatToIntBits(this.translateX);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Align Transform hashCode with equals

The new equals(Object) now delegates to transformEqualsImpl, which compares the underlying matrix values, but hashCode() still relies on nativeTransform.hashCode(). On Android (and other ports), nativeTransform is a CN1Matrix4f that implements value-based equals but inherits the default identity hash code. As a result, two transforms constructed separately with identical matrix data (e.g., the same translation/scale) will compare equal yet return different hash codes, breaking lookups in hashed collections that rely on the new equality semantics.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants