]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jni.cc (_Jv_JNI_FindClass): Initialize class.
authorMarco Trudel <mtrudel@gmx.ch>
Thu, 18 Jan 2007 20:47:50 +0000 (21:47 +0100)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 18 Jan 2007 20:47:50 +0000 (20:47 +0000)
2007-01-18  Marco Trudel  <mtrudel@gmx.ch>

* jni.cc (_Jv_JNI_FindClass): Initialize class.
* testsuite/libjava.jni/findclass2.jar: New file.
* testsuite/libjava.jni/findclass2.h: New file.
* testsuite/libjava.jni/findclass2.java: New file
* testsuite/libjava.jni/findclass2.c: New file.
* testsuite/libjava.jni/findclass2.out: New file.

From-SVN: r120930

libjava/ChangeLog
libjava/jni.cc
libjava/testsuite/libjava.jni/findclass2.c [new file with mode: 0644]
libjava/testsuite/libjava.jni/findclass2.h [new file with mode: 0644]
libjava/testsuite/libjava.jni/findclass2.jar [new file with mode: 0644]
libjava/testsuite/libjava.jni/findclass2.java [new file with mode: 0644]
libjava/testsuite/libjava.jni/findclass2.out [new file with mode: 0644]

index a44076f4f7b7124995df6bda17c5b49a1e5570a2..e572a5f91a99ba3052b6f187e41836ff4b53534f 100644 (file)
@@ -1,3 +1,12 @@
+2007-01-18  Marco Trudel  <mtrudel@gmx.ch>
+
+       * jni.cc (_Jv_JNI_FindClass): Initialize class.
+       * testsuite/libjava.jni/findclass2.jar: New file.
+       * testsuite/libjava.jni/findclass2.h: New file.
+       * testsuite/libjava.jni/findclass2.java: New file
+       * testsuite/libjava.jni/findclass2.c: New file.
+       * testsuite/libjava.jni/findclass2.out: New file.
+
 2007-01-18  Tom Tromey  <tromey@redhat.com>
 
        * configure: Rebuilt.
index c5c2b0ff3cd9c1179bc8f2ac6edbff25db0e7e14..9dc9780f9a06efebbec59a400d2ce06f4615a4f8 100644 (file)
@@ -1,6 +1,6 @@
 // jni.cc - JNI implementation, including the jump table.
 
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation
 
    This file is part of libgcj.
@@ -552,6 +552,7 @@ _Jv_JNI_FindClass (JNIEnv *env, const char *name)
        }
 
       r = loader->loadClass (n);
+      _Jv_InitClass (r);
     }
   catch (jthrowable t)
     {
diff --git a/libjava/testsuite/libjava.jni/findclass2.c b/libjava/testsuite/libjava.jni/findclass2.c
new file mode 100644 (file)
index 0000000..634aea7
--- /dev/null
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+
+#include <findclass2.h>
+
+JNIEXPORT void JNICALL
+Java_findclass2_searchClass (JNIEnv *env, jclass klass)
+{
+  (*env)->FindClass (env, "findclass2$inner");
+}
diff --git a/libjava/testsuite/libjava.jni/findclass2.h b/libjava/testsuite/libjava.jni/findclass2.h
new file mode 100644 (file)
index 0000000..65d0746
--- /dev/null
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#include <jni.h>
+
+#ifndef __findclass2__
+#define __findclass2__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_findclass2_searchClass (JNIEnv *env, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __findclass2__ */
diff --git a/libjava/testsuite/libjava.jni/findclass2.jar b/libjava/testsuite/libjava.jni/findclass2.jar
new file mode 100644 (file)
index 0000000..05f867d
Binary files /dev/null and b/libjava/testsuite/libjava.jni/findclass2.jar differ
diff --git a/libjava/testsuite/libjava.jni/findclass2.java b/libjava/testsuite/libjava.jni/findclass2.java
new file mode 100644 (file)
index 0000000..f7c0996
--- /dev/null
@@ -0,0 +1,24 @@
+// Test that FindClass initializes the class.
+
+public class findclass2
+{
+  public static class inner
+  {
+    static
+    {
+      System.out.println("hello");
+    }
+  }
+
+  public static native void searchClass();
+
+  static
+  {
+    System.loadLibrary("findclass2");
+  }
+
+  public static void main(String[] args)
+  {
+    searchClass();
+  }
+}
diff --git a/libjava/testsuite/libjava.jni/findclass2.out b/libjava/testsuite/libjava.jni/findclass2.out
new file mode 100644 (file)
index 0000000..ce01362
--- /dev/null
@@ -0,0 +1 @@
+hello