Skip to content

Migrate build tools and example projects to Java 17 and add compatibility fixes#4591

Closed
shai-almog wants to merge 2 commits intomasterfrom
codex/update-hellocodenameone-for-java-17-sy9wvg
Closed

Migrate build tools and example projects to Java 17 and add compatibility fixes#4591
shai-almog wants to merge 2 commits intomasterfrom
codex/update-hellocodenameone-for-java-17-sy9wvg

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Move the example multi-module project and CI/local tooling to Java 17 so sources and tests using modern language features compile and run.
  • Avoid opaque failures during local iOS builds by aligning the request java.version with the Maven compiler target when they differ.
  • Provide minimal compatibility stubs for StringConcatFactory to satisfy Java API expectations in the VM/Ports sources.

Description

  • Updated GitHub Actions workflow to set up JDK 17 using actions/setup-java@v4 for the macOS iOS build job.
  • Added StringConcatFactory stub classes under Ports/CLDC11 and vm/JavaAPI to avoid missing-symbol issues for string concat support.
  • Enhanced the Maven plugin (CN1BuildMojo) to parse Java version strings via a new parseJavaVersion helper and to override the build request java.version when maven.compiler.target is higher than the request, logging the change.
  • Added the same parseJavaVersion helper and used it in InstallCn1libsMojo to robustly compare library and project codename1.arg.java.version values.
  • Updated sample hellocodenameone project and module pom.xml files to target Java 17 (maven.compiler.source / target and project properties), and updated top-level properties to java.version=17 and test compile targets.
  • Modified various scripts and wrappers (mvnw, mvnw.cmd, build.sh, run.sh, build.bat, run.bat, build-ios-app.sh) to prefer or locate a JDK 17 installation and to set JAVA_HOME/PATH for Maven invocations; build-ios-app.sh switches JAVA_HOME to JAVA17_HOME for iOS Maven builds.
  • Added Java17LanguageFeaturesTest to the example common tests to validate typical Java 17 language constructs compile in tests, and updated the example README to note Java 17 usage.

Testing

  • No existing automated CI test runs are included in this change; a new test Java17LanguageFeaturesTest was added to the example project to exercise Java 17 language features (compilation assertion).
  • The changes are limited to build tooling, example project configuration, and small API stubs; integration/CI verification is expected to run in normal pipeline execution after merge.

Codex Task

…sy9wvg

Signed-off-by: Shai Almog <67850168+shai-almog@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Collaborator Author

shai-almog commented Mar 5, 2026

Compared 32 screenshots: 32 matched.

Native Android coverage

  • 📊 Line coverage: 7.30% (3711/50862 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.65% (18066/319659), branch 2.76% (858/31113), complexity 3.40% (1010/29741), method 5.98% (828/13853), class 9.63% (176/1827)
    • 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/712 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: 7.30% (3711/50862 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.65% (18066/319659), branch 2.76% (858/31113), complexity 3.40% (1010/29741), method 5.98% (828/13853), class 9.63% (176/1827)
    • 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/712 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)

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 146 total, 0 failed, 2 skipped

Benchmark Results

  • Execution Time: 9676 ms

  • Hotspots (Top 20 sampled methods):

    • 21.04% com.codename1.tools.translator.Parser.isMethodUsed (345 samples)
    • 19.45% java.lang.String.indexOf (319 samples)
    • 19.33% java.util.ArrayList.indexOf (317 samples)
    • 5.00% com.codename1.tools.translator.BytecodeMethod.addToConstantPool (82 samples)
    • 4.70% java.lang.Object.hashCode (77 samples)
    • 4.57% com.codename1.tools.translator.ByteCodeClass.calcUsedByNative (75 samples)
    • 2.74% java.lang.System.identityHashCode (45 samples)
    • 2.38% com.codename1.tools.translator.BytecodeMethod.optimize (39 samples)
    • 1.65% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (27 samples)
    • 1.28% com.codename1.tools.translator.Parser.cullMethods (21 samples)
    • 1.04% java.lang.StringBuilder.append (17 samples)
    • 0.79% com.codename1.tools.translator.BytecodeMethod.appendCMethodPrefix (13 samples)
    • 0.79% com.codename1.tools.translator.ByteCodeClass.markDependent (13 samples)
    • 0.79% com.codename1.tools.translator.BytecodeMethod.equals (13 samples)
    • 0.73% sun.nio.ch.FileDispatcherImpl.write0 (12 samples)
    • 0.61% sun.nio.fs.UnixNativeDispatcher.open0 (10 samples)
    • 0.61% java.lang.StringCoding.encode (10 samples)
    • 0.49% java.io.UnixFileSystem.getBooleanAttributes0 (8 samples)
    • 0.43% com.codename1.tools.translator.ByteCodeClass.updateAllDependencies (7 samples)
    • 0.43% java.io.FileOutputStream.writeBytes (7 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.

@shai-almog shai-almog closed this Mar 5, 2026
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