OSDN Git Service

2007-01-18 Marco Trudel <mtrudel@gmx.ch>
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Jan 2007 20:47:50 +0000 (20:47 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Jan 2007 20:47:50 +0000 (20:47 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120930 138bc75d-0d04-0410-961f-82ee72b054a4

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 a44076f..e572a5f 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 c5c2b0f..9dc9780 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