The code generated by jextract requires to use --enable-native-access where it should not

Remi Forax forax at univ-mlv.fr
Wed Sep 18 21:01:34 UTC 2024


Hello,
the code generated by jextract should be re-arranged so it only requires to use --enable-native-access when the user uses a function that can violate the integrity.

Currently, if a .h only contains a simple struct, like
  struct point {
    int x;
    int y;
  };

jextract generates two java classes, point and point_h, point describe the structures and point_h the library,
but because point has a runtime dependency on point_h, a code like

  import point;
  import point_h;

  try(var arena = Arena.ofConfined()) {
    var p = point.allocate(arena);
    point.x(p, 42);
    System.out.println(point.x(p));
  }

requires to use --enable-native-access even if using a layout does not violate the integrity of the application/platform.

regards,
Rémi


More information about the panama-dev mailing list