RFR: 7903933: Move sharable items from different generations to a common file [v6]

Nizar Benalla nbenalla at openjdk.org
Fri May 2 14:33:58 UTC 2025


On Mon, 28 Apr 2025 15:59:58 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   make utility classes final with a private constructor
>
> src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 67:
> 
>> 65:         SourceFileBuilder sfb = SourceFileBuilder.newSourceFile(packageName(), SHARED);
>> 66:         HeaderFileBuilder sharedBuilder = new HeaderFileBuilder(sfb, SHARED, null, SHARED);
>> 67:         sharedBuilder.appendBlankLine();
> 
> There seems to be a lot of overlapping between the code here and the one in `nextHeader` -- especially now that the first header is not really meant to have a lot of special things (the only exception being the symbol lookup logic).

Fixed, I consolidated the shared code in some methods. I ran into issues with the java files having the wrong name so I had to change the logic a little.

> src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 80:
> 
>> 78:         first.classBegin();
>> 79:         first.emitDefaultConstructor();
>> 80:         first.emitRuntimeHelperMethods();
> 
> Shouldn't the runtime helper methods end up in the shared class?

Fixed in https://github.com/openjdk/jextract/pull/278/commits/5c8802a6abc2fbb65a1bf341be2e7e11c5936c74, I thought only the shared symbols belonged in the separate class.

I did not move the library arena to the separate class and instead kept it close to the symbol lookup.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2071703755
PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2071701834


More information about the jextract-dev mailing list