Skip to content

Replace bytecode translator regression test with new hierarchy in hellocodenameone#4448

Merged
shai-almog merged 1 commit intomasterfrom
codex/add-regression-test-case-for-codename-one
Jan 20, 2026
Merged

Replace bytecode translator regression test with new hierarchy in hellocodenameone#4448
shai-almog merged 1 commit intomasterfrom
codex/add-regression-test-case-for-codename-one

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Update the existing regression test to cover a different class/interface hierarchy that exercises default methods, inheritance, generics and runtime dispatch to guard against the BytecodeTranslator culling optimization.
  • Ensure the hierarchy is actually used at runtime so the VM/translator cannot optimize it away by invoking methods and using return values.
  • Place the replacement test inside the scripts/hellocodenameone sample app so the reproduction runs as part of the example test suite.

Description

  • Replaced the previous BytecodeTranslatorRegressionTest implementation with a new test that declares interfaces and classes such as Sketchable, SlotProvider, TokenMenuHost, Hue, Marker, TokenMenu, GameCell, and GameViewer and a layered canvas hierarchy (ShellComponentProxyCanvasCommonCanvasPanelCanvas).
  • Implemented runtime usage paths that exercise default interface methods, override dispatch, and generics by calling TokenMenu.render, GameViewer.drawToken, GameViewer.drawArrow, GameCell.lastSlot, Marker.score, and GameViewer.buildStatus so values are computed and stored to prevent culling.
  • Kept the test runnable by launching a short-lived worker thread named cn1-bytecode-regression and calling CN.callSerially(this::done) on success, and updated imports and helper utilities (Dimension, Rectangle, etc.) in scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/BytecodeTranslatorRegressionTest.java.

Testing

  • No automated tests were executed as part of this change.
  • The new code includes runtime calls that will be exercised when the BytecodeTranslatorRegressionTest is run by the hellocodenameone example test harness or CI.
  • CI/core unit tests were not invoked locally for this edit.

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.83% (2661/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.45% (12352/50528), branch 15.28% (714/4672), complexity 17.50% (742/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.83% (2661/10717 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.45% (12352/50528), branch 15.28% (714/4672), complexity 17.50% (742/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: 426 seconds
  • Compilation Time: 155 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 41652 ms
Extract Extensions 21 ms
Google Services Setup 2 ms
Scan Classes 2319 ms
Extract Libs 1324 ms
Inject Build Hints 60 ms
Generate Unit Tests 1 ms
Generate Stubs 1387 ms
Compile Stubs 3262 ms
Generate Icons 1648 ms
Prepare ParparVM 442 ms
ParparVM Execution 239245 ms
Post-VM Setup 292 ms
CocoaPods 6758 ms
Finalize 33 ms
Total Time 298447 msMaven Overhead : 128000 ms
CocoaPods Install (Script) 2000 ms
Simulator Boot (Run) 69000 ms
App Install 21000 ms
App Launch 19000 ms
Test Execution 184000 ms

@shai-almog shai-almog merged commit 5dca601 into master Jan 20, 2026
10 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.

1 participant