The change below is not needed as the call to nsk_jvmti_aod_disableEventAndFinish() does exactly the same:
- nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_OBJECT_FREE, success, jvmti, jni);
+
+ /* Flush any pending ObjectFree events, which may set success to 1 */
+ if (jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL) != JVMTI_ERROR_NONE) {
+ success = 0;
+ }
+
+ nsk_aod_agentFinished(jni, agentName, success);
}
Posting the event in nsk_jvmti_aod_disableEventAndFinish rather than in the caller beforehand, sets the global 'success' variable and not this local variable so the test would fail. We should fix these functions so that this code isn't duplicated in one of the tests. Found when reviewing JDK-8212879.
Then we can undo this part of this patch.