public final class SemanticIRJsonExporter extends Object
SemanticProgram. Hand-rolled —
no reflection, no map ordering surprises, no third-party dependency —
so golden files stay byte-stable across JVMs and refactors.
Format is pretty-printed with two-space indent and a trailing newline. Field order within an object is fixed by the writer methods, not by any map iteration order.
| Modifier and Type | Field and Description |
|---|---|
static String |
SCHEMA_VERSION
JSON schema version emitted at the top of every exported
program.
|
public static final String SCHEMA_VERSION
"1"; future breaking
changes to the shape increment this value. Consumers can
branch on the value to handle multiple shapes if needed.
Initialised in a static block (rather than as a literal compile-time constant) so binary consumers compiled against one version of this library don't silently see the old value after a drop-in JAR upgrade. The trade-off is a slightly verbose declaration; the upside is a durable version contract (codex diff-review round-1 Q3).
public static String toJson(SemanticProgram program)