re PR libgcj/16923 (-D* Options passed to JNI_CreateJavaVM are ignored)
2005-02-23 Thomas Fitzsimmons <fitzsim@redhat.com> PR libgcj/16923 * gcj.texi (Invocation): Add descriptions of JvVMInitArgs and JvVMOption. 2005-02-23 Thomas Fitzsimmons <fitzsim@redhat.com> PR libgcj/16923 * jni.cc (JNI_CreateJavaVM): Check JNI version. Cast args to JvVMInitArgs. Pass args to _Jv_CreateJavaVM and check return value. Move argument parsing code to prims.cc. * prims.cc (no_properties): Remove. (_Jv_Compiler_Properties): Initialize to NULL. (_Jv_Properties_Count): Initialize to 0. (parse_verbose_args): New function. (parse_init_args): New function. (_Jv_CreateJavaVM): Call parse_init_args. (_Jv_RunMain): Check return value of _Jv_CreateJavaVM. * gcj/cni.h (JvVMOption): New struct. (JvVMInitArgs): Likewise. (JvCreateJavaVM): Declare vm_args as JvVMInitArgs* rather than void*. * libjava/gcj/javaprims.h (_Jv_VMOption): New struct. (_Jv_VMInitArgs): Likewise. * include/java-props.h (_Jv_Properties_Count): Declare. * java/lang/natRuntime.cc (insertSystemProperties): Use _Jv_Properties_Count in for loop exit condition. * testsuite/libjava.jni/jni.exp (gcj_invocation_compile_c_to_binary): New procedure. (gcj_invocation_test_one): Likewise. (gcj_jni_run): Run JNI invocation API tests. * testsuite/libjava.jni/invocation/PR16923.c, testsuite/libjava.jni/invocation/PR16923.java, testsuite/libjava.jni/invocation/PR16923.out: New test. From-SVN: r95459
This commit is contained in:
parent
c150a271b1
commit
bc71e4a22b
13 changed files with 424 additions and 57 deletions
43
libjava/testsuite/libjava.jni/invocation/PR16923.c
Normal file
43
libjava/testsuite/libjava.jni/invocation/PR16923.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <assert.h>
|
||||
#include <jni.h>
|
||||
|
||||
union env_union
|
||||
{
|
||||
void *void_env;
|
||||
JNIEnv *jni_env;
|
||||
};
|
||||
|
||||
int
|
||||
main (int argc, const char** argv)
|
||||
{
|
||||
union env_union tmp;
|
||||
JNIEnv* env;
|
||||
JavaVM* jvm;
|
||||
JavaVMInitArgs vm_args;
|
||||
JavaVMOption options[1];
|
||||
jclass class_id;
|
||||
jmethodID method_id;
|
||||
jint result;
|
||||
|
||||
options[0].optionString = "-DPR16923=optionReceived";
|
||||
|
||||
vm_args.version = JNI_VERSION_1_2;
|
||||
vm_args.ignoreUnrecognized = JNI_TRUE;
|
||||
vm_args.options = options;
|
||||
vm_args.nOptions = 1;
|
||||
|
||||
result = JNI_CreateJavaVM (&jvm, &tmp.void_env, &vm_args);
|
||||
assert (result >= 0);
|
||||
|
||||
env = tmp.jni_env;
|
||||
|
||||
class_id = (*env)->FindClass (env, "PR16923");
|
||||
assert (class_id);
|
||||
|
||||
method_id = (*env)->GetStaticMethodID (env, class_id, "printIt", "()V");
|
||||
assert (method_id);
|
||||
|
||||
(*env)->CallStaticVoidMethod (env, class_id, method_id, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
7
libjava/testsuite/libjava.jni/invocation/PR16923.java
Normal file
7
libjava/testsuite/libjava.jni/invocation/PR16923.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
public class PR16923
|
||||
{
|
||||
public static void printIt ()
|
||||
{
|
||||
System.out.println (System.getProperty ("PR16923"));
|
||||
}
|
||||
}
|
1
libjava/testsuite/libjava.jni/invocation/PR16923.out
Normal file
1
libjava/testsuite/libjava.jni/invocation/PR16923.out
Normal file
|
@ -0,0 +1 @@
|
|||
optionReceived
|
Loading…
Add table
Add a link
Reference in a new issue