Java program that reproduces it
package samples.javacore.loadlibrary.example;
public class JniClassOperationsDemo {
static {
System.loadLibrary("jni_test_lib");
}
private static native Class<?> findClass(String className);
public static void main(String[] args) {
test("dot notation", "java.lang.String"); // fixme: should not pass
test("primitive I", "I"); // fixme: should not pass
test("primitive J", "J"); // fixme: should not pass
test("primitive V", "V"); // fixme: should not pass
}
private static void test(String label, String className) {
try {
Class<?> clazz = findClass(className);
System.out.printf("[OK] %s -> %s%n", label, clazz);
} catch (Throwable t) {
System.out.printf("[FAIL] %s -> %s%n", label, t);
}
}
}
Steps to reproduce
Run: cargo run -- package samples.javacore.loadlibrary.example.JniClassOperationsDemo
Expected behaviour
Should throw java.lang.NoClassDefFoundError
Actual behaviour
Creates corresponding Class<?>
Environment
| Field |
Value |
| OS |
Ubuntu 24.04 x86_64 / macOS 14 arm64 / Windows 11 |
| Rust version |
rustc 1.95.0 (59807616e 2026-04-14) |
| JDK version |
25 |
Additional context
Java program that reproduces it
Steps to reproduce
Run:
cargo run -- package samples.javacore.loadlibrary.example.JniClassOperationsDemoExpected behaviour
Should throw
java.lang.NoClassDefFoundErrorActual behaviour
Creates corresponding Class<?>
Environment
Additional context