Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / src / bindings / java / jmsg_task.cpp
index 0bd50d6..fc8c867 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions related to the java task instances.                            */
 
-/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -115,8 +115,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jt
   }
 
   msg_error_t rv = MSG_task_cancel(ptask);
-
-  jxbt_check_res("MSG_task_cancel()", rv, MSG_OK, "unexpected error , please report this bug");
+  xbt_assert(rv == MSG_OK, "MSG_task_cancel() unexpectedly failed with error code %d. Please report this bug", rv);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
@@ -267,7 +266,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobjec
   }
 
   /* Add a global ref into the Ctask so that the receiver can use it */
-  MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
+  MSG_task_set_data(task, env->NewGlobalRef(jtask));
 
   const char* alias = env->GetStringUTFChars(jalias, nullptr);
   msg_error_t res   = MSG_task_send_with_timeout_bounded(task, alias, jtimeout, maxrate);
@@ -403,7 +402,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject j
         return nullptr;
   }
 
-  MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
+  MSG_task_set_data(task, env->NewGlobalRef(jtask));
   comm = MSG_task_isend(task,mailbox);
 
   env->SetLongField(jcomm, jtask_field_Comm_bind, (jlong) (uintptr_t)(comm));
@@ -439,7 +438,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isendBounded(JNIEnv *env, jo
         return nullptr;
   }
 
-  MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
+  MSG_task_set_data(task, env->NewGlobalRef(jtask));
   comm = MSG_task_isend_bounded(task,mailbox,maxrate);
 
   env->SetLongField(jcomm, jtask_field_Comm_bind, (jlong) (uintptr_t)(comm));
@@ -491,7 +490,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jta
   }
 
   /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
-  MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
+  MSG_task_set_data(task, env->NewGlobalRef(jtask));
   MSG_task_dsend(task, alias, msg_task_cancel_on_failed_dsend);
 
   env->ReleaseStringUTFChars(jalias, alias);
@@ -511,7 +510,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobj
   }
 
   /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
-  MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
+  MSG_task_set_data(task, env->NewGlobalRef(jtask));
   MSG_task_dsend_bounded(task, alias, msg_task_cancel_on_failed_dsend, maxrate);
 
   env->ReleaseStringUTFChars(jalias, alias);