Skip to content

Compatibility with Java 19 - Modularize? Minimizing use of unsupported JDK parts? #208

@JorenSix

Description

@JorenSix

First of all thanks for releasing this library. For me it has really been working well but with the release of Java 19 there are a couple of changes which make it more difficult to work with this library. Mainly the access to sun.nio.ch.DirectBuffer has been cut off and in general is becomes more and more difficult to use unnamed modules.

I have taken it up to myself to modularize the package in a lmdbjava fork. Not much of the code itself has changed but some modifications were needed to allow module info to work (mainly for the test module). I also use Gradle to build the module.

To remove the dependency on sun.nio.ch.DirectBuffer I have resorted to reflection to access memory addresses. This means that still a JVM argument is needed and compatibility in the future is not guaranteed:

--add-opens=java.base/java.nio=lmdbjava

This is already an improvement over --add-opens=java.base/java.nio=ALL-UNNAMED

Please allow me to suggest a couple of enhancements which would make this work more easy to use and more future-proof:

  • Modularizing would help with compatibility of JDK 19+
  • Verifing dependencies on unsupported/unsafe JDK parts (especially the now difficult to acces sun.nio.ch.DirectBuffer )
  • Update some of the dependencies to the latest versions
  • Build the libraries in the lmdbjava project itself and ship them with the main library (e.g. for aarch64 (M1/M2) compatibility . I personally would not rely on GitHub Actions but perhaps cross compile them with Zig)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAdditional or new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions