diff --git a/javatests/com/jnibind/test/array_test_field_rank_1_jni.cc b/javatests/com/jnibind/test/array_test_field_rank_1_jni.cc index 5d68bef1..21abf4c9 100644 --- a/javatests/com/jnibind/test/array_test_field_rank_1_jni.cc +++ b/javatests/com/jnibind/test/array_test_field_rank_1_jni.cc @@ -16,7 +16,9 @@ #include #include +#include #include +#include #include "array_test_helpers_native.h" #include "object_test_helper_jni.h" diff --git a/javatests/com/jnibind/test/array_test_field_rank_2_jni.cc b/javatests/com/jnibind/test/array_test_field_rank_2_jni.cc index 58e6de2a..a645e6ef 100644 --- a/javatests/com/jnibind/test/array_test_field_rank_2_jni.cc +++ b/javatests/com/jnibind/test/array_test_field_rank_2_jni.cc @@ -14,7 +14,6 @@ * limitations under the License. */ -#include #include #include #include diff --git a/javatests/com/jnibind/test/array_test_method_rank_1_jni.cc b/javatests/com/jnibind/test/array_test_method_rank_1_jni.cc index 52596003..42d85212 100644 --- a/javatests/com/jnibind/test/array_test_method_rank_1_jni.cc +++ b/javatests/com/jnibind/test/array_test_method_rank_1_jni.cc @@ -14,7 +14,9 @@ * limitations under the License. */ +#include #include +#include #include "array_test_helpers_native.h" #include "object_test_helper_jni.h" diff --git a/javatests/com/jnibind/test/array_test_method_rank_2_jni.cc b/javatests/com/jnibind/test/array_test_method_rank_2_jni.cc index aac9599b..6de4baa4 100644 --- a/javatests/com/jnibind/test/array_test_method_rank_2_jni.cc +++ b/javatests/com/jnibind/test/array_test_method_rank_2_jni.cc @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include +#include #include "array_test_helpers_native.h" #include "modulo.h" diff --git a/javatests/com/jnibind/test/class_loader_test_jni.cc b/javatests/com/jnibind/test/class_loader_test_jni.cc index fc19e722..dec8f263 100644 --- a/javatests/com/jnibind/test/class_loader_test_jni.cc +++ b/javatests/com/jnibind/test/class_loader_test_jni.cc @@ -16,7 +16,6 @@ #include -#include "object_test_helper_jni.h" #include "jni_bind.h" using ::jni::Class; diff --git a/javatests/com/jnibind/test/field_test_jni.cc b/javatests/com/jnibind/test/field_test_jni.cc index 3f4d2960..349daa14 100644 --- a/javatests/com/jnibind/test/field_test_jni.cc +++ b/javatests/com/jnibind/test/field_test_jni.cc @@ -16,7 +16,6 @@ #include -#include "object_test_helper_jni.h" #include "jni_bind.h" using ::jni::Class; @@ -49,6 +48,7 @@ extern "C" { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* pjvm, void* reserved) { jvm.reset(new jni::JvmRef(pjvm)); + return JNI_VERSION_1_6; } @@ -61,6 +61,7 @@ JNIEXPORT jint JNICALL Java_com_jnibind_test_FieldTest_jniIntField( JNIEnv* env, jclass, jobject object, jint val) { LocalObject rjni_test_helper{object}; rjni_test_helper["intField"].Set(jint{val}); + return rjni_test_helper["intField"].Get(); } @@ -68,6 +69,7 @@ JNIEXPORT jfloat JNICALL Java_com_jnibind_test_FieldTest_jniFloatField( JNIEnv* env, jclass, jobject object, jfloat val) { LocalObject rjni_test_helper{object}; rjni_test_helper["floatField"].Set(jfloat{val}); + return rjni_test_helper["floatField"].Get(); } @@ -75,6 +77,7 @@ JNIEXPORT jdouble JNICALL Java_com_jnibind_test_FieldTest_jniDoubleField( JNIEnv* env, jclass, jobject object, jdouble val) { LocalObject rjni_test_helper{object}; rjni_test_helper["doubleField"].Set(jdouble{val}); + return rjni_test_helper["doubleField"].Get(); } @@ -82,6 +85,7 @@ JNIEXPORT jstring JNICALL Java_com_jnibind_test_FieldTest_jniStringField( JNIEnv* env, jclass, jobject object, jstring val) { LocalObject rjni_test_helper{object}; rjni_test_helper["stringField"].Set(val); + return rjni_test_helper["stringField"].Get().Release(); } diff --git a/javatests/com/jnibind/test/global_object_test_jni.cc b/javatests/com/jnibind/test/global_object_test_jni.cc index 5d196500..0ea0862c 100644 --- a/javatests/com/jnibind/test/global_object_test_jni.cc +++ b/javatests/com/jnibind/test/global_object_test_jni.cc @@ -15,6 +15,7 @@ */ #include +#include #include "object_test_helper_jni.h" #include "jni_bind.h" @@ -55,6 +56,7 @@ JNIEXPORT jobject JNICALL Java_com_jnibind_test_GlobalObjectTest_jniBuildNewObjectsFromExistingObjects( JNIEnv* env, jclass, jobject test_helper_object, jobject object_to_mutate) { jni::LocalObject helper_obj{object_to_mutate}; + return jni::LocalObject{test_helper_object}( "methodTakesGlobalObjectReturnsNewObject", helper_obj) .Release(); @@ -64,6 +66,7 @@ JNIEXPORT jobject JNICALL Java_com_jnibind_test_GlobalObjectTest_jniManipulateNewGlobalObjectSetIntVal238( JNIEnv* env, jclass, jobject jtest_obj) { jni::GlobalObject helper_obj{2, 3, 8}; + return jni::LocalObject{jtest_obj}( "methodTakesGlobalObjectReturnsNewObject", std::move(helper_obj)) .Release(); diff --git a/javatests/com/jnibind/test/local_object_test_jni.cc b/javatests/com/jnibind/test/local_object_test_jni.cc index 4a45db68..f2cf225e 100644 --- a/javatests/com/jnibind/test/local_object_test_jni.cc +++ b/javatests/com/jnibind/test/local_object_test_jni.cc @@ -15,6 +15,7 @@ */ #include +#include #include "object_test_helper_jni.h" #include "jni_bind.h" @@ -49,6 +50,7 @@ JNIEXPORT jobject JNICALL Java_com_jnibind_test_LocalObjectTest_jniCreateNewLocalObjectFromObject( JNIEnv* env, jclass, jobject object) { jni::LocalObject java_object{object}; + return jni::LocalObject{java_object}.Release(); } @@ -62,6 +64,7 @@ JNIEXPORT jobject JNICALL Java_com_jnibind_test_LocalObjectTest_jniBuildNewObjectsFromExistingObjects( JNIEnv* env, jclass, jobject jtest_obj, jobject jhelper_obj) { jni::LocalObject helper_obj{jhelper_obj}; + return jni::LocalObject{jtest_obj}( "methodTakesLocalObjectReturnsNewObject", helper_obj) .Release(); @@ -71,6 +74,7 @@ JNIEXPORT jobject JNICALL Java_com_jnibind_test_LocalObjectTest_jniManipulateNewLocalObjectSetIntVal238( JNIEnv* env, jclass, jobject jtest_obj) { jni::LocalObject helper_obj{2, 3, 8}; + return jni::LocalObject{jtest_obj}( "methodTakesLocalObjectReturnsNewObject", std::move(helper_obj)) .Release(); diff --git a/javatests/com/jnibind/test/method_test_jni.cc b/javatests/com/jnibind/test/method_test_jni.cc index 62c1ddaf..f298c5b3 100644 --- a/javatests/com/jnibind/test/method_test_jni.cc +++ b/javatests/com/jnibind/test/method_test_jni.cc @@ -16,7 +16,6 @@ #include -#include "object_test_helper_jni.h" #include "jni_bind.h" using ::jni::Class; @@ -119,6 +118,7 @@ Java_com_jnibind_test_MethodTest_jniVoidMethodTakesFiveInts(JNIEnv* env, jclass, JNIEXPORT jboolean JNICALL Java_com_jnibind_test_MethodTest_jniBooleanMethod( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("booleanMethod"); } @@ -136,6 +136,7 @@ Java_com_jnibind_test_MethodTest_jniBooleanMethodTakesFiveBooleans( JNIEnv* env, jclass, jobject object, jboolean i1, jboolean i2, jboolean i3, jboolean i4, jboolean i5) { LocalObject gtest_helper{object}; + return gtest_helper("booleanMethodTakesFiveBooleans", jboolean{i1}, jboolean{i2}, jboolean{i3}, jboolean{i4}, jboolean{i5}); } @@ -144,12 +145,14 @@ Java_com_jnibind_test_MethodTest_jniBooleanMethodTakesFiveBooleans( JNIEXPORT jint JNICALL Java_com_jnibind_test_MethodTest_jniIntMethod( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("intMethod"); } JNIEXPORT jint JNICALL Java_com_jnibind_test_MethodTest_jniIntMethodTakesOneInt( JNIEnv* env, jclass, jobject object, jint i) { LocalObject gtest_helper{object}; + return gtest_helper("intMethodTakesOneInt", jint{i}); } @@ -160,6 +163,7 @@ Java_com_jnibind_test_MethodTest_jniIntMethodTakesFiveInts(JNIEnv* env, jclass, jint i3, jint i4, jint i5) { LocalObject gtest_helper{object}; + return gtest_helper("intMethodTakesFiveInts", jint{i1}, jint{i2}, jint{i3}, jint{i4}, jint{i5}); } @@ -168,6 +172,7 @@ Java_com_jnibind_test_MethodTest_jniIntMethodTakesFiveInts(JNIEnv* env, jclass, JNIEXPORT jlong JNICALL Java_com_jnibind_test_MethodTest_jniLongMethod( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("longMethod"); } @@ -176,6 +181,7 @@ Java_com_jnibind_test_MethodTest_jniLongMethodTakesOneLong(JNIEnv* env, jclass, jobject object, jlong i) { LocalObject gtest_helper{object}; + return gtest_helper("longMethodTakesOneLong", jlong{i}); } @@ -184,6 +190,7 @@ Java_com_jnibind_test_MethodTest_jniLongMethodTakesFiveLongs( JNIEnv* env, jclass, jobject object, jlong i1, jlong i2, jlong i3, jlong i4, jlong i5) { LocalObject gtest_helper{object}; + return gtest_helper("longMethodTakesFiveLongs", jlong{i1}, jlong{i2}, jlong{i3}, jlong{i4}, jlong{i5}); } @@ -192,6 +199,7 @@ Java_com_jnibind_test_MethodTest_jniLongMethodTakesFiveLongs( JNIEXPORT jfloat JNICALL Java_com_jnibind_test_MethodTest_jniFloatMethod( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("floatMethod"); } @@ -201,6 +209,7 @@ Java_com_jnibind_test_MethodTest_jniFloatMethodTakesOneFloat(JNIEnv* env, jobject object, jfloat i) { LocalObject gtest_helper{object}; + return gtest_helper("floatMethodTakesOneFloat", jfloat{i}); } @@ -209,6 +218,7 @@ Java_com_jnibind_test_MethodTest_jniFloatMethodTakesFiveFloats( JNIEnv* env, jclass, jobject object, jfloat i1, jfloat i2, jfloat i3, jfloat i4, jfloat i5) { LocalObject gtest_helper{object}; + return gtest_helper("floatMethodTakesFiveFloats", jfloat{i1}, jfloat{i2}, jfloat{i3}, jfloat{i4}, jfloat{i5}); } @@ -217,6 +227,7 @@ Java_com_jnibind_test_MethodTest_jniFloatMethodTakesFiveFloats( JNIEXPORT jdouble JNICALL Java_com_jnibind_test_MethodTest_jniDoubleMethod( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("doubleMethod"); } @@ -226,6 +237,7 @@ Java_com_jnibind_test_MethodTest_jniDoubleMethodTakesOneDouble(JNIEnv* env, jobject object, jdouble i) { LocalObject gtest_helper{object}; + return gtest_helper("doubleMethodTakesOneDouble", jdouble{i}); } @@ -234,6 +246,7 @@ Java_com_jnibind_test_MethodTest_jniDoubleMethodTakesFiveDoubles( JNIEnv* env, jclass, jobject object, jdouble i1, jdouble i2, jdouble i3, jdouble i4, jdouble i5) { LocalObject gtest_helper{object}; + return gtest_helper("doubleMethodTakesFiveDoubles", jdouble{i1}, jdouble{i2}, jdouble{i3}, jdouble{i4}, jdouble{i5}); } @@ -242,18 +255,21 @@ Java_com_jnibind_test_MethodTest_jniDoubleMethodTakesFiveDoubles( JNIEXPORT int JNICALL Java_com_jnibind_test_MethodTest_jniCallFooOverload1( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("foo"); } JNIEXPORT int JNICALL Java_com_jnibind_test_MethodTest_jniCallFooOverload2( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("foo", 123.f); } JNIEXPORT int JNICALL Java_com_jnibind_test_MethodTest_jniCallFooOverload3( JNIEnv* env, jclass, jobject object) { LocalObject gtest_helper{object}; + return gtest_helper("foo", 123.f, 456.f); } diff --git a/javatests/com/jnibind/test/string_test_jni.cc b/javatests/com/jnibind/test/string_test_jni.cc index 1556b527..bba00225 100644 --- a/javatests/com/jnibind/test/string_test_jni.cc +++ b/javatests/com/jnibind/test/string_test_jni.cc @@ -15,8 +15,9 @@ */ #include +#include +#include -#include "object_test_helper_jni.h" #include "jni_bind.h" using ::jni::Class; diff --git a/javatests/com/jnibind/test/thread_test_jni.cc b/javatests/com/jnibind/test/thread_test_jni.cc index 46807c29..4ea7d098 100644 --- a/javatests/com/jnibind/test/thread_test_jni.cc +++ b/javatests/com/jnibind/test/thread_test_jni.cc @@ -16,6 +16,7 @@ #include #include // NOLINT +#include #include "array_test_helpers_native.h" #include "object_test_helper_jni.h"