Skip to content

Add JavaDoc Java snippet extractor and CI validation workflow#4655

Merged
liannacasper merged 18 commits intomasterfrom
codex/create-script-to-extract-java-markdown-snippets
Mar 30, 2026
Merged

Add JavaDoc Java snippet extractor and CI validation workflow#4655
liannacasper merged 18 commits intomasterfrom
codex/create-script-to-extract-java-markdown-snippets

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a reproducible way to extract Java fenced code blocks from JavaDoc comments for batch processing and later adaptation.
  • Emit enough location/context metadata so each snippet can be located and correlated with its source symbol without performing any transformation.
  • Validate snippets using the existing playground harness and keep CI work limited to changes that touch the snippet tooling.

Description

  • Add scripts/extract-javadoc-java-snippets.sh, a portable extractor that scans provided paths (defaults to CodenameOne/src), detects Java markdown fences inside /** */ and /// doc comments, and emits JSONL records of the form {"sourceFile":"...","symbol":"...","snippetIndex":n,"startLine":n,"endLine":n,"code":"..."}.
  • Implement --package-prefix filtering to restrict extraction by package name and support passing arbitrary file/dir targets as args.
  • Add .github/workflows/java-snippet-validation.yml, a path-gated workflow that only runs when the snippet tooling/workflow files change, uses a changed-file guard to ensure it only validates on script-only edits, extracts snippets, and validates each snippet by invoking scripts/java-snippet-to-playground-uri.sh.
  • Update scripts/java-snippet-to-playground-uri.sh to cache the compiled harness classes via a stamp file so repeated invocations (batch validation) avoid unnecessary recompilation.

Testing

  • Ran a syntax check with bash -n scripts/extract-javadoc-java-snippets.sh scripts/java-snippet-to-playground-uri.sh, which succeeded.
  • Extracted snippets with scripts/extract-javadoc-java-snippets.sh CodenameOne/src and produced 436 JSONL records, and with --package-prefix com.codename1.ui produced 209 records.
  • Performed spot checks by piping extracted snippets into scripts/java-snippet-to-playground-uri.sh; the extract/emit and harness-invocation plumbing worked, while many snippets produced EVAL_ERROR from the harness (these are snippet content evaluation failures that the workflow is intended to catch).
  • Verified the compile-cache stamp in scripts/java-snippet-to-playground-uri.sh prevents repeated full recompiles during batch validation runs.

Codex Task

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@github-actions
Copy link
Copy Markdown

Cloudflare Preview

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Mar 29, 2026

Compared 32 screenshots: 32 matched.

Native Android coverage

  • 📊 Line coverage: 7.50% (3825/50994 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.91% (18944/320576), branch 2.79% (868/31137), complexity 3.50% (1044/29790), method 6.19% (860/13890), class 10.31% (190/1842)
    • 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.50% (3825/50994 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.91% (18944/320576), branch 2.79% (868/31137), complexity 3.50% (1044/29790), method 6.19% (860/13890), class 10.31% (190/1842)
    • 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)

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Mar 29, 2026

iOS screenshot updates

Compared 32 screenshots: 31 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
Simulator Boot 77000 ms
Simulator Boot (Run) 1000 ms
App Install 14000 ms
App Launch 9000 ms
Test Execution 144000 ms

@liannacasper liannacasper merged commit 73d25e7 into master Mar 30, 2026
16 of 17 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.

Update JavaDocs to link code samples to the playground when applicable

3 participants