< prev index next >

src/hotspot/share/prims/jniCheck.cpp

Print this page
*** 279,11 ***
  
    /* check for proper field type */
    if (!id->find_local_field(&fd))
      ReportJNIFatalError(thr, fatal_static_field_not_found);
    if ((fd.field_type() != ftype) &&
!       !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
      ReportJNIFatalError(thr, fatal_static_field_mismatch);
    }
  }
  
  static inline void
--- 279,12 ---
  
    /* check for proper field type */
    if (!id->find_local_field(&fd))
      ReportJNIFatalError(thr, fatal_static_field_not_found);
    if ((fd.field_type() != ftype) &&
!       !(fd.field_type() == T_ARRAY && ftype == T_OBJECT) &&
+       !(fd.field_type() == T_INLINE_TYPE && ftype == T_OBJECT)) {
      ReportJNIFatalError(thr, fatal_static_field_mismatch);
    }
  }
  
  static inline void

*** 316,11 ***
    if (!InstanceKlass::cast(k_oop)->find_field_from_offset(offset,
                                                                false, &fd))
      ReportJNIFatalError(thr, fatal_instance_field_not_found);
  
    if ((fd.field_type() != ftype) &&
!       !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
      ReportJNIFatalError(thr, fatal_instance_field_mismatch);
    }
  }
  
  static inline void
--- 317,12 ---
    if (!InstanceKlass::cast(k_oop)->find_field_from_offset(offset,
                                                                false, &fd))
      ReportJNIFatalError(thr, fatal_instance_field_not_found);
  
    if ((fd.field_type() != ftype) &&
!       !(fd.field_type() == T_ARRAY && ftype == T_OBJECT) &&
+       !(fd.field_type() == T_INLINE_TYPE && ftype == T_OBJECT)) {
      ReportJNIFatalError(thr, fatal_instance_field_mismatch);
    }
  }
  
  static inline void

*** 367,13 ***
      ReportJNIFatalError(thr, fatal_element_type_mismatch);
    }
  }
  
  static inline void
! check_is_obj_array(JavaThread* thr, jarray jArray) {
    arrayOop aOop = check_is_array(thr, jArray);
!   if (!aOop->is_objArray()) {
      ReportJNIFatalError(thr, fatal_object_array_expected);
    }
  }
  
  /*
--- 369,13 ---
      ReportJNIFatalError(thr, fatal_element_type_mismatch);
    }
  }
  
  static inline void
! check_is_obj_or_inline_array(JavaThread* thr, jarray jArray) {
    arrayOop aOop = check_is_array(thr, jArray);
!   if (!aOop->is_objArray() && !aOop->is_flatArray()) {
      ReportJNIFatalError(thr, fatal_object_array_expected);
    }
  }
  
  /*

*** 489,11 ***
    if (name == NULL) return;  // implementation accepts NULL so just return
  
    size_t len = strlen(name);
  
    if (len >= 2 &&
!       name[0] == JVM_SIGNATURE_CLASS &&            // 'L'
        name[len-1] == JVM_SIGNATURE_ENDCLASS ) {    // ';'
      char msg[JVM_MAXPATHLEN];
      jio_snprintf(msg, JVM_MAXPATHLEN, "%s%s%s",
                   warn_bad_class_descriptor1, name, warn_bad_class_descriptor2);
      ReportJNIWarning(thr, msg);
--- 491,11 ---
    if (name == NULL) return;  // implementation accepts NULL so just return
  
    size_t len = strlen(name);
  
    if (len >= 2 &&
!       (name[0] == JVM_SIGNATURE_CLASS || name[0] == JVM_SIGNATURE_INLINE_TYPE) && // 'L' or 'Q'
        name[len-1] == JVM_SIGNATURE_ENDCLASS ) {    // ';'
      char msg[JVM_MAXPATHLEN];
      jio_snprintf(msg, JVM_MAXPATHLEN, "%s%s%s",
                   warn_bad_class_descriptor1, name, warn_bad_class_descriptor2);
      ReportJNIWarning(thr, msg);

*** 1638,11 ***
    checked_jni_GetObjectArrayElement(JNIEnv *env,
                                      jobjectArray array,
                                      jsize index))
      functionEnter(thr);
      IN_VM(
!       check_is_obj_array(thr, array);
      )
      jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index);
      functionExit(thr);
      return result;
  JNI_END
--- 1640,11 ---
    checked_jni_GetObjectArrayElement(JNIEnv *env,
                                      jobjectArray array,
                                      jsize index))
      functionEnter(thr);
      IN_VM(
!       check_is_obj_or_inline_array(thr, array);
      )
      jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index);
      functionExit(thr);
      return result;
  JNI_END

*** 1652,11 ***
                                      jobjectArray array,
                                      jsize index,
                                      jobject val))
      functionEnter(thr);
      IN_VM(
!       check_is_obj_array(thr, array);
      )
      UNCHECKED()->SetObjectArrayElement(env,array,index,val);
      functionExit(thr);
  JNI_END
  
--- 1654,11 ---
                                      jobjectArray array,
                                      jsize index,
                                      jobject val))
      functionEnter(thr);
      IN_VM(
!       check_is_obj_or_inline_array(thr, array);
      )
      UNCHECKED()->SetObjectArrayElement(env,array,index,val);
      functionExit(thr);
  JNI_END
  

*** 2302,11 ***
  
      checked_jni_GetObjectRefType,
  
      // Module Features
  
!     checked_jni_GetModule
  };
  
  
  // Returns the function structure
  struct JNINativeInterface_* jni_functions_check() {
--- 2304,12 ---
  
      checked_jni_GetObjectRefType,
  
      // Module Features
  
!     checked_jni_GetModule,
+ 
  };
  
  
  // Returns the function structure
  struct JNINativeInterface_* jni_functions_check() {
< prev index next >