[code-reflection] RFR: Support array type constants in code model [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jan 22 18:15:57 UTC 2024


On Mon, 22 Jan 2024 17:20:24 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

>> Previously, expressions like `String[].class` weren't supported in the code model.
>> 
>> As types are embedded by their fully qualified names (e.g. `java.lang.String[]`), we also have to parse that representation again. I didn't find an existing method to do so, so I wrote it myself. Please let me know if there's a better approach.
>> 
>> I also adapted the test from `TestArrayCreation.java`, using different kinds of array types.
>
> Hannes Greule has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use TypeDesc.ofString instead of custom parsing

test/langtools/tools/javac/reflect/ConstantsTest.java line 219:

> 217:     }
> 218: 
> 219:     @IR("""

Thanks - the test looks good. Is it worth it to maybe also try `String[][]` and `String[][][]` ?

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

PR Review Comment: https://git.openjdk.org/babylon/pull/5#discussion_r1462233741


More information about the babylon-dev mailing list