Skip to content

Use Locale.ROOT for identifier case conversions#149

Open
adamw7 wants to merge 1 commit into
mainfrom
claude/fix-utils-locale
Open

Use Locale.ROOT for identifier case conversions#149
adamw7 wants to merge 1 commit into
mainfrom
claude/fix-utils-locale

Conversation

@adamw7
Copy link
Copy Markdown
Owner

@adamw7 adamw7 commented Apr 19, 2026

Summary

Utils.firstToLower, firstUpper, and toProperCase called String#toUpperCase() / toLowerCase() with the default locale. These helpers are used to build Java identifiers that are emitted into generated source. Under the Turkish locale, 'I'.toLowerCase() yields ı (dotless) and 'i'.toUpperCase() yields İ — either one produces an identifier the Java compiler rejects.

Pass Locale.ROOT to every call so the output is deterministic across locales.

Test plan

  • mvn install passes
  • Generator output unchanged under a US/UK locale
  • Spot-check: run the generator under -Duser.language=tr -Duser.country=TR and confirm identifiers now remain ASCII-lower/upper case

Utils case-conversion helpers used the default locale. Under the Turkish
locale, lower-casing 'I' produces a dotless 'ı' and upper-casing 'i'
produces 'İ' — either one would emit an identifier that the Java
compiler rejects, breaking codegen on Turkish-locale machines. These
conversions are for Java source output, so they should always be
locale-independent.
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.

2 participants