Embed en-US CLDR data in native image - #42
Open
delphyne wants to merge 1 commit into
Open
Conversation
Mirrors the fix landed on `protoc-gen-markdown`. The native binary aborts
at startup with:
MissingReflectionRegistrationError: sun.text.resources.cldr.FormatData_en_US
protobuf-java's `RuntimeVersion.<clinit>` calls `String.format` when
building its version string, which routes through
`DecimalFormatSymbols.getInstance` → `LocaleData.getBundle` →
`Class.forName("sun.text.resources.cldr.FormatData_en_US")`. With
`-H:ThrowMissingRegistrationErrors=` set and no CLDR data embedded, the
lookup is fatal.
Add `-H:IncludeLocales=en-US` so the en-US bundle is baked in.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors https://github.com/engine-public/protoc-gen-markdown/pull/17. Once
protoc-gen-openapiv1.0.0 is invoked as aprotocplugin, its GraalVM-native binary aborts at startup:protobuf-java'sRuntimeVersion.<clinit>callsString.formatwhen building its runtime version string, which routes throughDecimalFormatSymbols.getInstance→LocaleData.getBundle→Class.forName("sun.text.resources.cldr.FormatData_en_US").resources.autodetect()does not embed JDK CLDR bundles, and-H:ThrowMissingRegistrationErrors=(empty value = throw on any missing) makes the lookup fatal.Fix: add
-H:IncludeLocales=en-USso the en-US CLDR bundle is baked into the binary.Companion PRs against the sibling plugins:
Observed via the staging PR https://github.com/HotelEngine/engine-partner-api-staging/pull/106 which pins all three engine protoc plugins to Maven Central releases. The build died on
protoc-gen-markdownfirst (alphabetical plugin invocation order) so openapi has not yet been observed failing in the wild — but the same static-init path exists and will fail the same way as soon as it is exercised.Test plan
./gradlew nativeCompileproduces a binary that starts without theMissingReflectionRegistrationErrorengine-partner-api-stagingPR consumes the follow-up release and its:engine-partner-api-service:generateProtosucceeds🤖 Generated with Claude Code