RFR: 7903674: jextract should ignore non-enum constants inside enum [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Feb 20 12:46:03 UTC 2024


On Tue, 20 Feb 2024 12:27:38 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Athijegannathan Sundararajan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   moved nested 'if' inside 'else' as 'else if'
>
> src/main/java/org/openjdk/jextract/impl/TreeMaker.java line 476:
> 
>> 474:                     collectNestedTypes(m, nestedTypes, ignoreNestedParams);
>> 475:                 } else {
>> 476:                     Declaration decl = createTree(m);
> 
> note that the output of this method is only used by `withNestedTypes` which already filters the output, looking for scoped declarations. E.g. it has `d instanceof Scoped` which will fail if the decl is `null`. So I don't think this adds much, but perhaps it could be slightly cleaner to filter out nulls as you did.

Actually, debugging some more I realized that in this case we first check `m.isDefinition()` which always returns false for attributes. So I don't think we can ever get nulls here.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/221#discussion_r1495760163


More information about the jextract-dev mailing list