Skip to content

Commit 8dc9e6c

Browse files
dfa1claude
andcommitted
refactor(codegen): use text blocks for the static templates in both generators
The fbs-gen and proto-gen CodeGen builders emitted Java via long chains of sb.append("...\n") calls. Convert the static multi-line templates (method bodies, doc comments, builders) to Java text blocks with %-positional .formatted(...) for the interpolated names — far more readable, the emitted shape now mirrors the generated output line-for-line. fbs-gen: 173 -> 79 appends, proto-gen: 191 -> 153 (the remainder are single-line or loop-interleaved per-field emitters where a text block doesn't fit). Generated output is byte-identical, verified by regenerating fbs + proto and the fbs-gen/proto-gen unit tests. Note: the decode-doc line keeps its sb.append form on purpose — as a text block its `/// ... {@code ...}` line would trip the checkstyle rule that bans {@code} in Markdown Javadoc (the rule scans raw source lines and can't tell it's a string literal being emitted into generated code). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent babd5b7 commit 8dc9e6c

2 files changed

Lines changed: 286 additions & 180 deletions

File tree

  • fbs-gen/src/main/java/io/github/dfa1/vortex/fbsgen
  • proto-gen/src/main/java/io/github/dfa1/vortex/protogen

0 commit comments

Comments
 (0)