Top Description Fields Constructors Methods
org.graalvm.nativeimage

public final Class MissingJNIRegistrationError

extends Error
Class Inheritance
Imports
java.io.Serial, java.lang.reflect.Constructor, .Field, .Method

This exception is thrown when a JNI query tries to access an element that was not registered for JNI access in the program. When an element is not registered, the exception will be thrown both for elements that exist and elements that do not exist on the given classpath.

The purpose of this exception is to easily discover unregistered elements and to assure that all JNI operations for registered elements have the expected behaviour.

Queries will succeed (or throw the expected error) if the element was registered for JNI access. If that is not the case, a MissingJNIRegistrationError will be thrown.

The exception thrown by the JNI query is a pending exception that needs to be explicitly checked by the calling native code. Examples:

Registration: "fields": [{"name": "registeredField"}, {"name": "registeredNonexistentField"}]
GetFieldID(declaringClass, "registeredField") will return the expected field.
GetFieldID(declaringClass, "registeredNonexistentField") will throw a NoSuchFieldError.
GetFieldID(declaringClass, "unregisteredField") will throw a MissingJNIRegistrationError.
GetFieldID(declaringClass, "unregisteredNonexistentField") will throw a MissingJNIRegistrationError.

Since
24.1

Field Summary

Modifier and TypeField and Description
private final Class<?>
private final String
private final Class<?>
private static final long
private final String

Constructor Summary

AccessConstructor and Description
public
MissingJNIRegistrationError(String message, Class<?> elementType, Class<?> declaringClass, String elementName, String signature)

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

The class on which the missing query was tried, or null on static queries.
getDeclaringClass
()

public String

Returns:

The name of the queried element.
getElementName
()

public Class<?>

Returns:

The type of the element trying to be queried (Class, Method, Field or Constructor).
getElementType
()

public String

Returns:

The signature passed to the query, or null if the query doesn't take a signature as argument.
getSignature
()

Field Detail

declaringClassback to summary
private final Class<?> declaringClass
elementNameback to summary
private final String elementName
elementTypeback to summary
private final Class<?> elementType
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Error.serialVersionUID.

Annotations
@Serial
signatureback to summary
private final String signature

Constructor Detail

MissingJNIRegistrationErrorback to summary
public MissingJNIRegistrationError(String message, Class<?> elementType, Class<?> declaringClass, String elementName, String signature)
Since
24.1

Method Detail

getDeclaringClassback to summary
public Class<?> getDeclaringClass()
Returns:Class<?>

The class on which the missing query was tried, or null on static queries.

Since
23.0
getElementNameback to summary
public String getElementName()
Returns:String

The name of the queried element.

Since
23.0
getElementTypeback to summary
public Class<?> getElementType()
Returns:Class<?>

The type of the element trying to be queried (Class, Method, Field or Constructor).

Since
23.0
getSignatureback to summary
public String getSignature()
Returns:String

The signature passed to the query, or null if the query doesn't take a signature as argument.

Since
23.0