Skip to content

Commit f273c63

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Kotlin: obvious explicit type (#52990)
Summary: Fixing some warnings from static code analysis regarding [obvious explicit type](https://www.jetbrains.com/help/inspectopedia/RedundantExplicitType.html#locating-this-inspection). ## Changelog: [INTERNAL] - Kotlin: obvious explicit type Pull Request resolved: #52990 Test Plan: ```sh yarn test-android yarn android ``` Reviewed By: cortinico Differential Revision: D79546014 Pulled By: rshest fbshipit-source-id: 1b66edde3185911b137e2c77673779cc613fae74
1 parent b708d2d commit f273c63

5 files changed

Lines changed: 17 additions & 18 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import com.facebook.react.bridge.WritableMap
1414
import com.facebook.react.bridge.WritableNativeMap
1515

1616
/** Responsible for dispatching events specific for hardware inputs. */
17-
internal class ReactAndroidHWInputDeviceHelper() {
17+
internal class ReactAndroidHWInputDeviceHelper {
1818
/**
1919
* We keep a reference to the last focused view id so that we can send it as a target for key
2020
* events and be able to send a blur event when focus changes.

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ internal class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNod
261261
}
262262

263263
private fun findRangeIndex(value: Double, ranges: DoubleArray): Int {
264-
var index: Int = 1
264+
var index = 1
265265
while (index < ranges.size - 1) {
266266
if (ranges[index] >= value) {
267267
break

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class TurboModuleManager(
6464

6565
eagerInitModuleNames = delegate?.getEagerInitModuleNames() ?: emptyList()
6666

67-
val nullProvider: ModuleProvider = ModuleProvider { _: String -> null }
67+
val nullProvider = ModuleProvider { _: String -> null }
6868

6969
turboModuleProvider =
7070
if (delegate == null) nullProvider

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactContentSizeChangedEvent.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import com.facebook.react.bridge.buildReadableMap
1313
import com.facebook.react.uimanager.events.Event
1414

1515
/** Event emitted by EditText native view when content size changes. */
16-
internal class ReactContentSizeChangedEvent
17-
constructor(
16+
internal class ReactContentSizeChangedEvent(
1817
surfaceId: Int,
1918
viewId: Int,
2019
private val contentWidth: Float,

packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class NativeAnimatedNodeTraversalTest {
213213

214214
@Test
215215
fun testNodeValueListenerIfNotListening() {
216-
val nodeId: Int = 1
216+
val nodeId = 1
217217

218218
createSimpleAnimatedViewWithOpacity()
219219
val frames: JavaOnlyArray = JavaOnlyArray.of(0.0, 0.2, 0.4, 0.6, 0.8, 1.0)
@@ -240,7 +240,7 @@ class NativeAnimatedNodeTraversalTest {
240240

241241
@Test
242242
fun testNodeValueListenerIfListening() {
243-
val nodeId: Int = 1
243+
val nodeId = 1
244244

245245
createSimpleAnimatedViewWithOpacity()
246246
val frames: JavaOnlyArray = JavaOnlyArray.of(0.0, 0.2, 0.4, 0.6, 0.8, 1.0)
@@ -402,10 +402,10 @@ class NativeAnimatedNodeTraversalTest {
402402
verify(uiManagerMock).synchronouslyUpdateViewOnUIThread(eq(1000), stylesCaptor.capture())
403403
assertThat(stylesCaptor.value.getDouble("opacity")).isEqualTo(0.0)
404404

405-
var previousValue: Double = 0.0
406-
var wasGreaterThanOne: Boolean = false
407-
var didComeToRest: Boolean = false
408-
var numberOfResets: Int = 0
405+
var previousValue = 0.0
406+
var wasGreaterThanOne = false
407+
var didComeToRest = false
408+
var numberOfResets = 0
409409
/* run 3 secs of animation, five times */
410410
for (i in 0 until 3 * 60 * 5) {
411411
reset(uiManagerMock)
@@ -512,8 +512,8 @@ class NativeAnimatedNodeTraversalTest {
512512
.synchronouslyUpdateViewOnUIThread(eq(1000), stylesCaptor.capture())
513513
var previousValue: Double = stylesCaptor.value.getDouble("opacity")
514514
val initialValue: Double = stylesCaptor.value.getDouble("opacity")
515-
var didComeToRest: Boolean = false
516-
var numberOfResets: Int = 0
515+
var didComeToRest = false
516+
var numberOfResets = 0
517517
/* run 3 secs of animation, five times */
518518
for (i in 0 until 3 * 60 * 5) {
519519
reset(uiManagerMock)
@@ -825,7 +825,7 @@ class NativeAnimatedNodeTraversalTest {
825825

826826
@Test
827827
fun testGetValue() {
828-
val tag: Int = 1
828+
val tag = 1
829829
nativeAnimatedNodesManager.createAnimatedNode(
830830
tag, JavaOnlyMap.of("type", "value", "value", 1.0, "offset", 0.0))
831831

@@ -986,7 +986,7 @@ class NativeAnimatedNodeTraversalTest {
986986
fun testRestoreDefaultProps() {
987987
val viewTag: Int = 1001
988988
// restoreDefaultProps not called in Fabric, make sure it's a non-Fabric tag
989-
val propsNodeTag: Int = 3
989+
val propsNodeTag = 3
990990
nativeAnimatedNodesManager.createAnimatedNode(
991991
1, JavaOnlyMap.of("type", "value", "value", 1.0, "offset", 0.0))
992992
nativeAnimatedNodesManager.createAnimatedNode(
@@ -1211,7 +1211,7 @@ class NativeAnimatedNodeTraversalTest {
12111211

12121212
// we run several steps of animation until the value starts bouncing, has negative speed and
12131213
// passes the final point (that is 1) while going backwards
1214-
var isBoucingBack: Boolean = false
1214+
var isBoucingBack = false
12151215
var previousValue: Double =
12161216
(nativeAnimatedNodesManager.getNodeById(3) as ValueAnimatedNode).getValue()
12171217
for (i in 500 downTo 0) {
@@ -1231,8 +1231,8 @@ class NativeAnimatedNodeTraversalTest {
12311231
// low friction we expect it to keep going in the opposite direction for a few more frames
12321232
nativeAnimatedNodesManager.setAnimatedNodeValue(1, 1.5)
12331233
nativeAnimatedNodesManager.runUpdates(nextFrameTime())
1234-
var bounceBackInitialFrames: Int = 0
1235-
var hasTurnedForward: Boolean = false
1234+
var bounceBackInitialFrames = 0
1235+
var hasTurnedForward = false
12361236

12371237
// we run 8 seconds of animation
12381238
for (i in 0 until 8 * 60) {

0 commit comments

Comments
 (0)