Skip to content

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Address a large set of PMD findings for UnusedPrivateField and UnnecessaryLocalBeforeReturn across core sources to make PMD builds stricter and reduce noise.
  • Ensure the repository quality report enforces these PMD rules like we already gate on SpotBugs findings.
  • Exclude UseLocaleWithCaseConversions from PMD since Locale APIs are not available in Codename One.

Description

  • Removed or inlined numerous unused private fields/constants (examples: removed pollingThreadRunning, various unused gzip constants, R2, _url, pressedX/pressedY, and other dead constants/flags) and cleaned up related code paths in gzip, UI, layout, and util classes.
  • Replaced trivial local temporaries with direct returns in many methods to eliminate UnnecessaryLocalBeforeReturn (examples: AdsService.createAdsService, ColorUtil.*, Resources.*, RequestBuilder.getAsBytes, ConnectionRequest.fetchJSON, and many UI helper methods).
  • Added targeted @SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn") where a local is intentionally kept (examples: Inflate.inflate, ThreadSafeDatabase runnables) instead of changing logic.
  • Updated PMD configuration and CI quality gates by adding <exclude name="UseLocaleWithCaseConversions"/> to maven/core-unittests/pmd.xml and adding UnusedPrivateField and UnnecessaryLocalBeforeReturn to the forbidden PMD rules in .github/scripts/generate-quality-report.py so future PR CI will fail on these violations.

Testing

  • No automated test suite was executed as part of this change; modifications are focused on refactors and PMD rule conformance.
  • To validate locally, run the core unit tests and PMD report using the CI-aligned Maven command: cd maven && mvn clean verify -DunitTests=true -pl core-unittests -am -Dmaven.javadoc.skip=true -Plocal-dev-javase.
  • The quality-report generator was updated to enforce the new PMD gates (see .github/scripts/generate-quality-report.py).

Codex Task

@shai-almog
Copy link
Collaborator Author

shai-almog commented Jan 20, 2026

Compared 30 screenshots: 30 matched.

Native Android coverage

  • 📊 Line coverage: 24.87% (2665/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.47% (12362/50528), branch 15.35% (717/4672), complexity 17.59% (746/4241), method 33.08% (602/1820), class 34.98% (106/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.87% (2665/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.47% (12362/50528), branch 15.35% (717/4672), complexity 17.59% (746/4241), method 33.08% (602/1820), class 34.98% (106/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
Copy link
Collaborator Author

shai-almog commented Jan 20, 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: 370 seconds
  • Compilation Time: 104 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 37138 ms
Extract Extensions 15 ms
Google Services Setup 2 ms
Scan Classes 1147 ms
Extract Libs 958 ms
Inject Build Hints 47 ms
Generate Unit Tests 4 ms
Generate Stubs 1393 ms
Compile Stubs 2442 ms
Generate Icons 1314 ms
Prepare ParparVM 253 ms
ParparVM Execution 201952 ms
Post-VM Setup 162 ms
CocoaPods 5348 ms
Finalize 54 ms
Total Time 252230 msMaven Overhead : 118000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot (Run) 90000 ms
App Install 21000 ms
App Launch 7000 ms
Test Execution 177000 ms

@github-actions
Copy link

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog shai-almog merged commit d9d422f into master Jan 20, 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