Skip to content

Commit 408af4e

Browse files
nlutsenkofacebook-github-bot
authored andcommitted
fbjni | Fix lints exposed by clang-tidy
Differential Revision: D51020426 fbshipit-source-id: 8a872650ed53f6716eed67299aa03b671074723e
1 parent 12995ec commit 408af4e

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

cxx/fbjni/detail/CoreClasses-inl.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ inline void JClass::registerNatives(
171171
FACEBOOK_JNI_THROW_EXCEPTION_IF(result != JNI_OK);
172172
}
173173

174-
inline bool JClass::isAssignableFrom(alias_ref<JClass> other) const noexcept {
174+
inline bool JClass::isAssignableFrom(alias_ref<JClass> cls) const noexcept {
175175
const auto env = Environment::current();
176176
// Ths method has behavior compatible with the
177177
// java.lang.Class#isAssignableFrom method. The order of the
178178
// arguments to the JNI IsAssignableFrom C function is "opposite"
179179
// from what some might expect, which makes this code look a little
180180
// odd, but it is correct.
181-
const auto result = env->IsAssignableFrom(other.get(), self());
181+
const auto result = env->IsAssignableFrom(cls.get(), self());
182182
return result;
183183
}
184184

@@ -421,11 +421,11 @@ inline ElementProxy<Target>::ElementProxy::operator local_ref<
421421
} // namespace detail
422422

423423
template <typename T>
424-
auto JArrayClass<T>::newArray(size_t size) -> local_ref<javaobject> {
424+
auto JArrayClass<T>::newArray(size_t count) -> local_ref<javaobject> {
425425
static const auto elementClass =
426426
findClassStatic(jtype_traits<T>::kBaseName.c_str());
427427
const auto env = Environment::current();
428-
auto rawArray = env->NewObjectArray(size, elementClass.get(), nullptr);
428+
auto rawArray = env->NewObjectArray(count, elementClass.get(), nullptr);
429429
FACEBOOK_JNI_THROW_EXCEPTION_IF(!rawArray);
430430
return adopt_local(static_cast<javaobject>(rawArray));
431431
}
@@ -447,8 +447,8 @@ inline local_ref<T> JArrayClass<T>::getElement(size_t idx) {
447447

448448
template <typename T>
449449
inline detail::ElementProxy<JArrayClass<T>> JArrayClass<T>::operator[](
450-
size_t index) {
451-
return detail::ElementProxy<JArrayClass<T>>(this, index);
450+
size_t idx) {
451+
return detail::ElementProxy<JArrayClass<T>>(this, idx);
452452
}
453453

454454
template <typename T>

cxx/fbjni/detail/References-inl.h

+6-14
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,10 @@ inline weak_ref<T>& weak_ref<T>::operator=(const weak_ref& other) {
316316
}
317317

318318
template <typename T>
319-
inline weak_ref<T>& weak_ref<T>::operator=(weak_ref<T>&& other) noexcept {
319+
inline weak_ref<T>& weak_ref<T>::operator=(weak_ref<T>&& rhs) noexcept {
320320
internal::dbglog(
321-
"Op= move ref=%p this=%p oref=%p other=%p",
322-
get(),
323-
this,
324-
other.get(),
325-
&other);
326-
reset(other.release());
321+
"Op= move ref=%p this=%p oref=%p other=%p", get(), this, rhs.get(), &rhs);
322+
reset(rhs.release());
327323
return *this;
328324
}
329325

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

360356
template <typename T, typename Alloc>
361357
inline basic_strong_ref<T, Alloc>& basic_strong_ref<T, Alloc>::operator=(
362-
basic_strong_ref<T, Alloc>&& other) noexcept {
358+
basic_strong_ref<T, Alloc>&& rhs) noexcept {
363359
internal::dbglog(
364-
"Op= move ref=%p this=%p oref=%p other=%p",
365-
get(),
366-
this,
367-
other.get(),
368-
&other);
369-
reset(other.release());
360+
"Op= move ref=%p this=%p oref=%p other=%p", get(), this, rhs.get(), &rhs);
361+
reset(rhs.release());
370362
return *this;
371363
}
372364

0 commit comments

Comments
 (0)