jextract JDK19 Windows enum handling

Duncan Gittins duncan.gittins at gmail.com
Sun Jun 5 12:47:57 UTC 2022


I'm a bit behind with all latest Panama messages so apologies if this
repeats existing issues. I've been testing out latest jextract from master
branch, along with jdk19 - both with non-incubator foreign package names.

There are some unexpected enum values in extractions, perhaps related to
https://bugs.openjdk.java.net/browse/CODETOOLS-7903198

Test with header file "Shell32.h" which contains "#include <shlobj_core.h>"

1) With latest JDK19 branch I see an enum that I don't use, and this
appears every time regardless of "--include--xxx" flags:

    jextract --source -lshell32 -t win.shell --output shell19.src Shell32.h
--include-enum THIS_DOES_NOT_EXIST
    => Shell32_h contains 100+ values of "WELL_KNOWN_SID_TYPE"

[ BTW: It would be nice if jextract had a mode (eg "--show-warnings") which
reported "No such enum: THIS_DOES_NOT_EXIST".]

2) Is there a way to extract one enum value SLGP_SHORTPATH with JDK19
jextract?

In previous JDK18 jextract release I could extract a single enum value
SLGP_SHORTPATH (with "--include-macro" which was changed in
CODETOOLS-7903198)

     jextract --source -lshell32 -t win.shell --output shell18.src
Shell32.h --include-macro SLGP_SHORTPATH
=>  class Shell32_h  { // omitted lines with Constants$root....
        public static int SLGP_SHORTPATH() { return (int)1L;  }
    }

Adding "--include-enum SLGP_FLAGS" will introduce new definitions including
SLGP_SHORTPATH (and WELL_KNOWN_SID_TYPE), but it would be nicer to have
just a single definition for the value "SLGP_SHORTPATH".

Kind regards

Duncan


More information about the panama-dev mailing list