Daily arc lint --take KTFMT

Reviewed By: adamjernst

Differential Revision: D41833756

fbshipit-source-id: 0ecc95aff3bdadadb0769dec55d27fb84fe50e95
This commit is contained in:
generatedunixname89002005325672
2022-12-12 07:51:03 -08:00
committed by Facebook GitHub Bot
parent 41c17ddd56
commit 0f089ea2db
7 changed files with 35 additions and 13 deletions
@@ -21,7 +21,7 @@ package com.facebook.react.common.mapbuffer
* Limitations:
* - Keys are usually sized as 2 bytes, with each buffer supporting up to 65536 entries as a result.
* - O(log(N)) random key access for native buffers due to selected structure. Faster access can be
* achieved by retrieving [MapBuffer.Entry] with [entryAt] on known offsets.
* achieved by retrieving [MapBuffer.Entry] with [entryAt] on known offsets.
*/
interface MapBuffer : Iterable<MapBuffer.Entry> {
companion object {
@@ -46,12 +46,14 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Number of elements inserted into current MapBuffer.
*
* @return number of elements in the [MapBuffer]
*/
val count: Int
/**
* Checks whether entry for given key exists in MapBuffer.
*
* @param key key to lookup the entry
* @return whether entry for the given key exists in the MapBuffer.
*/
@@ -60,6 +62,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides offset of the key to use for [entryAt], for cases when offset is not statically known
* but can be cached.
*
* @param key key to lookup offset for
* @return offset for the given key to be used for entry access, -1 if key wasn't found.
*/
@@ -67,14 +70,16 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed access to a MapBuffer without additional lookups for provided offset.
*
* @param offset offset of entry in the MapBuffer structure. Can be looked up for known keys with
* [getKeyOffset].
* [getKeyOffset].
* @return parsed entry for structured access for given offset
*/
fun entryAt(offset: Int): MapBuffer.Entry
/**
* Provides parsed [DataType] annotation associated with the given key.
*
* @param key key to lookup type for
* @return data type of the given key.
* @throws IllegalArgumentException if the key doesn't exist
@@ -83,6 +88,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [Boolean] value if the entry for given key exists with [DataType.BOOL] type
*
* @param key key to lookup [Boolean] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -92,6 +98,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [Int] value if the entry for given key exists with [DataType.INT] type
*
* @param key key to lookup [Int] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -101,6 +108,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [Double] value if the entry for given key exists with [DataType.DOUBLE] type
*
* @param key key to lookup [Double] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -110,6 +118,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [String] value if the entry for given key exists with [DataType.STRING] type
*
* @param key key to lookup [String] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -119,6 +128,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [MapBuffer] value if the entry for given key exists with [DataType.MAP] type
*
* @param key key to lookup [MapBuffer] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -129,6 +139,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [List<MapBuffer>] value if the entry for given key exists with [DataType.MAP]
* type
*
* @param key key to lookup [List<MapBuffer>] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -149,30 +160,35 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Entry value represented as [Boolean]
*
* @throws IllegalStateException if the data type doesn't match [DataType.BOOL]
*/
val booleanValue: Boolean
/**
* Entry value represented as [Int]
*
* @throws IllegalStateException if the data type doesn't match [DataType.INT]
*/
val intValue: Int
/**
* Entry value represented as [Double]
*
* @throws IllegalStateException if the data type doesn't match [DataType.DOUBLE]
*/
val doubleValue: Double
/**
* Entry value represented as [String]
*
* @throws IllegalStateException if the data type doesn't match [DataType.STRING]
*/
val stringValue: String
/**
* Entry value represented as [MapBuffer]
*
* @throws IllegalStateException if the data type doesn't match [DataType.MAP]
*/
val mapBufferValue: MapBuffer
@@ -66,7 +66,7 @@ class ReadableMapBuffer : MapBuffer {
/**
* @param key Key to search for
* @return the "bucket index" for a key or -1 if not found. It uses a binary search algorithm
* (log(n))
* (log(n))
*/
private fun getBucketIndexForKey(intKey: Int): Int {
if (intKey !in KEY_RANGE) {
@@ -30,6 +30,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a boolean value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -38,6 +39,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds an int value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -46,6 +48,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a double value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -54,6 +57,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a string value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -62,6 +66,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a [MapBuffer] value for given key to the current MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -20,7 +20,7 @@ import com.facebook.react.ReactRootView
*
* @param fabricEnabled Whether Fabric should be enabled for the RootView of this Activity.
* @param concurrentRootEnabled Whether ConcurrentRoot (aka React 18) should be enabled for the
* RootView of this Activity.
* RootView of this Activity.
*/
open class DefaultReactActivityDelegate(
activity: ReactActivity,
@@ -89,7 +89,7 @@ abstract class ReactExtension @Inject constructor(project: Project) {
* will:
* - Not be bundled (the bundle file will not be created and won't be copied over).
* - Have the Hermes Debug flags set. That's useful if you have another variant (say `canary`)
* where you want dev mode to be enabled. Default: ['debug']
* where you want dev mode to be enabled. Default: ['debug']
*/
val debuggableVariants: ListProperty<String> =
objects.listProperty(String::class.java).convention(listOf("debug"))
@@ -11,10 +11,11 @@ import java.io.Serializable
/**
* This data class represents an entry that can be consumed by the [PreparePrefabHeadersTask].
*
* @param libraryName The name of the library that you're preparing for Prefab
* @param pathToPrefixCouples A list of pairs Path to Header prefix. You can use this list to supply
* a list of paths that you want to be considered for prefab. Each path can specify an header prefix
* that will be used by prefab to re-created the header layout.
* a list of paths that you want to be considered for prefab. Each path can specify an header
* prefix that will be used by prefab to re-created the header layout.
*/
data class PrefabPreprocessingEntry(
val libraryName: String,
@@ -43,10 +43,10 @@ internal fun detectedCliFile(config: ReactExtension): File =
* Computes the `hermesc` command location. The Algo follows this order:
* 1. The path provided by the `hermesCommand` config in the `react` Gradle extension
* 2. The file located in `node_modules/react-native/sdks/hermes/build/bin/hermesc`. This will be
* used if the user is building Hermes from source.
* used if the user is building Hermes from source.
* 3. The file located in `node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc` where `%OS-BIN%`
* is substituted with the correct OS arch. This will be used if the user is using a precompiled
* hermes-engine package.
* is substituted with the correct OS arch. This will be used if the user is using a precompiled
* hermes-engine package.
* 4. Fails otherwise
*/
internal fun detectedHermesCommand(config: ReactExtension): String =
@@ -106,10 +106,10 @@ private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): F
* Computes the `hermesc` command location. The Algo follows this order:
* 1. The path provided by the `hermesCommand` config in the `react` Gradle extension
* 2. The file located in `node_modules/react-native/sdks/hermes/build/bin/hermesc`. This will be
* used if the user is building Hermes from source.
* used if the user is building Hermes from source.
* 3. The file located in `node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc` where `%OS-BIN%`
* is substituted with the correct OS arch. This will be used if the user is using a precompiled
* hermes-engine package.
* is substituted with the correct OS arch. This will be used if the user is using a precompiled
* hermes-engine package.
* 4. Fails otherwise
*/
internal fun detectOSAwareHermesCommand(projectRoot: File, hermesCommand: String): String {