RFR: Generate Java enums
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Jul 7 21:36:51 UTC 2025
On Mon, 7 Jul 2025 21:33:15 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> > What, in Java, gives you this OR-like functionality for enums? EnumSet!
>
> Modelling each enum value as an enum set is certainly possible. It also sounds as overkill. One of the principles of jextract is to add as little overhead as possible. I think here we should just be honest and admit that C enums and Java enums don't have much in common, except for the use of the word `enum`.
(note -- this does NOT mean that other, more specialized, code generators could not model C enums as Java enums. Perhaps in some code bases that makes total sense. But jextract is intended to provide reliable bindings for _all_ C headers -- which sort of restricts the kind of tricks we can play)
-------------
PR Comment: https://git.openjdk.org/jextract/pull/284#issuecomment-3046583256
More information about the jextract-dev
mailing list