From 408af4e82093c041e8b0b6c98c96f9cb4fa5d59f Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Wed, 8 Nov 2023 11:39:44 -0800 Subject: [PATCH] fbjni | Fix lints exposed by clang-tidy Differential Revision: D51020426 fbshipit-source-id: 8a872650ed53f6716eed67299aa03b671074723e --- cxx/fbjni/detail/CoreClasses-inl.h | 12 ++++++------ cxx/fbjni/detail/References-inl.h | 20 ++++++-------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/cxx/fbjni/detail/CoreClasses-inl.h b/cxx/fbjni/detail/CoreClasses-inl.h index 0bde295..bf70fc4 100644 --- a/cxx/fbjni/detail/CoreClasses-inl.h +++ b/cxx/fbjni/detail/CoreClasses-inl.h @@ -171,14 +171,14 @@ inline void JClass::registerNatives( FACEBOOK_JNI_THROW_EXCEPTION_IF(result != JNI_OK); } -inline bool JClass::isAssignableFrom(alias_ref other) const noexcept { +inline bool JClass::isAssignableFrom(alias_ref cls) const noexcept { const auto env = Environment::current(); // Ths method has behavior compatible with the // java.lang.Class#isAssignableFrom method. The order of the // arguments to the JNI IsAssignableFrom C function is "opposite" // from what some might expect, which makes this code look a little // odd, but it is correct. - const auto result = env->IsAssignableFrom(other.get(), self()); + const auto result = env->IsAssignableFrom(cls.get(), self()); return result; } @@ -421,11 +421,11 @@ inline ElementProxy::ElementProxy::operator local_ref< } // namespace detail template -auto JArrayClass::newArray(size_t size) -> local_ref { +auto JArrayClass::newArray(size_t count) -> local_ref { static const auto elementClass = findClassStatic(jtype_traits::kBaseName.c_str()); const auto env = Environment::current(); - auto rawArray = env->NewObjectArray(size, elementClass.get(), nullptr); + auto rawArray = env->NewObjectArray(count, elementClass.get(), nullptr); FACEBOOK_JNI_THROW_EXCEPTION_IF(!rawArray); return adopt_local(static_cast(rawArray)); } @@ -447,8 +447,8 @@ inline local_ref JArrayClass::getElement(size_t idx) { template inline detail::ElementProxy> JArrayClass::operator[]( - size_t index) { - return detail::ElementProxy>(this, index); + size_t idx) { + return detail::ElementProxy>(this, idx); } template diff --git a/cxx/fbjni/detail/References-inl.h b/cxx/fbjni/detail/References-inl.h index 69f850e..b818223 100644 --- a/cxx/fbjni/detail/References-inl.h +++ b/cxx/fbjni/detail/References-inl.h @@ -316,14 +316,10 @@ inline weak_ref& weak_ref::operator=(const weak_ref& other) { } template -inline weak_ref& weak_ref::operator=(weak_ref&& other) noexcept { +inline weak_ref& weak_ref::operator=(weak_ref&& rhs) noexcept { internal::dbglog( - "Op= move ref=%p this=%p oref=%p other=%p", - get(), - this, - other.get(), - &other); - reset(other.release()); + "Op= move ref=%p this=%p oref=%p other=%p", get(), this, rhs.get(), &rhs); + reset(rhs.release()); return *this; } @@ -359,14 +355,10 @@ inline basic_strong_ref& basic_strong_ref::operator=( template inline basic_strong_ref& basic_strong_ref::operator=( - basic_strong_ref&& other) noexcept { + basic_strong_ref&& rhs) noexcept { internal::dbglog( - "Op= move ref=%p this=%p oref=%p other=%p", - get(), - this, - other.get(), - &other); - reset(other.release()); + "Op= move ref=%p this=%p oref=%p other=%p", get(), this, rhs.get(), &rhs); + reset(rhs.release()); return *this; }