Skip to content

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Address SpotBugs findings where an integral division result was cast to double/float, which can produce incorrect values.
  • Keep rendering, geometry, and animation math semantically unchanged while using explicit floating-point operations to avoid integer truncation.
  • Ensure the CI quality gate treats these SpotBugs findings as build failures by adding the rule to the forbidden list.

Description

  • Use explicit floating-point division/casts in chart and rendering code: ChartComponent (zoomX/zoomY), RadarChart (centerX/centerY), and XYChart (mTranslate).
  • Fix UI/graphics math to use floats where appropriate: CodenameOneImplementation.fillRectRadialGradient, CommonProgressAnimations.CircleProgress.stepSize, FlipTransition (camera/translate math), PerspectiveCamera (camera math), RoundRectBorder (stroke offset), and DefaultLookAndFeel (state icon Y position).
  • Fix numeric coefficient calculation in Geometry.BezierCurve by ensuring factorial division produces a double, and correct StyleParser.getMMValue to return a float with proper rounding/scale.
  • Enforce SpotBugs rule ICAST_IDIV_CAST_TO_DOUBLE as a forbidden rule in .github/scripts/generate-quality-report.py so such findings fail the build.

Testing

  • No automated test suite was executed as part of this change.
  • Static inspection and local code browsing were used to verify the numeric fixes compile and the SpotBugs rule was added to the quality-report script.

Codex Task

@shai-almog
Copy link
Collaborator Author

shai-almog commented Jan 12, 2026

iOS screenshot updates

Compared 30 screenshots: 23 matched, 6 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-arc — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-arc
    Preview info: JPEG preview quality 20; JPEG preview quality 20; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-arc.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: 330 seconds
  • Compilation Time: 53 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 31008 ms
Extract Extensions 14 ms
Google Services Setup 2 ms
Scan Classes 462 ms
Extract Libs 1003 ms
Inject Build Hints 25 ms
Generate Unit Tests 1 ms
Generate Stubs 882 ms
Compile Stubs 1883 ms
Generate Icons 778 ms
Prepare ParparVM 149 ms
ParparVM Execution 188099 ms
Post-VM Setup 94 ms
CocoaPods 4248 ms
Finalize 10 ms
Total Time 228658 msMaven Overhead : 102000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot (Run) 50000 ms
App Install 20000 ms
App Launch 39000 ms
Test Execution 170000 ms

…V_CAST_TO_DOUBLE

### Motivation
- Address SpotBugs findings where an integral division result was cast to `double`/`float`, which can produce incorrect values.
- Keep rendering, geometry, and animation math semantically unchanged while using explicit floating-point operations to avoid integer truncation.
- Ensure the CI quality gate treats these SpotBugs findings as build failures by adding the rule to the forbidden list.

### Description
- Use explicit floating-point division/casts in chart and rendering code: `ChartComponent` (`zoomX`/`zoomY`), `RadarChart` (`centerX`/`centerY`), and `XYChart` (`mTranslate`).
- Fix UI/graphics math to use floats where appropriate: `CodenameOneImplementation.fillRectRadialGradient`, `CommonProgressAnimations.CircleProgress.stepSize`, `FlipTransition` (camera/translate math), `PerspectiveCamera` (camera math), `RoundRectBorder` (stroke offset), and `DefaultLookAndFeel` (state icon Y position).
- Fix numeric coefficient calculation in `Geometry.BezierCurve` by ensuring factorial division produces a `double`, and correct `StyleParser.getMMValue` to return a `float` with proper rounding/scale.
- Enforce SpotBugs rule `ICAST_IDIV_CAST_TO_DOUBLE` as a forbidden rule in `.github/scripts/generate-quality-report.py` so such findings fail the build.

### Testing
- No automated test suite was executed as part of this change.
- Static inspection and local code browsing were used to verify the numeric fixes compile and the SpotBugs rule was added to the quality-report script.
…CAST_TO_DOUBLE

### Motivation
- Prevent incorrect numeric results caused by integer division being cast to `float`/`double` in rendering and chart math.
- Silence SpotBugs `ICAST_IDIV_CAST_TO_DOUBLE` findings by fixing actual occurrences rather than masking them.
- Preserve the intended rendering/geometry semantics while ensuring explicit floating-point arithmetic where required.
- Improve precision in pinch-zoom, layout centering, camera transforms, and UI metrics.

### Description
- Replace integer division with explicit floating-point operations in chart and layout code such as `ChartComponent.pointerDragged`, `XYChart` center/translate, and `RadarChart` center calculations to avoid truncation.
- Adjust UI/graphics math in `DefaultLookAndFeel`, `RoundRectBorder`, `CodenameOneImplementation.fillRectRadialGradient`, `FlipTransition`, and `PerspectiveCamera` to use `0.5f`/`... * 0.5f` or explicit casts where appropriate.
- Fix numeric coefficient calculation by casting factorial division to `double` in `Geometry` and correct `StyleParser.getMMValue` to return a properly computed `float`; also refine `CommonProgressAnimations.CircleProgress` timing calculation.
- Add `ICAST_IDIV_CAST_TO_DOUBLE` to the forbidden SpotBugs rules in `.github/scripts/generate-quality-report.py` so such findings will fail the quality gate.

### Testing
- No unit or integration test suite was executed as part of this change.
- Static SpotBugs analysis was the motivating CI check and the edits target the previously reported `ICAST_IDIV_CAST_TO_DOUBLE` violations.
- The repository previously failed the SpotBugs quality gate due to these violations and the changes remove the identified integer→float division instances.
- CI re-run of the full pipeline was not performed within this patch set.
@github-actions
Copy link

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Collaborator Author

shai-almog commented Jan 13, 2026

Compared 30 screenshots: 30 matched.

Native Android coverage

  • 📊 Line coverage: 24.64% (2641/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.34% (12296/50528), branch 15.20% (710/4672), complexity 17.35% (736/4241), method 32.75% (596/1820), class 34.32% (104/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.PushNotificationService – 0.00% (0/59 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 24.64% (2641/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.34% (12296/50528), branch 15.20% (710/4672), complexity 17.35% (736/4241), method 32.75% (596/1820), class 34.32% (104/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.PushNotificationService – 0.00% (0/59 lines covered)

@shai-almog shai-almog merged commit 6893bf2 into master Jan 13, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants