Skip to content

Commit 9bd72e7

Browse files
mdvaccameta-codesync[bot]
authored andcommitted
Fix FieldsBelowInit in ReadableMapBuffer.kt (#55405)
Summary: Pull Request resolved: #55405 Moved offsetForDynamicData property declaration above init block to ensure proper initialization order per Kotlin best practices. changelog: [internal] internal Reviewed By: javache Differential Revision: D91819522 fbshipit-source-id: 69261eab9d4977a790f7c90b823344e82e1d948f
1 parent 0b20c26 commit 9bd72e7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ private constructor(
3939
override var count: Int = 0
4040
private set
4141

42+
// returns the relative offset of the first byte of dynamic data
43+
private val offsetForDynamicData: Int
44+
get() = getKeyOffsetForBucketIndex(count)
45+
4246
init {
4347
readHeader()
4448
}
@@ -56,10 +60,6 @@ private constructor(
5660
count = readUnsignedShort(buffer.position()).toInt()
5761
}
5862

59-
// returns the relative offset of the first byte of dynamic data
60-
private val offsetForDynamicData: Int
61-
get() = getKeyOffsetForBucketIndex(count)
62-
6363
/**
6464
* @param intKey Key to search for
6565
* @return the "bucket index" for a key or -1 if not found. It uses a binary search algorithm

0 commit comments

Comments
 (0)