aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2007-02-07 22:02:40 +0000
committerTom Tromey <tromey@gcc.gnu.org>2007-02-07 22:02:40 +0000
commit0ccadf458df125985960ccff8a7d065ae5166908 (patch)
tree04a2d96ba724f8fad6f0f80d8ed7f01534b6c126 /libjava/testsuite
parent28890c82436218c1e10b28339a21453e8d6c4cbd (diff)
downloadgcc-0ccadf458df125985960ccff8a7d065ae5166908.zip
gcc-0ccadf458df125985960ccff8a7d065ae5166908.tar.gz
gcc-0ccadf458df125985960ccff8a7d065ae5166908.tar.bz2
init.c: New file.
* 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. From-SVN: r121698
Diffstat (limited to 'libjava/testsuite')
-rw-r--r--libjava/testsuite/libjava.jni/init$NativeClass.h19
-rw-r--r--libjava/testsuite/libjava.jni/init.c8
-rw-r--r--libjava/testsuite/libjava.jni/init.h18
-rw-r--r--libjava/testsuite/libjava.jni/init.jarbin0 -> 1294 bytes
-rw-r--r--libjava/testsuite/libjava.jni/init.java26
-rw-r--r--libjava/testsuite/libjava.jni/init.out3
6 files changed, 74 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.jni/init$NativeClass.h b/libjava/testsuite/libjava.jni/init$NativeClass.h
new file mode 100644
index 0000000..0ae6d4c
--- /dev/null
+++ b/libjava/testsuite/libjava.jni/init$NativeClass.h
@@ -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
index 0000000..458d6d7
--- /dev/null
+++ b/libjava/testsuite/libjava.jni/init.c
@@ -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
index 0000000..4ad3298
--- /dev/null
+++ b/libjava/testsuite/libjava.jni/init.h
@@ -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
index 0000000..1bf20ac
--- /dev/null
+++ b/libjava/testsuite/libjava.jni/init.jar
Binary files differ
diff --git a/libjava/testsuite/libjava.jni/init.java b/libjava/testsuite/libjava.jni/init.java
new file mode 100644
index 0000000..3303d31
--- /dev/null
+++ b/libjava/testsuite/libjava.jni/init.java
@@ -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
index 0000000..4e62d1f
--- /dev/null
+++ b/libjava/testsuite/libjava.jni/init.out
@@ -0,0 +1,3 @@
+static initializer 1
+static initializer 2
+hello