Skip to content

Fix #5022: Eclipse jansi NPE; bump Maven wrapper to 3.9.9#5031

Merged
shai-almog merged 2 commits into
masterfrom
fix-5022-eclipse-jansi-maven-bump
May 24, 2026
Merged

Fix #5022: Eclipse jansi NPE; bump Maven wrapper to 3.9.9#5031
shai-almog merged 2 commits into
masterfrom
fix-5022-eclipse-jansi-maven-bump

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes initializer + eclipse in disrepair #5022 — the AnsiConsole.<clinit> NPE thrown by jansi 1.17.x on JDK 16+ when the Eclipse "Debug Simulator" (and friends) launches via m2e's embedded Maven. Inject jansi.passthrough=false, jansi.strip=false, jansi.force=false into M2_PROPERTIES of every Maven-type .launch template so AnsiConsole reads non-null values regardless of which jansi the embedded Maven happens to bundle.
  • Bumps the project Maven Wrapper from Takari 0.5.6 / Maven 3.6.3 to Apache 3.3.2 / Maven 3.9.9 (only-script distribution, no jar checked in). Applied to the cn1app-archetype, the initializr's common.zip, and to scripts/cn1playground and scripts/hellocodenameone so the new wrapper gets exercised across the repo.

Why the jansi properties matter

AnsiConsole.<clinit> calls getBoolean("jansi.passthrough"); in jansi 1.17.x the implementation does System.getProperty(name).equalsIgnoreCase("true") and NPEs when the property is unset. The Eclipse Console isn't a TTY, so the no-redirect branch that hides the bug doesn't fire. Setting any non-null value defuses it. This belt-and-suspenders fix works regardless of which jansi version the m2e EMBEDDED Maven happens to ship.

Test plan

  • All 17 .launch templates have correct content; 15 Maven-type ones carry the three jansi entries, 2 group/remote ones are unchanged (no Maven invocation, no jansi concern).
  • Initializr eclipse.zip rebuilt: 17 entries, 45 jansi lines, placeholders preserved (${project_loc:myappname}, MyAppName - <action>.launch).
  • Initializr common.zip rebuilt: surgically removed old mvnw / mvnw.cmd / maven-wrapper.{jar,properties} / MavenWrapperDownloader.java; added Apache 3.3.2 wrapper files; mvnw retains executable bit.
  • mvn clean install of the cn1app-archetype succeeds; generated project carries only maven-wrapper.properties in .mvn/wrapper/, executable mvnw, Eclipse launches with the jansi entries and correctly-substituted ${project_loc:<artifactId>}.
  • ./mvnw validate against both scripts/cn1playground and scripts/hellocodenameone returns BUILD SUCCESS on Maven 3.9.9 / JDK 25 with jansi 2.4.1 — no NPE, no plugin-resolution surprises from 3.6.3 -> 3.9.9.
  • Manual confirmation on the original reporter's environment (Eclipse on Windows with JustJ JDK 16) that the Debug Simulator launch no longer trips the AnsiConsole NPE.

Notes / out of scope

  • tools/eclipse/__mainName__ - Remote Debug Simulator.launch has a pre-existing hardcoded /eclipsetest1-common literal that GeneratorModel's replacement list doesn't catch — separate bug, not fixed here.
  • GeneratorModel.appendIdeSection's README blurb claims tools/eclipse/ contains the launches in initializr-generated projects, but they actually land at the project root — also pre-existing, not in scope.

🤖 Generated with Claude Code

The Eclipse "Debug Simulator" launch (and every other Maven-type launch
shipped by the archetype) used m2e's M2_RUNTIME=EMBEDDED, which on older
m2e bundles pulls in jansi 1.17.x. On JDK 16+ that jansi NPEs from
AnsiConsole.<clinit> -> getBoolean("jansi.passthrough") because the
property is unset and the buggy implementation dereferences the null
result. The JVM dies before Maven runs.

- Inject jansi.passthrough / jansi.strip / jansi.force = false into the
  M2_PROPERTIES of every Maven-type .launch template so AnsiConsole's
  init reads non-null values regardless of the embedded jansi version.
  Same patch applied to the eclipse.zip the initializr serves.
- Bump the Maven Wrapper to Apache 3.3.2 / Maven 3.9.9 (only-script,
  no jar) in the cn1app-archetype, the initializr's common.zip, and
  the cn1playground and hellocodenameone dev projects. Modern jansi
  (2.4.x) on the CLI side, no more Takari MavenWrapperDownloader.java,
  and broader exercise of the new wrapper across the repo.

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

shai-almog commented May 24, 2026

Compared 20 screenshots: 20 matched.
✅ JavaScript-port screenshot tests passed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 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.

@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 24, 2026

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 87000 ms
Simulator Boot (Run) 1000 ms
App Install 19000 ms
App Launch 16000 ms
Test Execution 352000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1210.000 ms
Base64 CN1 encode 2192.000 ms
Base64 encode ratio (CN1/native) 1.812x (81.2% slower)
Base64 native decode 776.000 ms
Base64 CN1 decode 1544.000 ms
Base64 decode ratio (CN1/native) 1.990x (99.0% slower)
Base64 SIMD encode 651.000 ms
Base64 encode ratio (SIMD/native) 0.538x (46.2% faster)
Base64 encode ratio (SIMD/CN1) 0.297x (70.3% faster)
Base64 SIMD decode 680.000 ms
Base64 decode ratio (SIMD/native) 0.876x (12.4% faster)
Base64 decode ratio (SIMD/CN1) 0.440x (56.0% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 107.000 ms
Image createMask (SIMD on) 15.000 ms
Image createMask ratio (SIMD on/off) 0.140x (86.0% faster)
Image applyMask (SIMD off) 124.000 ms
Image applyMask (SIMD on) 87.000 ms
Image applyMask ratio (SIMD on/off) 0.702x (29.8% faster)
Image modifyAlpha (SIMD off) 136.000 ms
Image modifyAlpha (SIMD on) 70.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.515x (48.5% faster)
Image modifyAlpha removeColor (SIMD off) 343.000 ms
Image modifyAlpha removeColor (SIMD on) 113.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.329x (67.1% faster)
Image PNG encode (SIMD off) 1458.000 ms
Image PNG encode (SIMD on) 1139.000 ms
Image PNG encode ratio (SIMD on/off) 0.781x (21.9% faster)
Image JPEG encode 774.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 24, 2026

Compared 110 screenshots: 110 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 60000 ms
Simulator Boot (Run) 3000 ms
App Install 19000 ms
App Launch 5000 ms
Test Execution 263000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 466.000 ms
Base64 CN1 encode 1311.000 ms
Base64 encode ratio (CN1/native) 2.813x (181.3% slower)
Base64 native decode 262.000 ms
Base64 CN1 decode 898.000 ms
Base64 decode ratio (CN1/native) 3.427x (242.7% slower)
Base64 SIMD encode 393.000 ms
Base64 encode ratio (SIMD/native) 0.843x (15.7% faster)
Base64 encode ratio (SIMD/CN1) 0.300x (70.0% faster)
Base64 SIMD decode 384.000 ms
Base64 decode ratio (SIMD/native) 1.466x (46.6% slower)
Base64 decode ratio (SIMD/CN1) 0.428x (57.2% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 57.000 ms
Image createMask (SIMD on) 8.000 ms
Image createMask ratio (SIMD on/off) 0.140x (86.0% faster)
Image applyMask (SIMD off) 172.000 ms
Image applyMask (SIMD on) 55.000 ms
Image applyMask ratio (SIMD on/off) 0.320x (68.0% faster)
Image modifyAlpha (SIMD off) 136.000 ms
Image modifyAlpha (SIMD on) 55.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.404x (59.6% faster)
Image modifyAlpha removeColor (SIMD off) 173.000 ms
Image modifyAlpha removeColor (SIMD on) 68.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.393x (60.7% faster)
Image PNG encode (SIMD off) 1198.000 ms
Image PNG encode (SIMD on) 915.000 ms
Image PNG encode ratio (SIMD on/off) 0.764x (23.6% faster)
Image JPEG encode 562.000 ms

The old hellocodenameone/mvnw was a Takari wrapper hand-patched with an
is_java17_home() probe that switched JAVA_HOME to a JDK 17 install when
the inherited one wasn't 17. That hack was lost when this branch
replaced mvnw with the canonical Apache wrapper, so the Android CI job
fell back to the runner's JDK 8 and Maven's compiler died with
"invalid target release: 17" against the project's <java.version>17.

Mirror the pattern build-ios-app.sh already uses: wrap the mvnw call
in a subshell that exports JAVA_HOME=JAVA17_HOME, and pass
-Dmaven.compiler.fork=true / -Dmaven.compiler.executable as a
belt-and-suspenders for any forked compile. Keeps the project's mvnw
script identical to what new users get from the archetype.

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

shai-almog commented May 24, 2026

Compared 110 screenshots: 110 matched.

Native Android coverage

  • 📊 Line coverage: 11.83% (6793/57442 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 9.62% (34129/354705), branch 4.14% (1396/33724), complexity 5.17% (1674/32362), method 8.99% (1361/15142), class 14.44% (303/2098)
    • 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: 11.83% (6793/57442 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 9.62% (34129/354705), branch 4.14% (1396/33724), complexity 5.17% (1674/32362), method 8.99% (1361/15142), class 14.44% (303/2098)
    • 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 781.000 ms
Base64 CN1 encode 158.000 ms
Base64 encode ratio (CN1/native) 0.202x (79.8% faster)
Base64 native decode 924.000 ms
Base64 CN1 decode 331.000 ms
Base64 decode ratio (CN1/native) 0.358x (64.2% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog shai-almog merged commit 16170e1 into master May 24, 2026
24 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.

initializer + eclipse in disrepair

1 participant