RFR: 7903590: Refactor jextract source code generation
Jorn Vernee
jvernee at openjdk.org
Mon Nov 27 12:50:41 UTC 2023
On Mon, 27 Nov 2023 12:36:52 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> I don't see much point in doing this lazily, since we will always end up generating the code any way. What we could do is replace the `generate` method with a static one, that then also creates the builder internally.
>>
>> Note that `FunctionalInterfaceBuilder` is called from both TopLevelBuilder and StructBuilder, so we can't just get rid of `FunctionalInterfaceBuilder` I think. We could potentially remove `TypedefBuilder` since it's only used int he former case, but I thought we should stick to the same pattern.
>
> Not suggesting to remove those builders. But I think the client saying `new FunctionalInterfaceBuilder(...)` should be enough. E.g. my comment is really about reducing the "contract" between builders and their clients.
Okay. In that case I'd like to go with the static `generate` method. In terms of contract surface that is the same, but it allows giving a name to the code generation 'side effect' as well.
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/141#discussion_r1406110902
More information about the jextract-dev
mailing list