Skip to content

Native open/save file dialogs with platform hints, options and preview - #6052

Open
shai-almog wants to merge 17 commits into
masterfrom
native-file-dialogs
Open

shai-almog wants to merge 17 commits into
masterfrom
native-file-dialogs

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Adds native save dialogs, plus open dialogs you can customize, in the new package com.codename1.io.filechooser.

API

  • Display.showOpenDialog(OpenFileRequest, cb) and Display.showSaveDialog(SaveFileRequest, cb). The callback runs on the EDT, including when the user cancels.
  • Requests take a title, a message, an accept label, an initial folder, named filters (FileTypeFilter: extensions, MIME types, UTTypes), a suggested name, multi-select or folder picking, and overwrite confirmation.
  • Portable FileDialogOptions (checkbox, choice, text) show up inside the native dialog where the platform allows it, and their values come back in FileDialogResult.
  • FileDialogHints are platform hints (macOS tag field, Windows client GUID, Android initial URI, ...). A platform ignores the hints it doesn't know.
  • FilePreviewProvider gives a live preview while opening. An accessory Component can be added too.
  • A save gets its content from SaveContent (written after the user picks a location and format) or from an existing file.
  • Display.isFileDialogFeatureSupported(...) is a runtime capability query.
  • On platforms without a native dialog, a Codename One fallback is used. openFileChooser is unchanged.

Ports

Platform Open Save Extras
JavaSE / simulator AWT FileDialog, or Swing JFileChooser same filters, options, preview
Android Storage Access Framework (SAF) document picker ACTION_CREATE_DOCUMENT none
iOS UIDocumentPicker temp file, then export none
macOS NSOpenPanel NSSavePanel filters, options, hints
Windows IFileOpenDialog IFileSaveDialog filters, options via IFileDialogCustomize, hints
Linux GtkFileChooser GtkFileChooser filters, options
JavaScript file picker download none

Known limitations

  • A native dialog never embeds an accessory component; only the fallback form shows one. Preview works only on JavaSE.
  • Android and iOS don't report the selected filter or option values (the defaults are returned).
  • macOS filters by extension through allowedFileTypes, which is deprecated on macOS 12 and later, and always confirms before overwriting.

Verification

  • New unit tests: FileDialogRequestTest and FileDialogSupportTest.
  • SpotBugs, PMD and Checkstyle are clean on core. SpotBugs is clean on Android and iOS.
  • The native signature check passes on iOS. The C++ linkage check passes on Windows.
  • Linux and Windows natives were never compiled locally; this relies on CI. No dialog has been run on a device yet.

🤖 Generated with Claude Code

shai-almog and others added 12 commits October 19, 2026 14:18
… previews

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…download

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d options

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Open uses initForOpeningContentTypes (filter UTTypes, extensions, folder),
multi-select, directoryURL and shouldShowFileExtensions; picked items are
copied to tmp. Save stages content in the caches dir off the EDT and exports
it with initForExportingURLs asCopy. Results return through a per-request id
and are delivered on the EDT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…filters, options and hints

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Filters become an accessory popup that switches the allowed types, options
render as checkbox/popup/text controls in the same accessory stack, and the
MAC_* hints map to the panel properties. Answers use NativeFileDialogCodec;
saves are written through completeSaveDialog. No accessory Component or
preview on the Mac yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 12 screenshots: 12 matched.
✅ JavaSE simulator integration screenshots matched stored baselines.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ✅ ByteCodeTranslator: 0 findings (no issues)
    • ✅ android: 0 findings (no issues)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ project-model: 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

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T04:59:04.152850Z bfa84c5 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 170 screenshots: 170 matched.

Native Android coverage

  • 📊 Line coverage: 16.01% (26002/162390 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 14.37% (122147/850229), branch 9.91% (8466/85441), complexity 7.81% (6525/83503), method 11.59% (4648/40094), class 19.78% (960/4853)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6367 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/736 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/625 lines covered)
      • com.codename1.androidcompat.rt.com.codename1.androidcompat.rt.TextXmlPullParser – 0.00% (0/623 lines covered)
      • com.codename1.androidcompat.androidx.constraintlayout.core.widgets.com.codename1.androidcompat.androidx.constraintlayout.core.widgets.Flow – 0.00% (0/576 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 16.01% (26002/162390 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 14.37% (122147/850229), branch 9.91% (8466/85441), complexity 7.81% (6525/83503), method 11.59% (4648/40094), class 19.78% (960/4853)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6367 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/736 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/625 lines covered)
      • com.codename1.androidcompat.rt.com.codename1.androidcompat.rt.TextXmlPullParser – 0.00% (0/623 lines covered)
      • com.codename1.androidcompat.androidx.constraintlayout.core.widgets.com.codename1.androidcompat.androidx.constraintlayout.core.widgets.Flow – 0.00% (0/576 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 65ms / native 77ms = 0.8x speedup
SIMD float-mul (64K x300) java 38ms / native 25ms = 1.5x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 40.000 ms
Base64 CN1 decode 44.000 ms
Base64 native encode 340.000 ms
Base64 encode ratio (CN1/native) 0.118x (88.2% faster)
Base64 native decode 217.000 ms
Base64 decode ratio (CN1/native) 0.203x (79.7% faster)
Image encode benchmark status skipped (SIMD unsupported)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71c2a5a6ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CodenameOne/src/com/codename1/impl/NativeFileDialogCodec.java
Comment thread CodenameOne/src/com/codename1/impl/FileDialogSupport.java
Comment thread Ports/Android/src/com/codename1/impl/android/AndroidFileDialogs.java Outdated
Comment thread Ports/iOSPort/nativeSources/IOSNative.m
Comment thread Ports/LinuxPort/src/com/codename1/impl/linux/LinuxImplementation.java Outdated
Comment thread Ports/iOSPort/nativeSources/IOSNative.m Outdated
@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 185 screenshots: 185 matched.
Native Windows port, REAL shipping pipeline: the hellocodenameone screenshot suite rendered by a binary CROSS-COMPILED on Linux (clang-cl + xwin, WebView2 linked) and RUN on a Windows x64 runner. Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 56ms / native 4ms = 14.0x speedup
SIMD float-mul (64K x300) java 78ms / native 5ms = 15.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 74.000 ms
Base64 CN1 decode 96.000 ms
Base64 SIMD encode 113.000 ms
Base64 encode ratio (SIMD/CN1) 1.527x (52.7% slower)
Base64 SIMD decode 103.000 ms
Base64 decode ratio (SIMD/CN1) 1.073x (7.3% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 8.000 ms
Image createMask (SIMD on) 3.000 ms
Image createMask ratio (SIMD on/off) 0.375x (62.5% faster)
Image applyMask (SIMD off) 22.000 ms
Image applyMask (SIMD on) 26.000 ms
Image applyMask ratio (SIMD on/off) 1.182x (18.2% slower)
Image modifyAlpha (SIMD off) 29.000 ms
Image modifyAlpha (SIMD on) 17.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.586x (41.4% faster)
Image modifyAlpha removeColor (SIMD off) 29.000 ms
Image modifyAlpha removeColor (SIMD on) 44.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.517x (51.7% slower)

- Copyright headers on the new tests; classify the fallback save form in
  FrameworkChromeNeverWindowsTest; Vale quote punctuation in the guide.
- Linux: add the filter's extension in the GTK native and confirm the
  overwrite of that name, since GTK only checked the typed basename.
- Core: saving a sourceFile onto itself no longer truncates it.
- Android: refuse to launch while another activity result is outstanding;
  stop reporting INITIAL_DIRECTORY, which only the URI hint honours.
- iOS: convert extension filters to legacy UTIs before iOS 14; copy picked
  documents off the main thread.
- JavaScript: report a dismissed picker as cancelled; a save too large for
  the heap still answers the callback.
- Linux/Windows: deliver results on the EDT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6b20e3220

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CodenameOne/src/com/codename1/impl/FileDialogSupport.java Outdated
Comment thread Ports/JavaSE/src/com/codename1/impl/javase/JavaSEFileDialogs.java
Comment thread Ports/JavaSE/src/com/codename1/impl/javase/JavaSEFileDialogs.java
Comment thread CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java Outdated
Comment thread Ports/Android/src/com/codename1/impl/android/AndroidFileDialogs.java Outdated
Comment thread CodenameOne/src/com/codename1/impl/NativeFileDialogCodec.java
@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 185 screenshots: 185 matched.
Native Windows port (x64 / Intel-AMD): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, SSE2 SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 76ms / native 3ms = 25.3x speedup
SIMD float-mul (64K x300) java 69ms / native 3ms = 23.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 78.000 ms
Base64 CN1 decode 94.000 ms
Base64 SIMD encode 122.000 ms
Base64 encode ratio (SIMD/CN1) 1.564x (56.4% slower)
Base64 SIMD decode 105.000 ms
Base64 decode ratio (SIMD/CN1) 1.117x (11.7% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 13.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.308x (69.2% faster)
Image applyMask (SIMD off) 33.000 ms
Image applyMask (SIMD on) 27.000 ms
Image applyMask ratio (SIMD on/off) 0.818x (18.2% faster)
Image modifyAlpha (SIMD off) 42.000 ms
Image modifyAlpha (SIMD on) 23.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.548x (45.2% faster)
Image modifyAlpha removeColor (SIMD off) 64.000 ms
Image modifyAlpha removeColor (SIMD on) 27.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.422x (57.8% faster)

ParparVM vs HotSpot (JDK 25): Windows x64

Runner CPU: AMD64 Family 25 Model 17 Stepping 1, AuthenticAMD (baseline windows-x64@amd64-family-25-model-17-authenticamd)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 15% (time) / 15% (RAM) away from its baseline in vm/selfhost/perf-baseline/ fails: above it is a regression, below it an improvement that has to be rebaselined (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.40x (base 1.38x, +1.7%) 0.63x (base 0.82x, -22.4%) ok
translator (self) 4 0.79x (base 0.70x, +13.3%) 0.51x (base 0.55x, -6.6%) ok
intArithmetic 4 1.10x (base 1.10x, +0.4%) 0.06x (base 0.06x, +4.6%) ok
longArithmetic 4 1.08x (base 1.08x, -0.0%) 0.05x (base 0.06x, -1.0%) ok
mathTranscendental 4 0.83x (base 0.85x, -2.3%) 0.06x (base 0.06x, -2.9%) ok
arraySequential 4 1.58x (base 1.72x, -8.0%) 0.39x (base 0.38x, +0.7%) ok
arrayRandom 4 1.01x (base 1.01x, -0.2%) 0.23x (base 0.23x, +0.4%) ok
objectAllocation 4 1.26x (base 1.25x, +0.7%) 0.30x (base 0.29x, +0.4%) ok
valueEscape 4 0.10x (base 0.10x, -1.7%) 0.05x (base 0.04x, +0.5%) ok
hashMapChurn 4 1.73x (base 1.39x, +24.1%) 0.09x (base 0.10x, -2.9%) ok
stringBuilding 4 1.34x (base 1.36x, -1.5%) 0.32x (base 0.28x, +16.2%) ok
recursion 4 1.38x (base 1.43x, -3.0%) 0.06x (base 0.06x, +0.5%) ok
quicksort 4 1.11x (base 1.11x, +0.1%) 0.12x (base 0.12x, -0.5%) ok

Result: no regression

- Core: a content writer still runs when the destination is the source
  file; the default implementation no longer advertises INITIAL_DIRECTORY.
- JavaSE: filtered saves (and filtered opens on Windows, where AWT's
  FilenameFilter does nothing) use the Swing chooser, which confirms the
  overwrite of the name with the extension added.
- Android: picks are checked against extension filters the MIME query could
  not express; a picked folder is copied to the cache so the result is a
  path FileSystemStorage can use.
- macOS: filters given as UTIs reach allowedFileTypes.
- iOS: close the staged export stream in a finally (SpotBugs DLS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7879337058

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/WindowsPort/nativeSources/cn1_windows_filedialog.cpp
Comment thread CodenameOne/src/com/codename1/impl/FileDialogSupport.java
Comment thread Ports/JavaSE/src/com/codename1/impl/javase/JavaSEFileDialogs.java
Comment thread Ports/JavaSE/src/com/codename1/impl/javase/JavaSEFileDialogs.java Outdated
Comment thread Ports/JavaSE/src/com/codename1/impl/javase/JavaSEFileDialogs.java
Comment thread Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java
Comment thread Ports/iOSPort/nativeSources/IOSNative.m Outdated
- Windows: an IFileDialogEvents sink keeps the save dialog's default
  extension on the selected filter, so switching type no longer yields
  report.pdf.png.
- Core: the fallback save form runs on the EDT when called from another
  thread, and the open fallback delivers on the EDT.
- JavaSE: drop a preview render that finishes after the selection moved;
  parse file:/ and drive-letter URLs for the starting folder; saves that
  must not confirm an overwrite use the Swing chooser.
- iOS: watchOS and tvOS use the Codename One fallback; a picker requested
  while another controller is presented answers cancelled instead of
  hanging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02eb1bc9c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/WindowsPort/nativeSources/cn1_windows_filedialog.cpp Outdated
Comment thread CodenameOne/src/com/codename1/io/filechooser/FileDialogHints.java Outdated
Comment thread Ports/iOSPort/nativeSources/IOSNative.m Outdated
Comment thread Ports/Android/src/com/codename1/impl/android/AndroidFileDialogs.java Outdated
- Windows: the events sink sets the default share-violation and overwrite
  responses instead of leaving them indeterminate.
- Core: drop the WEB_ID and WEB_START_IN hints; the browser port uses a
  download and a file input, neither of which reads them.
- iOS: escape '%' and newline in picker paths before joining them, and
  unescape in fileDialogResult.
- Android: siblings with the same display name in a copied folder get
  distinct local names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f1f2aeb58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/iOSPort/nativeSources/IOSNative.m Outdated
Comment thread Ports/JavaSE/src/com/codename1/impl/javase/JavaSEFileDialogs.java
Comment thread Ports/iOSPort/nativeSources/IOSNative.m
- macOS: escape '%' and the record separator in every result field, since
  a Mac file name may contain the separator; macFileDialogResult unescapes.
- JavaSE: requests with a custom accept label use the Swing chooser, the
  only one that can set the button text.
- iOS: an import whose copy fails reports an error instead of silently
  dropping the item or reading as a cancellation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 185 screenshots: 185 matched.
Native Linux port (x64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub x64 runner. Baseline: scripts/linux/screenshots.

ParparVM vs HotSpot (JDK 25): Linux x64

Runner CPU: AMD EPYC 7763 64-Core Processor (baseline linux-x64@amd-epyc-7763-64-core-processor)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 15% (time) / 15% (RAM) away from its baseline in vm/selfhost/perf-baseline/ fails: above it is a regression, below it an improvement that has to be rebaselined (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 0.81x (base 0.85x, -4.1%) 0.82x (base 1.02x, -19.6%) ok
translator (self) 4 0.51x (base 0.63x, -18.3%) 0.48x (base 0.52x, -7.0%) ok
intArithmetic 4 1.13x (base 1.12x, +1.3%) 0.06x (base 0.06x, -0.7%) ok
longArithmetic 4 1.08x (base 1.08x, +0.0%) 0.08x (base 0.05x, +38.9%) ok
mathTranscendental 4 1.09x (base 1.08x, +0.3%) 0.08x (base 0.07x, +3.9%) ok
arraySequential 4 1.96x (base 2.00x, -2.1%) 0.36x (base 0.36x, -0.5%) ok
arrayRandom 4 0.95x (base 0.91x, +4.6%) 0.21x (base 0.21x, -0.1%) ok
objectAllocation 4 1.60x (base 1.65x, -3.0%) 0.33x (base 0.37x, -9.8%) ok
valueEscape 4 0.10x (base 0.10x, -0.3%) 0.04x (base 0.04x, -1.0%) ok
hashMapChurn 4 1.49x (base 1.48x, +0.8%) 0.09x (base 0.09x, -1.4%) ok
stringBuilding 4 1.43x (base 1.39x, +3.0%) 0.26x (base 0.26x, -0.2%) ok
recursion 4 1.19x (base 1.25x, -5.4%) 0.07x (base 0.08x, -2.1%) ok
quicksort 4 1.12x (base 1.07x, +4.0%) 0.11x (base 0.11x, -2.1%) ok

Result: no regression

@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 185 screenshots: 185 matched.
Native Linux port (arm64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub arm64 runner. Baseline: scripts/linux/screenshots-arm.

ParparVM vs HotSpot (JDK 25): Linux arm64

Runner CPU: Neoverse-N2 (baseline linux-arm64@neoverse-n2)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 15% (time) / 15% (RAM) away from its baseline in vm/selfhost/perf-baseline/ fails: above it is a regression, below it an improvement that has to be rebaselined (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 0.91x (base 1.02x, -10.7%) 0.77x (base 0.93x, -17.5%) ok
translator (self) 4 0.74x (base 0.70x, +5.7%) 0.48x (base 0.51x, -5.7%) ok
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.03x (base 0.03x, -1.7%) ok
longArithmetic 4 0.79x (base 0.79x, -0.3%) 0.03x (base 0.03x, -1.5%) ok
mathTranscendental 4 1.10x (base 1.10x, -0.0%) 0.03x (base 0.03x, +1.6%) ok
arraySequential 4 0.38x (base 0.36x, +4.4%) 0.37x (base 0.37x, +0.1%) ok
arrayRandom 4 0.93x (base 0.94x, -0.4%) 0.20x (base 0.20x, -0.4%) ok
objectAllocation 4 1.98x (base 1.77x, +12.0%) 0.37x (base 0.38x, -0.9%) ok
valueEscape 4 0.51x (base 0.51x, -0.1%) 0.03x (base 0.03x, -1.1%) ok
hashMapChurn 4 0.84x (base 0.84x, -0.1%) 0.12x (base 0.12x, -2.0%) ok
stringBuilding 4 1.39x (base 1.57x, -11.3%) 0.26x (base 0.26x, +0.2%) ok
recursion 4 1.42x (base 1.43x, -0.9%) 0.03x (base 0.04x, -4.7%) ok
quicksort 4 1.00x (base 0.99x, +1.0%) 0.09x (base 0.09x, -0.5%) ok

Result: no regression

@shai-almog

shai-almog commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 185 screenshots: 185 matched.
Native Windows port (arm64 / Apple Silicon - Arm): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, NEON SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 50ms / native 3ms = 16.6x speedup
SIMD float-mul (64K x300) java 48ms / native 3ms = 16.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 60.000 ms
Base64 CN1 decode 72.000 ms
Base64 SIMD encode 78.000 ms
Base64 encode ratio (SIMD/CN1) 1.300x (30.0% slower)
Base64 SIMD decode 73.000 ms
Base64 decode ratio (SIMD/CN1) 1.014x (1.4% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 5.000 ms
Image createMask (SIMD on) 1.000 ms
Image createMask ratio (SIMD on/off) 0.200x (80.0% faster)
Image applyMask (SIMD off) 16.000 ms
Image applyMask (SIMD on) 18.000 ms
Image applyMask ratio (SIMD on/off) 1.125x (12.5% slower)
Image modifyAlpha (SIMD off) 15.000 ms
Image modifyAlpha (SIMD on) 11.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.733x (26.7% faster)
Image modifyAlpha removeColor (SIMD off) 20.000 ms
Image modifyAlpha removeColor (SIMD on) 11.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.550x (45.0% faster)

ParparVM vs HotSpot (JDK 25): Windows arm64

Runner CPU: ARMv8 (64-bit) Family 8 Model D49 Revision 0, MICROSOFT CORPORATION (baseline windows-arm64@armv8-64-bit-family-8-model-d49-microsoft-corporation)

1 performance regression:

  • translator (self) on all 4 CPUs: RAM 0.50x against a 0.43x baseline (+17.3%, tolerance 15%)

1 improvement past the baseline, which fails until rebaselined:

  • hello (WinHelloMain) on all 4 CPUs: RAM 0.76x against a 1.28x baseline (-40.1%, tolerance 35%)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 15% (time) / 15% (RAM) away from its baseline in vm/selfhost/perf-baseline/ fails: above it is a regression, below it an improvement that has to be rebaselined (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.02x (base 1.11x, -8.1%) 0.76x (base 1.28x, -40.1%) IMPROVED: rebaseline (RAM -40.1%)
translator (self) 4 0.86x (base 0.84x, +2.6%) 0.50x (base 0.43x, +17.3%) REGRESSION (RAM +17.3%)
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.06x (base 0.06x, +2.0%) ok
longArithmetic 4 0.80x (base 0.80x, +0.0%) 0.06x (base 0.06x, +2.4%) ok
mathTranscendental 4 0.72x (base 0.72x, -0.1%) 0.06x (base 0.06x, +0.8%) ok
arraySequential 4 0.38x (base 0.46x, -15.5%) 0.39x (base 0.39x, +0.2%) ok
arrayRandom 4 0.94x (base 0.94x, -0.1%) 0.23x (base 0.23x, +0.2%) ok
objectAllocation 4 1.78x (base 2.81x, -36.5%) 0.41x (base 0.43x, -4.0%) ok
valueEscape 4 0.76x (base 0.76x, +0.0%) 0.05x (base 0.05x, +1.4%) ok
hashMapChurn 4 1.00x (base 0.98x, +1.6%) 0.12x (base 0.12x, -1.1%) ok
stringBuilding 4 1.62x (base 1.43x, +13.7%) 0.27x (base 0.27x, -0.2%) ok
recursion 4 1.56x (base 1.46x, +6.8%) 0.07x (base 0.07x, +0.1%) ok
quicksort 4 1.00x (base 1.00x, -0.2%) 0.12x (base 0.12x, +0.2%) ok

A change that moves performance ON PURPOSE records the new baseline in vm/selfhost/perf-baseline/pr/6052.json, with the reason, from this job's perf-results.json. The rebaseline is then part of this pull request's diff:

python3 vm/selfhost/calibrate-perf-baseline.py --pr 6052 --reason "<why these benchmarks moved>" perf-results.json

Result: performance regression

@github-actions

Copy link
Copy Markdown
Contributor

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • ✅ Tests: 832 total, 0 failed, 57 skipped

Benchmark Results

  • Execution Time: 5777 ms

  • Hotspots (Top 20 sampled methods):

    • 9.81% com.codename1.tools.translator.IteratorEscape.mangle (88 samples)
    • 7.47% java.util.ArrayList.indexOf (67 samples)
    • 5.91% java.lang.System.identityHashCode (53 samples)
    • 5.69% java.lang.Object.hashCode (51 samples)
    • 4.79% com.codename1.tools.translator.BytecodeMethod.equals (43 samples)
    • 4.57% java.lang.StringBuilder.append (41 samples)
    • 3.46% com.codename1.tools.translator.classfile.analysis.Frame.execute (31 samples)
    • 2.01% com.codename1.tools.translator.bytecodes.Invoke.findMethodUp (18 samples)
    • 1.78% java.util.HashMap.hash (16 samples)
    • 1.67% java.lang.String.equals (15 samples)
    • 1.67% com.codename1.tools.translator.BytecodeMethod.updateInlinableFieldDependencies (15 samples)
    • 1.34% com.codename1.tools.translator.Parser.cullMethods (12 samples)
    • 1.34% com.codename1.tools.translator.BytecodeMethod.addToConstantPool (12 samples)
    • 1.34% java.lang.StringCoding.encode (12 samples)
    • 1.23% java.util.HashMap.putVal (11 samples)
    • 1.00% com.codename1.tools.translator.JavascriptReachability.enqueueResolved (9 samples)
    • 1.00% com.codename1.tools.translator.bytecodes.Invoke.resolveDirectTarget (9 samples)
    • 1.00% java.io.FileOutputStream.writeBytes (9 samples)
    • 0.89% java.lang.StringBuilder.toString (8 samples)
    • 0.89% 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.

@shai-almog

shai-almog commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 83000 ms
Simulator Boot (Run) 3000 ms
App Install 25000 ms
App Launch 7000 ms
Test Execution 584000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 92ms / native 6ms = 15.3x speedup
SIMD float-mul (64K x300) java 144ms / native 3ms = 48.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 83.000 ms
Base64 CN1 decode 82.000 ms
Base64 native encode 1589.000 ms
Base64 encode ratio (CN1/native) 0.052x (94.8% faster)
Base64 native decode 756.000 ms
Base64 decode ratio (CN1/native) 0.108x (89.2% faster)
Base64 SIMD encode 131.000 ms
Base64 encode ratio (SIMD/CN1) 1.578x (57.8% slower)
Base64 SIMD decode 79.000 ms
Base64 decode ratio (SIMD/CN1) 0.963x (3.7% faster)
Base64 encode ratio (SIMD/native) 0.082x (91.8% faster)
Base64 decode ratio (SIMD/native) 0.104x (89.6% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 11.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.455x (54.5% faster)
Image applyMask (SIMD off) 377.000 ms
Image applyMask (SIMD on) 806.000 ms
Image applyMask ratio (SIMD on/off) 2.138x (113.8% slower)
Image modifyAlpha (SIMD off) 56.000 ms
Image modifyAlpha (SIMD on) 712.000 ms
Image modifyAlpha ratio (SIMD on/off) 12.714x (1171.4% slower)
Image modifyAlpha removeColor (SIMD off) 97.000 ms
Image modifyAlpha removeColor (SIMD on) 909.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 9.371x (837.1% slower)

@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@shai-almog

shai-almog commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 167 screenshots: 167 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 67ms / native 5ms = 13.4x speedup
SIMD float-mul (64K x300) java 66ms / native 4ms = 16.5x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 67.000 ms
Base64 CN1 decode 55.000 ms
Base64 native encode 861.000 ms
Base64 encode ratio (CN1/native) 0.078x (92.2% faster)
Base64 native decode 316.000 ms
Base64 decode ratio (CN1/native) 0.174x (82.6% faster)
Base64 SIMD encode 71.000 ms
Base64 encode ratio (SIMD/CN1) 1.060x (6.0% slower)
Base64 SIMD decode 54.000 ms
Base64 decode ratio (SIMD/CN1) 0.982x (1.8% faster)
Base64 encode ratio (SIMD/native) 0.082x (91.8% faster)
Base64 decode ratio (SIMD/native) 0.171x (82.9% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 7.000 ms
Image createMask (SIMD on) 2.000 ms
Image createMask ratio (SIMD on/off) 0.286x (71.4% faster)
Image applyMask (SIMD off) 53.000 ms
Image applyMask (SIMD on) 61.000 ms
Image applyMask ratio (SIMD on/off) 1.151x (15.1% slower)
Image modifyAlpha (SIMD off) 80.000 ms
Image modifyAlpha (SIMD on) 69.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.863x (13.7% faster)
Image modifyAlpha removeColor (SIMD off) 95.000 ms
Image modifyAlpha removeColor (SIMD on) 55.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.579x (42.1% faster)

@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bfa84c5a67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +153 to +154
} else if (acceptedByFilters(request.getFilters(), resolver, u)) {
paths.add(copyToCache(resolver, u));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject the entire mixed Android selection

When an extension cannot be mapped to a MIME type, the intent is deliberately widened to */*; with multi-select, a user can therefore choose both matching and nonmatching files. This branch silently omits each rejected URI but reports success whenever at least one URI passed, so callers receive an incomplete selection without an error. Fail the whole selection or explicitly report the rejected items instead of returning only the accepted subset.

Useful? React with 👍 / 👎.

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.

1 participant