Repository navigation
[Java] Escape schema constants and descriptions in generated source - #1156
Open
slachiewicz wants to merge 3 commits into
Open
slachiewicz wants to merge 3 commits into
slachiewicz wants to merge 3 commits into
Conversation
slachiewicz
force-pushed
the
java-escape-schema-text-in-generated-source
branch
2 times, most recently
from
November 19, 2026 21:01
9cc9d20 to
5411863
Compare
Constant values go into string literals and descriptions into comments in the Java, C#, Go struct and Rust generators, so both must stay escaped or a schema can close the literal or comment and add code.
…d Java literal escaper.
slachiewicz
force-pushed
the
java-escape-schema-text-in-generated-source
branch
from
November 27, 2026 15:17
5411863 to
dc65e1b
Compare
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.
Constant values from a schema were written verbatim into string literals, and descriptions into comments, in the generated Java, C#, Go struct and Rust code. A schema could close the literal or comment and add its own code. Constants are now escaped as string literals for each language, with byte escapes for Rust byte strings. Descriptions are escaped for Javadoc and C# XML doc, and collapsed to one line where they go into line comments. Non-ASCII text is still written as is, so ordinary schemas generate the same source.
Part of #969.
Verified: SchemaInjectionTest fails on master (the Java decoder does not compile; C#, Go and Rust output contains the unescaped literal) and passes here; sbe-tool checkstyle, tests, verifyJavaIrCodecsInSync, sbe-samples check, gocode make and runRustTests pass. The C# suite was not run.