* tests/gc/NativeGlobalRef.java: Improved testcase.
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Mon, 3 Sep 2007 23:06:30 +0000 (01:06 +0200)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Mon, 3 Sep 2007 23:06:30 +0000 (01:06 +0200)
* tests/gc/native.c: Likewise.

tests/gc/NativeGlobalRef.java
tests/gc/native.c

index 1ee8949ce44aa6dcaaa3f8c4d100c952a1b02a30..588c6ff6820f4988370cb537fac5af0e60c44c77 100644 (file)
@@ -1,6 +1,7 @@
 public class NativeGlobalRef {
        public native static void setReference(Object o);
        public native static Object getReference();
+       public native static void delReference();
 
        public static void main(String args[]) {
                Object o;
@@ -28,5 +29,8 @@ public class NativeGlobalRef {
                /* is the object still there? */
                o = getReference();
                System.out.println(o);
+
+               /* delete the reference inside the native world */
+               delReference();
        }
 }
index cc0a0e621a5ae4b8c90ee52f8b2b2e5b2b378956..6451ec01fcc40364b2f917226f633d1193e0baf8 100644 (file)
@@ -19,3 +19,12 @@ JNIEXPORT jobject JNICALL Java_NativeGlobalRef_getReference(JNIEnv *env, jclass
 
        return ref;
 }
+
+JNIEXPORT void JNICALL Java_NativeGlobalRef_delReference(JNIEnv *env, jclass c)
+{
+       printf("Native-World: delReference()\n");
+
+       (*env)->DeleteGlobalRef(env, ref);
+
+       return;
+}