Skip to content

Commit

Permalink
fbjni | Fix lints exposed by clang-tidy
Browse files Browse the repository at this point in the history
Differential Revision: D51020426

fbshipit-source-id: 8a872650ed53f6716eed67299aa03b671074723e
  • Loading branch information
nlutsenko authored and facebook-github-bot committed Nov 8, 2023
1 parent 12995ec commit 408af4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
12 changes: 6 additions & 6 deletions cxx/fbjni/detail/CoreClasses-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ inline void JClass::registerNatives(
FACEBOOK_JNI_THROW_EXCEPTION_IF(result != JNI_OK);
}

inline bool JClass::isAssignableFrom(alias_ref<JClass> other) const noexcept {
inline bool JClass::isAssignableFrom(alias_ref<JClass> 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;
}

Expand Down Expand Up @@ -421,11 +421,11 @@ inline ElementProxy<Target>::ElementProxy::operator local_ref<
} // namespace detail

template <typename T>
auto JArrayClass<T>::newArray(size_t size) -> local_ref<javaobject> {
auto JArrayClass<T>::newArray(size_t count) -> local_ref<javaobject> {
static const auto elementClass =
findClassStatic(jtype_traits<T>::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<javaobject>(rawArray));
}
Expand All @@ -447,8 +447,8 @@ inline local_ref<T> JArrayClass<T>::getElement(size_t idx) {

template <typename T>
inline detail::ElementProxy<JArrayClass<T>> JArrayClass<T>::operator[](
size_t index) {
return detail::ElementProxy<JArrayClass<T>>(this, index);
size_t idx) {
return detail::ElementProxy<JArrayClass<T>>(this, idx);
}

template <typename T>
Expand Down
20 changes: 6 additions & 14 deletions cxx/fbjni/detail/References-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,10 @@ inline weak_ref<T>& weak_ref<T>::operator=(const weak_ref& other) {
}

template <typename T>
inline weak_ref<T>& weak_ref<T>::operator=(weak_ref<T>&& other) noexcept {
inline weak_ref<T>& weak_ref<T>::operator=(weak_ref<T>&& 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;
}

Expand Down Expand Up @@ -359,14 +355,10 @@ inline basic_strong_ref<T, Alloc>& basic_strong_ref<T, Alloc>::operator=(

template <typename T, typename Alloc>
inline basic_strong_ref<T, Alloc>& basic_strong_ref<T, Alloc>::operator=(
basic_strong_ref<T, Alloc>&& other) noexcept {
basic_strong_ref<T, Alloc>&& 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;
}

Expand Down

0 comments on commit 408af4e

Please sign in to comment.