Class DirectiveUpdateSink
@IR/@IR_PARAMETERISED/@LLVM/@BYTECODE
UPDATE blocks emitted by the directive listeners when a golden mismatches.
When the system property ek9.directive.update.file is set, the UPDATE blocks are written (append)
to that file under a single shared lock; otherwise they fall back to System.err (legacy behaviour).
WHY this exists: the per-line failure diagnostic (LineByLineComparator
-> System.err) and general test output share the console streams with the UPDATE blocks. Java's
System.out/System.err are independently buffered and (under parallel test execution) written
concurrently, so the diagnostic text interleaves character-by-character INTO the UPDATE blocks — corrupting
the auto-update scripts' input for multi-file directive tests, which then mangle a few golden files. Routing
the blocks to a dedicated file (one clean, lock-synchronised stream, no diagnostics) makes the regen
reliable. ALL directive listeners MUST emit their UPDATE block through out() under lock().
-Dek9.directive.update.file=/tmp/updates.txt; feed that file to the
update_*_directives.py script.-
Method Summary
Modifier and TypeMethodDescriptionstatic Objectlock()The single lock every listener synchronises its whole-block emission on, so blocks from different listeners (IR / LLVM / BYTECODE) can never interleave with each other in the update-file.static PrintStreamout()The stream to emit UPDATE blocks to: the configuredek9.directive.update.file(opened once, append, auto-flush), orSystem.erras the legacy fallback when the property is unset or the file cannot be opened.
-
Method Details
-
lock
The single lock every listener synchronises its whole-block emission on, so blocks from different listeners (IR / LLVM / BYTECODE) can never interleave with each other in the update-file. -
out
The stream to emit UPDATE blocks to: the configuredek9.directive.update.file(opened once, append, auto-flush), orSystem.erras the legacy fallback when the property is unset or the file cannot be opened. Callers MUST holdlock()around the full block.
-