NVIDIA / NVIDIA/cuopt

Java bindings: evaluate replacing hand-written JNI with the Foreign Function & Memory API

Open
#1,794 1 comment 0 reactions 1 assignee View on GitHub

@hlinsen is already working on this.

Since Aug 25, 2026.

awaiting response
Dominant language
Cuda
Stars
1k
Forks
233
Avg merge
4d 4h
Merged PRs (30d)
95

Description

The Java bindings added in #1524 are hand-written JNI. Java 22 and later ship the Foreign Function & Memory API (JEP 454), which calls the C API directly and would remove cuopt_jni.cpp and its build entirely.

Why it was not done now: the bindings target Java 17, which is still a common default. An earlier revision of #1524 did use FFM and required Java 22 or higher.

Trade-off to settle:

  • Hand-written JNI keeps the Java 17 floor, but every static native declaration and its entry point must be kept in sync by hand. #1524 adds scripts/check_jni_symbols.sh to catch drift, since JNI resolves lazily and a mismatch otherwise surfaces only when something calls the method.
  • FFM removes the native shim and the drift class of bug, at the cost of requiring Java 22+.

cuVS uses FFM (via jextract) for its Java interface, so there is in-house precedent for the tooling.

Raised by @mlubin in review: https://github.com/NVIDIA/cuopt/pull/1524#discussion_r3839538078

Part of #1535.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.