[code-reflection] RFR: Support array type constants in code model [v2]
Paul Sandoz
psandoz at openjdk.org
Mon Jan 22 16:41:57 UTC 2024
On Mon, 22 Jan 2024 13:40:06 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:
>
> Add test case for compiler IR output
src/java.base/share/classes/java/lang/reflect/code/op/CoreOps.java line 1082:
> 1080: if (dimensions > 0) {
> 1081: desc = desc.arrayType(dimensions);
> 1082: }
Instead we can just use `TypeDesc.ofString`.
Until recently we could not parse descriptors in classes in`java.base` that are copied and repackaged in `jdk.compiler` (we are trying to limit the amount of code that is copied). With some refactoring this is now possible for such classes in `java.base` and when copied it is made partial.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/5#discussion_r1462124254
More information about the babylon-dev
mailing list