< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp

Print this page
rev 51716 : 8210665: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[R-U] tests
Summary: Remove JNI_ENV macros from the tests
Reviewed-by:

@@ -26,25 +26,12 @@
 #include <inttypes.h>
 #include "jvmti.h"
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
 
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
 
 typedef struct {

@@ -106,12 +93,11 @@
 
     if (options != NULL && strcmp(options, "printdump") == 0) {
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
     }
 

@@ -166,17 +152,15 @@
         return;
     }
 
     for (i = 0; i < sizeof(fields) / sizeof(field); i++) {
         if (fields[i].stat == JNI_TRUE) {
-            fields[i].fid = JNI_ENV_PTR(env)->
-                GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                                 fields[i].name, fields[i].sig);
+            fields[i].fid = env-> GetStaticFieldID(
+                cls, fields[i].name, fields[i].sig);
         } else {
-            fields[i].fid = JNI_ENV_PTR(env)->
-                GetFieldID(JNI_ENV_ARG(env, cls),
-                           fields[i].name, fields[i].sig);
+            fields[i].fid = env->GetFieldID(
+                cls, fields[i].name, fields[i].sig);
         }
         if (fields[i].fid == NULL) {
             printf("Unable to set access watch on %s fld%" PRIuPTR ", fieldID=0",
                    fields[i].descr, i);
         } else {

@@ -218,8 +202,6 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getRes(JNIEnv *env, jclass cls) {
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
< prev index next >