Skip to content

Fail fast on JDK < 11 with a friendly error; document JDK 11-25 runtime support#4840

Merged
shai-almog merged 2 commits intomasterfrom
jdk-runtime-check
May 1, 2026
Merged

Fail fast on JDK < 11 with a friendly error; document JDK 11-25 runtime support#4840
shai-almog merged 2 commits intomasterfrom
jdk-runtime-check

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Summary

  • Detect JDK older than 11 at the entry of prepare-simulator-classpath and generate-desktop-app-wrapper, and abort with a MojoFailureException that names the detected version, JAVA_HOME, and a pointer to Adoptium — instead of the opaque An exception occured while executing the Java class ...Stub (desktop run) or Unrecognized option: --add-exports=... (simulator) the user currently sees.
  • Update README.md, BUILDING.md, CLAUDE.md, and the developer guide (Index.asciidoc, Maven-Getting-Started.adoc, Working-With-CodenameOne-Sources.asciidoc) to call out JDK 11 through 25 as the supported runtime range, while keeping JDK 8 as the build-time requirement for the core framework.

Why

The JavaSE port forks the JVM with --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED (and similar options). JDK 8 rejects these flags before the JVM even starts, and exec-maven-plugin's java goal swallows the underlying cause for the desktop run. Failing fast in the plugin gives the user a clear next step instead of a stack trace.

Test plan

  • mvn clean compile on maven/codenameone-maven-plugin succeeds (verified locally).
  • On JDK 8: confirm prepare-simulator-classpath and generate-desktop-app-wrapper abort with the new Codename One supports JDK 11 through 25 … message and a non-zero exit before any forked JVM starts.
  • On JDK 11 / 17 / 21 / 25: confirm the simulator and "Run as desktop app" still launch normally (no false positives from the version check).

🤖 Generated with Claude Code

…d runtime

The simulator and "Run as desktop app" goals fork the JVM with
--add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED and similar options,
which JDK 8 rejects with "Could not create the Java Virtual Machine". The
desktop run also surfaced as the opaque "An exception occured while executing
the Java class ...Stub" from exec-maven-plugin.

Add a runtime JDK check in JavaVersionUtil and call it from
PrepareSimulatorClasspathMojo and GenerateDesktopAppWrapperMojo so the user
gets a clear, actionable MojoFailureException naming the detected version,
JAVA_HOME, and a pointer to Adoptium before anything is forked.

Update README.md, BUILDING.md, CLAUDE.md, and the developer guide
(Index.asciidoc, Maven-Getting-Started.adoc, Working-With-CodenameOne-Sources)
to call out JDK 11 through 25 as the supported runtime range while keeping
JDK 8 as the build-time requirement for the core framework.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: Vale failed (exit code 2) (report)
  • Image references: No unused images detected (report)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

The previous commit gated generate-desktop-app-wrapper and
prepare-simulator-classpath on JDK 11+, which broke the JDK 8 CI build:
the executable-jar profile (used by build.sh jar / migrate-googlemapsdemo
integration test) calls generate-desktop-app-wrapper to generate icons,
and that mojo only emits PNGs and adjusts the source path -- it does
not need JDK 11+. Likewise prepare-simulator-classpath runs in many
build flows that legitimately work on JDK 8.

Move the check to CN1RunMojo and CN1DebugMojo, which are the explicit
"actually launch the simulator" entry points (mvn cn1:run / cn1:debug).
Build-only goals stay unguarded.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 30, 2026

Compared 85 screenshots: 85 matched.

Native Android coverage

  • 📊 Line coverage: 9.74% (5283/54213 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 7.65% (25919/338985), branch 3.50% (1137/32520), complexity 4.51% (1406/31156), method 7.90% (1151/14561), class 12.94% (252/1948)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 9.74% (5283/54213 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 7.65% (25919/338985), branch 3.50% (1137/32520), complexity 4.51% (1406/31156), method 7.90% (1151/14561), class 12.94% (252/1948)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 916.000 ms
Base64 CN1 encode 93.000 ms
Base64 encode ratio (CN1/native) 0.102x (89.8% faster)
Base64 native decode 704.000 ms
Base64 CN1 decode 244.000 ms
Base64 decode ratio (CN1/native) 0.347x (65.3% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 30, 2026

Compared 85 screenshots: 85 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 351 seconds

Build and Run Timing

Metric Duration
Simulator Boot 110000 ms
Simulator Boot (Run) 1000 ms
App Install 16000 ms
App Launch 8000 ms
Test Execution 282000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1171.000 ms
Base64 CN1 encode 1299.000 ms
Base64 encode ratio (CN1/native) 1.109x (10.9% slower)
Base64 native decode 763.000 ms
Base64 CN1 decode 925.000 ms
Base64 decode ratio (CN1/native) 1.212x (21.2% slower)
Base64 SIMD encode 448.000 ms
Base64 encode ratio (SIMD/native) 0.383x (61.7% faster)
Base64 encode ratio (SIMD/CN1) 0.345x (65.5% faster)
Base64 SIMD decode 392.000 ms
Base64 decode ratio (SIMD/native) 0.514x (48.6% faster)
Base64 decode ratio (SIMD/CN1) 0.424x (57.6% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 57.000 ms
Image createMask (SIMD on) 10.000 ms
Image createMask ratio (SIMD on/off) 0.175x (82.5% faster)
Image applyMask (SIMD off) 124.000 ms
Image applyMask (SIMD on) 61.000 ms
Image applyMask ratio (SIMD on/off) 0.492x (50.8% faster)
Image modifyAlpha (SIMD off) 121.000 ms
Image modifyAlpha (SIMD on) 61.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.504x (49.6% faster)
Image modifyAlpha removeColor (SIMD off) 143.000 ms
Image modifyAlpha removeColor (SIMD on) 70.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.490x (51.0% faster)
Image PNG encode (SIMD off) 956.000 ms
Image PNG encode (SIMD on) 909.000 ms
Image PNG encode ratio (SIMD on/off) 0.951x (4.9% faster)
Image JPEG encode 473.000 ms

@shai-almog shai-almog merged commit d1d68ba into master May 1, 2026
19 of 21 checks passed
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