test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp
changeset 51715 13a63d4a3f8d
parent 51551 e409244ce72e
child 51870 cdfabab3413f
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Wed Sep 12 14:19:36 2018 -0300
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Wed Sep 12 10:27:03 2018 -0700
@@ -28,21 +28,8 @@
 #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 STATUS_FAILED 2
 #define PASSED 0
@@ -66,8 +53,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -118,10 +104,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb == 1)
         printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -153,23 +137,19 @@
     jint intFld;
     jlong longFld;
 
-    if ((fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, redefCls),
-        "intComplNewFld", "I")) == NULL) {
+    if ((fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
         printf("%s: Failed to get the field ID for the static field \"intComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    intFld = JNI_ENV_PTR(env)->GetStaticIntField(JNI_ENV_ARG(env, redefCls),
-        fid);
+    intFld = env->GetStaticIntField(redefCls, fid);
 
-    if ((fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, redefCls),
-        "longComplNewFld", "J")) == NULL) {
+    if ((fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
         printf("%s: Failed to get the field ID for the static field \"longComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    longFld = JNI_ENV_PTR(env)->GetStaticLongField(JNI_ENV_ARG(env, redefCls),
-        fid);
+    longFld = env->GetStaticLongField(redefCls, fid);
 
     if (intFld != 33 || longFld != 44) {
         printf("Completely new static variable has not assigned its default value:\n");
@@ -184,6 +164,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif