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 12:26:09 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/main/java/org/openjdk/jextract/json/JSONObjects.java line 562:
>> 
>>> 560: 
>>> 561:     private static Object convertArray(JSONArray ja, Type targetType) {
>>> 562:         if (targetType instanceof Class cls) {
>> 
>> What about j.l.reflect.GenericArrayType? That seems like a valid target for this?
>
> 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.

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

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


More information about the jextract-dev mailing list