RFR: 7903608: Cyclic initialization leads to NPE in header class with global variable [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Dec 14 15:06:15 UTC 2023
On Thu, 14 Dec 2023 12:43:43 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Drop spurious option in tests
>
> src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 361:
>
>> 359: if (declaration != null) {
>> 360: emitDocComment(declaration);
>> 361: }
>
> Spurious change? (same below)
Good catch - I have absolutely no idea of how that came to be :-)
> So, it looks like we adjust the class name at the last moment when generating the file. That's fine I think, but it also means that the `SourceFileBuilder::className` field is 'fake'/a place holder in some cases. That seems like it might be problematic if other code starts to naively use `SourceFileBuilder::className`.
Yep - I was aware of this, and probably the biggest reason as to why I wasn't proud with the change. I looked at the usages of className the other day, and they felt a bit too many - and depended on in various places when we generate code. I can take another look, but I was in doubt as to whether fix this issue first and maybe improve the code later (given that jextract is currently quite broken). What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/160#discussion_r1426842180
PR Review Comment: https://git.openjdk.org/jextract/pull/160#discussion_r1426839081
More information about the jextract-dev
mailing list