Skip to content

Commit

Permalink
Removing superflous includes for javatests directory.
Browse files Browse the repository at this point in the history
These were causing numerous unused include warnings but also can cause some difficulties getting the topology of build includes right which actually does matter for generating release headers, and, in particular matters for the proxy definitions.

This CL should not have any effect (no tests are change).

PiperOrigin-RevId: 654824989
  • Loading branch information
jwhpryor authored and copybara-github committed Jul 22, 2024
1 parent 41c7b68 commit 89f1760
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 5 deletions.
2 changes: 2 additions & 0 deletions javatests/com/jnibind/test/array_test_field_rank_1_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

#include <array>
#include <cstring>
#include <limits>
#include <memory>
#include <string>

#include "array_test_helpers_native.h"
#include "object_test_helper_jni.h"
Expand Down
1 change: 0 additions & 1 deletion javatests/com/jnibind/test/array_test_field_rank_2_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

#include <array>
#include <cstring>
#include <limits>
#include <memory>
Expand Down
2 changes: 2 additions & 0 deletions javatests/com/jnibind/test/array_test_method_rank_1_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

#include <cstddef>
#include <memory>
#include <utility>

#include "array_test_helpers_native.h"
#include "object_test_helper_jni.h"
Expand Down
2 changes: 2 additions & 0 deletions javatests/com/jnibind/test/array_test_method_rank_2_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <limits>
#include <memory>
#include <utility>

#include "array_test_helpers_native.h"
#include "modulo.h"
Expand Down
1 change: 0 additions & 1 deletion javatests/com/jnibind/test/class_loader_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <memory>

#include "object_test_helper_jni.h"
#include "jni_bind.h"

using ::jni::Class;
Expand Down
6 changes: 5 additions & 1 deletion javatests/com/jnibind/test/field_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <memory>

#include "object_test_helper_jni.h"
#include "jni_bind.h"

using ::jni::Class;
Expand Down Expand Up @@ -49,6 +48,7 @@ extern "C" {

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* pjvm, void* reserved) {
jvm.reset(new jni::JvmRef<jni::kDefaultJvm>(pjvm));

return JNI_VERSION_1_6;
}

Expand All @@ -61,27 +61,31 @@ JNIEXPORT jint JNICALL Java_com_jnibind_test_FieldTest_jniIntField(
JNIEnv* env, jclass, jobject object, jint val) {
LocalObject<kFieldTestHelper> rjni_test_helper{object};
rjni_test_helper["intField"].Set(jint{val});

return rjni_test_helper["intField"].Get();
}

JNIEXPORT jfloat JNICALL Java_com_jnibind_test_FieldTest_jniFloatField(
JNIEnv* env, jclass, jobject object, jfloat val) {
LocalObject<kFieldTestHelper> rjni_test_helper{object};
rjni_test_helper["floatField"].Set(jfloat{val});

return rjni_test_helper["floatField"].Get();
}

JNIEXPORT jdouble JNICALL Java_com_jnibind_test_FieldTest_jniDoubleField(
JNIEnv* env, jclass, jobject object, jdouble val) {
LocalObject<kFieldTestHelper> rjni_test_helper{object};
rjni_test_helper["doubleField"].Set(jdouble{val});

return rjni_test_helper["doubleField"].Get();
}

JNIEXPORT jstring JNICALL Java_com_jnibind_test_FieldTest_jniStringField(
JNIEnv* env, jclass, jobject object, jstring val) {
LocalObject<kFieldTestHelper> rjni_test_helper{object};
rjni_test_helper["stringField"].Set(val);

return rjni_test_helper["stringField"].Get().Release();
}

Expand Down
3 changes: 3 additions & 0 deletions javatests/com/jnibind/test/global_object_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <memory>
#include <utility>

#include "object_test_helper_jni.h"
#include "jni_bind.h"
Expand Down Expand Up @@ -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<kObjectTestHelperClass> helper_obj{object_to_mutate};

return jni::LocalObject<kGlobalObjectTestClass>{test_helper_object}(
"methodTakesGlobalObjectReturnsNewObject", helper_obj)
.Release();
Expand All @@ -64,6 +66,7 @@ JNIEXPORT jobject JNICALL
Java_com_jnibind_test_GlobalObjectTest_jniManipulateNewGlobalObjectSetIntVal238(
JNIEnv* env, jclass, jobject jtest_obj) {
jni::GlobalObject<kObjectTestHelperClass> helper_obj{2, 3, 8};

return jni::LocalObject<kGlobalObjectTestClass>{jtest_obj}(
"methodTakesGlobalObjectReturnsNewObject", std::move(helper_obj))
.Release();
Expand Down
4 changes: 4 additions & 0 deletions javatests/com/jnibind/test/local_object_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <memory>
#include <utility>

#include "object_test_helper_jni.h"
#include "jni_bind.h"
Expand Down Expand Up @@ -49,6 +50,7 @@ JNIEXPORT jobject JNICALL
Java_com_jnibind_test_LocalObjectTest_jniCreateNewLocalObjectFromObject(
JNIEnv* env, jclass, jobject object) {
jni::LocalObject<kObjectClass> java_object{object};

return jni::LocalObject<kObjectTestHelperClass>{java_object}.Release();
}

Expand All @@ -62,6 +64,7 @@ JNIEXPORT jobject JNICALL
Java_com_jnibind_test_LocalObjectTest_jniBuildNewObjectsFromExistingObjects(
JNIEnv* env, jclass, jobject jtest_obj, jobject jhelper_obj) {
jni::LocalObject<kObjectTestHelperClass> helper_obj{jhelper_obj};

return jni::LocalObject<kLocalObjectTestClass>{jtest_obj}(
"methodTakesLocalObjectReturnsNewObject", helper_obj)
.Release();
Expand All @@ -71,6 +74,7 @@ JNIEXPORT jobject JNICALL
Java_com_jnibind_test_LocalObjectTest_jniManipulateNewLocalObjectSetIntVal238(
JNIEnv* env, jclass, jobject jtest_obj) {
jni::LocalObject<kObjectTestHelperClass> helper_obj{2, 3, 8};

return jni::LocalObject<kLocalObjectTestClass>{jtest_obj}(
"methodTakesLocalObjectReturnsNewObject", std::move(helper_obj))
.Release();
Expand Down
18 changes: 17 additions & 1 deletion javatests/com/jnibind/test/method_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <memory>

#include "object_test_helper_jni.h"
#include "jni_bind.h"

using ::jni::Class;
Expand Down Expand Up @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("booleanMethod");
}

Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("booleanMethodTakesFiveBooleans", jboolean{i1},
jboolean{i2}, jboolean{i3}, jboolean{i4}, jboolean{i5});
}
Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("intMethod");
}

JNIEXPORT jint JNICALL Java_com_jnibind_test_MethodTest_jniIntMethodTakesOneInt(
JNIEnv* env, jclass, jobject object, jint i) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("intMethodTakesOneInt", jint{i});
}

Expand All @@ -160,6 +163,7 @@ Java_com_jnibind_test_MethodTest_jniIntMethodTakesFiveInts(JNIEnv* env, jclass,
jint i3, jint i4,
jint i5) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("intMethodTakesFiveInts", jint{i1}, jint{i2}, jint{i3},
jint{i4}, jint{i5});
}
Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("longMethod");
}

Expand All @@ -176,6 +181,7 @@ Java_com_jnibind_test_MethodTest_jniLongMethodTakesOneLong(JNIEnv* env, jclass,
jobject object,
jlong i) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("longMethodTakesOneLong", jlong{i});
}

Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("longMethodTakesFiveLongs", jlong{i1}, jlong{i2},
jlong{i3}, jlong{i4}, jlong{i5});
}
Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("floatMethod");
}

Expand All @@ -201,6 +209,7 @@ Java_com_jnibind_test_MethodTest_jniFloatMethodTakesOneFloat(JNIEnv* env,
jobject object,
jfloat i) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("floatMethodTakesOneFloat", jfloat{i});
}

Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("floatMethodTakesFiveFloats", jfloat{i1}, jfloat{i2},
jfloat{i3}, jfloat{i4}, jfloat{i5});
}
Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("doubleMethod");
}

Expand All @@ -226,6 +237,7 @@ Java_com_jnibind_test_MethodTest_jniDoubleMethodTakesOneDouble(JNIEnv* env,
jobject object,
jdouble i) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("doubleMethodTakesOneDouble", jdouble{i});
}

Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("doubleMethodTakesFiveDoubles", jdouble{i1}, jdouble{i2},
jdouble{i3}, jdouble{i4}, jdouble{i5});
}
Expand All @@ -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<kMethodTestHelper> gtest_helper{object};

return gtest_helper("foo");
}

JNIEXPORT int JNICALL Java_com_jnibind_test_MethodTest_jniCallFooOverload2(
JNIEnv* env, jclass, jobject object) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("foo", 123.f);
}

JNIEXPORT int JNICALL Java_com_jnibind_test_MethodTest_jniCallFooOverload3(
JNIEnv* env, jclass, jobject object) {
LocalObject<kMethodTestHelper> gtest_helper{object};

return gtest_helper("foo", 123.f, 456.f);
}

Expand Down
3 changes: 2 additions & 1 deletion javatests/com/jnibind/test/string_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/

#include <memory>
#include <string>
#include <string_view>

#include "object_test_helper_jni.h"
#include "jni_bind.h"

using ::jni::Class;
Expand Down
1 change: 1 addition & 0 deletions javatests/com/jnibind/test/thread_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <memory>
#include <thread> // NOLINT
#include <utility>

#include "array_test_helpers_native.h"
#include "object_test_helper_jni.h"
Expand Down

0 comments on commit 89f1760

Please sign in to comment.