Skip to content

[Java] Escape schema constants and descriptions in generated source - #1156

Open
slachiewicz wants to merge 3 commits into
aeron-io:masterfrom
slachiewicz:java-escape-schema-text-in-generated-source
Open

slachiewicz wants to merge 3 commits into
aeron-io:masterfrom
slachiewicz:java-escape-schema-text-in-generated-source

Conversation

@slachiewicz

Copy link
Copy Markdown
Contributor

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.

@slachiewicz
slachiewicz force-pushed the java-escape-schema-text-in-generated-source branch 2 times, most recently from 9cc9d20 to 5411863 Compare November 19, 2026 21:01
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.
@slachiewicz
slachiewicz force-pushed the java-escape-schema-text-in-generated-source branch from 5411863 to dc65e1b Compare November 27, 2026 15:17
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