Search in sources :

Example 1 with JNIFieldId

use of com.oracle.svm.jni.nativeapi.JNIFieldId in project graal by oracle.

the class JNIFunctions method FromReflectedField.

/*
     * jfieldID FromReflectedField(JNIEnv *env, jobject field);
     */
@CEntryPoint
@CEntryPointOptions(prologue = JNIEnvironmentEnterPrologue.class, exceptionHandler = JNIExceptionHandlerReturnNullWord.class, publishAs = Publish.NotPublished, include = CEntryPointOptions.NotIncludedAutomatically.class)
static JNIFieldId FromReflectedField(JNIEnvironment env, JNIObjectHandle fieldHandle) {
    JNIFieldId fieldId = Word.zero();
    if (JNIAccessFeature.singleton().haveJavaRuntimeReflectionSupport()) {
        Field obj = JNIObjectHandles.getObject(fieldHandle);
        if (obj != null) {
            boolean isStatic = Modifier.isStatic(obj.getModifiers());
            fieldId = JNIReflectionDictionary.singleton().getFieldID(obj.getDeclaringClass(), obj.getName());
        }
    }
    return fieldId;
}
Also used : Field(java.lang.reflect.Field) JNIFieldId(com.oracle.svm.jni.nativeapi.JNIFieldId) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Aggregations

CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)1 JNIFieldId (com.oracle.svm.jni.nativeapi.JNIFieldId)1 Field (java.lang.reflect.Field)1 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)1