RFR: 7903932: Make private static classes final and have a private constructor

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jan 17 11:38:53 UTC 2025


On Fri, 17 Jan 2025 07:41:53 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

> Please review this patch to make static utility classes final with a private constructor, as they are not meant to be extended.
> 
> This is a small refractor of the generated code.
> 
> TIA

While I don't object to the refactoring, I feel ambivalent about it. These classes are private, so it's impossible for jextract clients to do anything with them. What do the extra constructor and extra finality add? It only seems to protect against the event that jextract itself will generate code extending this classes, which seems a corner^4 case.

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

PR Comment: https://git.openjdk.org/jextract/pull/274#issuecomment-2598171344


More information about the jextract-dev mailing list