[code-reflection] RFR: Support storing the code that builds the code model [v11]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Feb 27 11:12:06 UTC 2025


On Wed, 26 Feb 2025 18:06:44 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> In this PR we allow the user to decide how to store the code model. The first option is `TEXT`, if this is selected, we store the textual representation of the code model. The second option is `CODE_BUILDR`, if this is selected, we store the code that builds the code model. All work done here is around the second option, because the first option is already supported.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Ensure that block params are inserted in the correct order

src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/CodeModelToAST.java line 44:

> 42:     private Map<JavaType, Type> mappingFromJavaTypeToType() {
> 43:         Map<JavaType, Type> m = new HashMap<>();
> 44:         Symbol.ModuleSymbol jdk_incubator_code = syms.enterModule(names.jdk_incubator_code);

This is effectively an extension to javac's symbol table. My preference would be to:
* add whatever symbol/type you need in `CodeReflectionSymbol`
* then set up the translation map simply, like you do for primitive types -- e.g.

Map.entry(<type element>, <javac type>)

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

PR Review Comment: https://git.openjdk.org/babylon/pull/305#discussion_r1973372549


More information about the babylon-dev mailing list