Skip to content

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Replace fragile in-test generation of java.* sources with the real maintained JavaAPI output so VM/translator integration tests compile against a canonical API surface.
  • Reduce duplicated, hand-written stub logic (including java.lang.invoke stubs) that can mask mismatches between tests and the JavaAPI project.
  • Make cross-JDK/target compilation deterministic by compiling JavaAPI/src with the same JDK/target used by each test run and reusing the produced classes.

Description

  • Added CompilerHelper.compileJavaAPI(Path, CompilerConfig) to compile ../JavaAPI/src into a temporary classes directory using the requested JDK/target and updated compilation behavior to use --patch-module on supported JDKs or fall back to source/target flags for older JDKs.
  • Added CompilerHelper.copyDirectory(Path, Path) and updated integration tests to copy compiled JavaAPI classes into test classes directories so the translator receives real API bytecode.
  • Updated integration tests CleanTargetIntegrationTest, LockIntegrationTest, ReadWriteLockIntegrationTest, and StampedLockIntegrationTest to stop emitting large java.* source stubs and instead compile/test against the JavaAPI classes, switching between -classpath (JDK9+) and -bootclasspath (pre-9) as appropriate and guarding unsupported JDK/target combinations.
  • Updated LambdaIntegrationTest to select an appropriate compiler config, compile the JavaAPI with that compiler, remove ad-hoc java.lang.invoke stub generation, and use the compiled JavaAPI when compiling the test app.

Testing

  • No automated tests were executed as part of this change (no CI or mvn run was requested).
  • The changes are limited to test harness code and test sources and add guards to skip incompatible JDK/target permutations to avoid spurious failures during multi-JDK runs.
  • Local assertions in unit tests remain; the PR does not claim runnable CI verification in this rollout.

Codex Task

@github-actions
Copy link

github-actions bot commented Jan 20, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@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: 362 seconds
  • Compilation Time: 142 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 37539 ms
Extract Extensions 18 ms
Google Services Setup 2 ms
Scan Classes 1797 ms
Extract Libs 1242 ms
Inject Build Hints 71 ms
Generate Unit Tests 3 ms
Generate Stubs 1789 ms
Compile Stubs 3185 ms
Generate Icons 1686 ms
Prepare ParparVM 272 ms
ParparVM Execution 196693 ms
Post-VM Setup 216 ms
CocoaPods 4895 ms
Finalize 21 ms
Total Time 249430 msMaven Overhead : 113000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot (Run) 83000 ms
App Install 22000 ms
App Launch 16000 ms
Test Execution 165000 ms

@github-actions
Copy link

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 171 total, 0 failed, 2 skipped

Benchmark Results

  • Execution Time: 10274 ms

  • Hotspots (Top 20 sampled methods):

    • 22.40% java.lang.String.indexOf (400 samples)
    • 17.36% com.codename1.tools.translator.Parser.isMethodUsed (310 samples)
    • 15.57% com.codename1.tools.translator.Parser.addToConstantPool (278 samples)
    • 12.09% java.util.ArrayList.indexOf (216 samples)
    • 4.26% java.lang.Object.hashCode (76 samples)
    • 3.36% com.codename1.tools.translator.ByteCodeClass.calcUsedByNative (60 samples)
    • 2.74% java.lang.System.identityHashCode (49 samples)
    • 1.85% com.codename1.tools.translator.BytecodeMethod.equals (33 samples)
    • 1.62% com.codename1.tools.translator.ByteCodeClass.fillVirtualMethodTable (29 samples)
    • 1.12% java.io.FileOutputStream.writeBytes (20 samples)
    • 0.90% com.codename1.tools.translator.Parser.cullMethods (16 samples)
    • 0.90% java.io.FileOutputStream.open0 (16 samples)
    • 0.78% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (14 samples)
    • 0.67% com.codename1.tools.translator.BytecodeMethod.optimize (12 samples)
    • 0.67% com.codename1.tools.translator.BytecodeMethod.appendCMethodPrefix (12 samples)
    • 0.67% java.lang.StringBuilder.append (12 samples)
    • 0.62% java.lang.Integer.getChars (11 samples)
    • 0.56% java.io.FileInputStream.open0 (10 samples)
    • 0.50% java.io.UnixFileSystem.getBooleanAttributes0 (9 samples)
    • 0.45% java.util.TreeMap.getEntry (8 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

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