This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Check CNI array types


>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:

Andrew> +_Jv_JNI_check_types (JArray<T> *array, jclass K)
Andrew> +{
Andrew> +  jclass klass = array->getClass()->getComponentType();
Andrew> +  if (__builtin_expect (klass != K, false))
Andrew> +    throw new java::lang::IllegalAccessError ();
 
Andrew>  (JNICALL _Jv_JNI_GetPrimitiveArrayElements) (JNIEnv *, JArray<T> *array,
Andrew>  				             jboolean *isCopy)
Andrew>  {
Andrew>    array = unwrap (array);
Andrew> +  _Jv_JNI_check_types (array, K);

A function in the JNI table can't simply throw.  It must convert the
exception into a JNI exception.  See _Jv_JNI_NewPrimitiveArray for an
example.

If you've got a few minutes, could you add a new JNI test case for
this patch?  Adding a JNI test case is really easy.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]