OSDN Git Service

* testsuite/libjava.jni/init.c: New file.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Feb 2007 22:02:40 +0000 (22:02 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Feb 2007 22:02:40 +0000 (22:02 +0000)
* testsuite/libjava.jni/init.java: New file.
* testsuite/libjava.jni/init.out: New file.
* testsuite/libjava.jni/init.jar: New file.
* testsuite/libjava.jni/init.h: New file.
* testsuite/libjava.jni/init$NativeClass.h: New file.

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

libjava/ChangeLog
libjava/testsuite/libjava.jni/init$NativeClass.h [new file with mode: 0644]
libjava/testsuite/libjava.jni/init.c [new file with mode: 0644]
libjava/testsuite/libjava.jni/init.h [new file with mode: 0644]
libjava/testsuite/libjava.jni/init.jar [new file with mode: 0644]
libjava/testsuite/libjava.jni/init.java [new file with mode: 0644]
libjava/testsuite/libjava.jni/init.out [new file with mode: 0644]

index cc6a25f..06c1a1f 100644 (file)
@@ -1,3 +1,12 @@
+2007-02-07  Tom Tromey  <tromey@redhat.com>
+
+       * testsuite/libjava.jni/init.c: New file.
+       * testsuite/libjava.jni/init.java: New file.
+       * testsuite/libjava.jni/init.out: New file.
+       * testsuite/libjava.jni/init.jar: New file.
+       * testsuite/libjava.jni/init.h: New file.
+       * testsuite/libjava.jni/init$NativeClass.h: New file.
+
 2007-02-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR libgomp/28468
diff --git a/libjava/testsuite/libjava.jni/init$NativeClass.h b/libjava/testsuite/libjava.jni/init$NativeClass.h
new file mode 100644 (file)
index 0000000..0ae6d4c
--- /dev/null
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#include <jni.h>
+
+#ifndef __init_00024NativeClass__
+#define __init_00024NativeClass__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_init_00024NativeClass_printHello (JNIEnv *env, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __init_00024NativeClass__ */
diff --git a/libjava/testsuite/libjava.jni/init.c b/libjava/testsuite/libjava.jni/init.c
new file mode 100644 (file)
index 0000000..458d6d7
--- /dev/null
@@ -0,0 +1,8 @@
+#include <jni.h>
+#include <init$NativeClass.h>
+
+JNIEXPORT void JNICALL
+Java_init_00024NativeClass_printHello(JNIEnv *env, jclass cl)
+{
+       printf("hello\n");
+}
diff --git a/libjava/testsuite/libjava.jni/init.h b/libjava/testsuite/libjava.jni/init.h
new file mode 100644 (file)
index 0000000..4ad3298
--- /dev/null
@@ -0,0 +1,18 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#include <jni.h>
+
+#ifndef __init__
+#define __init__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __init__ */
diff --git a/libjava/testsuite/libjava.jni/init.jar b/libjava/testsuite/libjava.jni/init.jar
new file mode 100644 (file)
index 0000000..1bf20ac
Binary files /dev/null and b/libjava/testsuite/libjava.jni/init.jar differ
diff --git a/libjava/testsuite/libjava.jni/init.java b/libjava/testsuite/libjava.jni/init.java
new file mode 100644 (file)
index 0000000..3303d31
--- /dev/null
@@ -0,0 +1,26 @@
+// Regression test for JNI and static initializers.
+
+public class init
+{
+  public static class NativeClass
+  {
+    static
+    {
+      System.out.println("static initializer 2");
+      System.loadLibrary("init"); // if it's here, this app doesn't work
+    }
+
+    public static native void printHello();
+  }
+
+  static
+  {
+    System.out.println("static initializer 1");
+  }
+
+  public static void main(String[] args)
+  {
+    //System.loadLibrary("test"); // if it's here, this app works
+    NativeClass.printHello();
+  }
+}
diff --git a/libjava/testsuite/libjava.jni/init.out b/libjava/testsuite/libjava.jni/init.out
new file mode 100644 (file)
index 0000000..4e62d1f
--- /dev/null
@@ -0,0 +1,3 @@
+static initializer 1
+static initializer 2
+hello