Skip to content

Commit

Permalink
Fix compile warnings with jni_utils.hpp (#16336)
Browse files Browse the repository at this point in the history
This fixes the compiler warnings with `jni_utils.hpp`, removing some `const` qualifiers that are redundant.

Closes #16335.

Authors:
  - Nghia Truong (https://github.com/ttnghia)

Approvers:
  - Jason Lowe (https://github.com/jlowe)

URL: #16336
  • Loading branch information
ttnghia authored Jul 23, 2024
1 parent e6d412c commit ff30c02
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions java/src/main/native/include/jni_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class native_jArray {
return data()[index];
}

const N_TYPE* const data() const
N_TYPE const* data() const
{
init_data_ptr();
return data_ptr;
Expand All @@ -296,17 +296,15 @@ class native_jArray {
return data_ptr;
}

const N_TYPE* const begin() const { return data(); }
N_TYPE const* begin() const { return data(); }

N_TYPE* begin() { return data(); }

const N_TYPE* const end() const { return data() + size(); }
N_TYPE const* end() const { return data() + size(); }

N_TYPE* end() { return data() + size(); }

const J_ARRAY_TYPE get_jArray() const { return orig; }

J_ARRAY_TYPE get_jArray() { return orig; }
J_ARRAY_TYPE get_jArray() const { return orig; }

/**
* @brief Conversion to std::vector
Expand Down Expand Up @@ -430,9 +428,7 @@ class native_jpointerArray {
T* const* begin() const { return data(); }
T* const* end() const { return data() + size(); }

const jlongArray get_jArray() const { return wrapped.get_jArray(); }

jlongArray get_jArray() { return wrapped.get_jArray(); }
jlongArray get_jArray() const { return wrapped.get_jArray(); }

void assert_no_nulls() const
{
Expand Down Expand Up @@ -624,7 +620,7 @@ class native_jstring {
return true;
}

const jstring get_jstring() const { return orig; }
jstring get_jstring() const { return orig; }

~native_jstring()
{
Expand Down Expand Up @@ -753,13 +749,13 @@ class native_jstringArray {
return cache[index];
}

char const** const as_c_array() const
char const** as_c_array() const
{
init_c_cache();
return c_cache.data();
}

const std::vector<std::string> as_cpp_vector() const
std::vector<std::string> as_cpp_vector() const
{
init_cpp_cache();
return cpp_cache;
Expand Down

0 comments on commit ff30c02

Please sign in to comment.