RFR: 7903788: preparation towards json configuration for jextract tool [v4]

Athijegannathan Sundararajan sundar at openjdk.org
Fri Aug 16 14:06:19 UTC 2024


On Fri, 16 Aug 2024 13:54:29 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

>> What's the advantage of having the arrayConverters? In the end they will still (a) create a new array and (b) loop over the contents. Wouldn't it make more sense to define all the array logic in here, remove `arrayConverters` and then just redefine all the implementations of the factories in `JSONArrays` as shortcuts to this method?
>
>> What about j.l.reflect.GenericArrayType? That seems like a valid target for this?
> 
> I though of GenericArrayType. Then realised that I've walk to the bottom type and find the eraser type.. and then build array-of-array.. (up to whatever dimension. Say List<String>[][][]). Not sure if that is worth it.

> What's the advantage of having the arrayConverters? In the end they will still (a) create a new array and (b) loop over the contents. Wouldn't it make more sense to define all the array logic in here, remove `arrayConverters` and then just redefine all the implementations of the factories in `JSONArrays` as shortcuts to this method?

Wouldn't that involve comparing Class object with a series of if-else-if for array component type? if (type == boolean.class).. else if (type == char.class)... unless I miss something.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/257#discussion_r1719882493


More information about the jextract-dev mailing list