[code-reflection] RFR: OpWriter.ColoringOption proposal

Adam Sotona asotona at openjdk.org
Thu Sep 4 12:22:06 UTC 2025


I propose OpWriter.ColoringOption, with NONE, ANSI and HTML  implementations:
- `OpWriter.toText(op, OpWriter.ColoringOption.ANSI))` will color the op with ANSI codes for terminal debug print
- `OpWriter.toText(op, OpWriter.ColoringOption.HTML))` will render the op with colors when dropped into an html `pre` block.

ANSI coloring sample:
<img width="989" height="746" alt="ansi-coloring" src="https://github.com/user-attachments/assets/2025bcbe-6c6c-48ab-8ed5-67ff88b47fe6" />

HTML coloring sample:
<img width="914" height="657" alt="html-coloring" src="https://github.com/user-attachments/assets/77f62787-68c1-4b12-b16d-e7a526570ad3" />

-------------

Commit messages:
 - OpWriter.ColoringOption

Changes: https://git.openjdk.org/babylon/pull/546/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=546&range=00
  Stats: 52 lines in 1 file changed: 44 ins; 3 del; 5 mod
  Patch: https://git.openjdk.org/babylon/pull/546.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/546/head:pull/546

PR: https://git.openjdk.org/babylon/pull/546


More information about the babylon-dev mailing list