Skip to content

#3823: generated Java formats and case-maps with Locale.ROOT - #3841

Merged
squid-protocol merged 1 commit into
mainfrom
fix/3823-locale-root
Sep 26, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/3823-locale-root

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3823 (epic #3819).

Why

Generated Java used the JVM's default locale:

  • String.format("%04d", …) prints Arabic-Indic or Devanagari digits under an ar or hi locale;
  • "i".toUpperCase() gives "İ" under tr.

So a GDG generation name (G0001V00), a CICS dispatch switch or a JCL COND test could behave differently depending on the server's locale.

What

  • Batch forge: DatasetResolver's GDG name and JclConditions use Locale.ROOT.
  • Call forge: the dispatch switch uses toUpperCase(Locale.ROOT).
  • Screen forge: the CSS colour class uses toLowerCase(Locale.ROOT).
  • Reference port: carddemo-intcalc (Cbact04cService) gets the same change.
  • Porting rule: a new PORTING_RULES entry, so LLM-ported code does the same.
  • Test: tests/cobol_mainframe/test_locale_root.py generates an estate (JCL, BMS, a CICS program with a dynamic CALL). It checks every String.format call for Locale.ROOT, rejects any no-argument case mapping, and requires that at least one format was generated.

Verified

  • The whole mainframe suite passes: tests/cobol_mainframe/, 695 passed and 27 skipped.
  • ruff shows no new lint errors.

First drafted by a sandboxed Gemini fleet agent. I reviewed it and tightened the test from a per-file check to a per-call check.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

The default JVM locale changes what generated code prints: String.format("%04d") gives
Arabic-Indic or Devanagari digits under ar/hi, and "i".toUpperCase() is "İ" under tr --
so a GDG generation name, a CICS dispatch switch or a JCL COND test could differ by
the server's locale.

- batch forge (GDG name, JclConditions), call forge (dispatch switch), screen forge
  (CSS colour): Locale.ROOT everywhere, with the import
- the carddemo-intcalc reference port: the same
- a porting rule tells ported code to do the same
- test: a generated estate has no String.format without Locale.ROOT (checked per
  call) and no no-argument toUpperCase / toLowerCase

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 306b424 into main Sep 26, 2026
37 checks passed
@squid-protocol
squid-protocol deleted the fix/3823-locale-root branch September 26, 2026 22:54
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.

Locale-dependent formatting: String.format / toUpperCase / toLowerCase without Locale.ROOT in generated code and the reference port

1 participant