2007-02-13 Andrew Haley <aph@redhat.com>
[gcc.git] / libjava / testsuite / libjava.jni / PR18116.c
1 #include <stdlib.h>
2 #include <assert.h>
3 #include <PR18116.h>
4
5 // The purpose of this test is to ensure that signatures with non-top
6 // level class arguments work.
7
8 static jint
9 some_random_name (JNIEnv *env, jclass k, jobject v)
10 {
11 return 555;
12 }
13
14 JNIEXPORT jint JNICALL
15 JNI_OnLoad (JavaVM *vm, void *nothing)
16 {
17 JNIEnv *env;
18 JNINativeMethod meth;
19 jclass k;
20 jint r;
21
22 r = (*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_2);
23 assert (r == JNI_OK);
24 k = (*env)->FindClass (env, "PR18116");
25 assert (k != NULL);
26
27 meth.name = "doit";
28 meth.signature = "(Ljava/lang/String;)I";
29 meth.fnPtr = some_random_name;
30
31 r = (*env)->RegisterNatives (env, k, &meth, 1);
32 assert (r == JNI_OK);
33
34 return JNI_VERSION_1_2;
35 }