[GIT] ppl/ppl(master): Convert C++ Variable id' s to jlong before passing them to Java methods.

Module: ppl/ppl Branch: master Commit: 30478fbeb75f3e675ec0b3eff32f0a8dd7991f7a URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=30478fbeb75f3...
Author: Enea Zaffanella enea.zaffanella@bugseng.com Date: Mon Sep 9 13:44:17 2013 +0200
Convert C++ Variable id's to jlong before passing them to Java methods.
---
interfaces/Java/jni/ppl_java_common.cc | 5 +++-- interfaces/Java/jni/ppl_java_common_inlines.hh | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/interfaces/Java/jni/ppl_java_common.cc b/interfaces/Java/jni/ppl_java_common.cc index faea99b..c357cd6 100644 --- a/interfaces/Java/jni/ppl_java_common.cc +++ b/interfaces/Java/jni/ppl_java_common.cc @@ -413,7 +413,7 @@ jobject bool_to_j_boolean_class(JNIEnv* env, const bool value) { jobject ret = env->CallStaticObjectMethod(cached_classes.Boolean, cached_FMIDs.Boolean_valueOf_ID, - value); + static_cast<jboolean>(value)); CHECK_EXCEPTION_ASSERT(env); return ret; } @@ -1231,8 +1231,9 @@ Java_Variable_output_function(std::ostream& s, Variable v) { CHECK_RESULT_ASSERT(env, mID == dyn_mID); } #endif // #ifndef NDEBUG + jlong j_var_id = v.id(); jstring bi_string - = (jstring) env->CallObjectMethod(stringifier, mID, v.id()); + = (jstring) env->CallObjectMethod(stringifier, mID, j_var_id); CHECK_EXCEPTION_THROW(env); // Convert the string and print it on C++ stream. const char* nativeString = env->GetStringUTFChars(bi_string, 0); diff --git a/interfaces/Java/jni/ppl_java_common_inlines.hh b/interfaces/Java/jni/ppl_java_common_inlines.hh index 3f3c8f0..d23cd30 100644 --- a/interfaces/Java/jni/ppl_java_common_inlines.hh +++ b/interfaces/Java/jni/ppl_java_common_inlines.hh @@ -152,9 +152,10 @@ build_cxx_variable(JNIEnv* env, jobject j_var) {
inline jobject build_java_variable(JNIEnv* env, const Variable var) { + jlong j_var_id = var.id(); jobject ret = env->NewObject(cached_classes.Variable, cached_FMIDs.Variable_init_ID, - var.id()); + j_var_id); CHECK_RESULT_THROW(env, ret); return ret; }
participants (1)
-
Enea Zaffanella