RFR: 7903609: Jextract can not handle some anonymous nested structs [v2]
Jorn Vernee
jvernee at openjdk.org
Wed Dec 13 17:04:11 UTC 2023
On Wed, 13 Dec 2023 16:56:30 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> src/main/java/org/openjdk/jextract/impl/TreeMaker.java line 346:
>>
>>> 344: AtomicReference<OptionalLong> result = new AtomicReference<>(OptionalLong.empty());
>>> 345: record.forEach(fc -> {
>>> 346: if (result.get().isPresent()) return;
>>
>> Why don't we return after setting a result, instead of waiting for the next cursor and then returning if we see a result has been set?
>
> We can not return from the outer function in the forEach. I don't think there is a way to short-circuit the forEach.
We could enhance the forEach to take a `Predicate` instead, so that we can return true/false to short-circuit, and then have a Consumer overload that just always returns true. I'll look at that
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/159#discussion_r1425643325
More information about the jextract-dev
mailing list