[code-reflection] RFR: OpWriter.ColoringOption proposal [v4]
Paul Sandoz
psandoz at openjdk.org
Tue Sep 9 14:38:37 UTC 2025
On Tue, 9 Sep 2025 11:41:09 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> I propose `OpWriter` enables simple ANSI coloring based on `jdk.incubator.code.extern.OpWriter.COLOR` system property.
>>
>> ANSI coloring sample:
>> <img width="989" height="746" alt="ansi-coloring" src="https://github.com/user-attachments/assets/2025bcbe-6c6c-48ab-8ed5-67ff88b47fe6" />
>
> Adam Sotona has updated the pull request incrementally with two additional commits since the last revision:
>
> - OpParser filtering ANSI coloring
>
> - proposed changes applied
It's really hard to get agreement in this area of writing and reading (the larger elephant in the room is the lack of specification for the grammar, there are higher priority areas to focus on). At this point i think it best we do nothing in the incubator module and instead focus on external tooling, like in hat but perhaps moved out to a separate project.
src/jdk.incubator.code/share/classes/jdk/incubator/code/extern/OpParser.java line 189:
> 187:
> 188: static List<Op> parse(OpFactory opFactory, TypeElementFactory typeFactory, String in) {
> 189: in = in.replaceAll("\\033\\[\\d+m", ""); // remove ANSI coloring
Cute hack, but it makes me uncomfortable.
-------------
PR Comment: https://git.openjdk.org/babylon/pull/546#issuecomment-3271023091
PR Review Comment: https://git.openjdk.org/babylon/pull/546#discussion_r2333860507
More information about the babylon-dev
mailing list