This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Check CNI array types
- From: Tom Tromey <tromey at redhat dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: <java-patches at gcc dot gnu dot org>
- Date: 11 Jun 2003 12:06:15 -0600
- Subject: Re: Check CNI array types
- References: <16103.28386.121591.711583@cuddles.redhat.com>
- Reply-to: tromey at redhat dot com
>>>>> "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