[code-reflection] RFR: Model String Template [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Feb 27 11:18:04 UTC 2024


On Mon, 26 Feb 2024 22:48:14 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Model String Template
>
> Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'code-reflection' into string-template
>  - model String Template

This looks good. Modelling-wise I'm not 100% sure about this. In the sense that the model seems a bit in between the high-level representation of the Java source code, and the low-level representation. That is, in the source code there's no string template creation - you only see a template literal applied to some processor. So, another possible IR would be something like:

stringTemplate(processor, literals, expressions):T

where T is the result type of the processor's process method.

That said, the StringTemplate class does have some factories which allow creation. Perhaps I'm just biased because javac never uses these factories, and uses a more optimized mechanism under the hood - but that is, likely, a translation detail.

I'd say let's go with what you have for now, and maybe keep thinking about this.

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

Marked as reviewed by mcimadamore (Reviewer).

PR Review: https://git.openjdk.org/babylon/pull/30#pullrequestreview-1903221707


More information about the babylon-dev mailing list