diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index be111f4d502..97e4971a17c 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,8 @@ +## 25.3.1 + +* [kotlin] Fixes Kotlin InstanceManager not properly removing callbacks from handler. +* [kotlin] Fixes `SyntheticAccessor` lint caused by private utility methods. + ## 25.3.0 * [swift] Adds equality methods to generated data classes. diff --git a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt index 3bc2680f888..c9aee7c4299 100644 --- a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt +++ b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt @@ -12,33 +12,32 @@ import io.flutter.plugin.common.StandardMethodCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun deepEqualsEventChannelMessages(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelMessages(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelMessages(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && - deepEqualsEventChannelMessages(it.value, b[it.key]) - } +private object EventChannelMessagesPigeonUtils { + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b } - return a == b } /** @@ -68,7 +67,7 @@ data class IntEvent(val data: Long) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelMessages(toList(), other.toList()) + return EventChannelMessagesPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -96,7 +95,7 @@ data class StringEvent(val data: String) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelMessages(toList(), other.toList()) + return EventChannelMessagesPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() diff --git a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt index 82a8666b6ba..589faae8be2 100644 --- a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt +++ b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt @@ -13,24 +13,53 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} +private object MessagesPigeonUtils { -private fun wrapError(exception: Throwable): List { - return if (exception is FlutterError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + fun createConnectionError(channelName: String): FlutterError { + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } } -} -private fun createConnectionError(channelName: String): FlutterError { - return FlutterError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } } /** @@ -46,34 +75,6 @@ class FlutterError( val details: Any? = null ) : Throwable() -private fun deepEqualsMessages(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsMessages(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsMessages(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && deepEqualsMessages(it.value, b[it.key]) - } - } - return a == b -} - enum class Code(val raw: Int) { ONE(0), TWO(1); @@ -118,7 +119,7 @@ data class MessageData( if (this === other) { return true } - return deepEqualsMessages(toList(), other.toList()) + return MessagesPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -184,7 +185,7 @@ interface ExampleHostApi { try { listOf(api.getHostLanguage()) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -207,7 +208,7 @@ interface ExampleHostApi { try { listOf(api.add(aArg, bArg)) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -228,10 +229,10 @@ interface ExampleHostApi { api.sendMessage(messageArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(MessagesPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(MessagesPigeonUtils.wrapResult(data)) } } } @@ -274,7 +275,7 @@ class MessageFlutterApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/pigeon/lib/src/generator_tools.dart b/packages/pigeon/lib/src/generator_tools.dart index f2350155461..529d9a712d1 100644 --- a/packages/pigeon/lib/src/generator_tools.dart +++ b/packages/pigeon/lib/src/generator_tools.dart @@ -15,7 +15,7 @@ import 'generator.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '25.3.0'; +const String pigeonVersion = '25.3.1'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart index c539afad5cf..bd2719d92d4 100644 --- a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart +++ b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart @@ -28,7 +28,7 @@ const DocumentCommentSpecification _docCommentSpec = blockContinuationToken: _docCommentContinuation, ); -String _codecName = 'PigeonCodec'; +const String _codecName = 'PigeonCodec'; /// Name of field used for host API codec. const String _pigeonMethodChannelCodec = 'PigeonMethodCodec'; @@ -317,7 +317,7 @@ class KotlinGenerator extends StructuredGenerator { indent.writeln('return true'); }); indent.write( - 'return deepEquals${generatorOptions.fileSpecificClassNameComponent}(toList(), other.toList())'); + 'return ${_getUtilsClassName(generatorOptions)}.deepEquals(toList(), other.toList())'); }); indent.newln(); @@ -655,6 +655,7 @@ if (wrapped == null) { dartPackageName: dartPackageName, onWriteBody: ( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -665,6 +666,7 @@ if (wrapped == null) { ); _writeFlutterMethodMessageCall( indent, + generatorOptions: generatorOptions, parameters: parameters, returnType: returnType, channelName: '$channelName\$separatedMessageChannelSuffix', @@ -741,6 +743,7 @@ if (wrapped == null) { for (final Method method in api.methods) { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: method.name, channelName: '${makeChannelName(api, method, dartPackageName)}\$separatedMessageChannelSuffix', @@ -823,6 +826,7 @@ if (wrapped == null) { const String setHandlerCondition = 'instanceManager != null'; _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: 'removeStrongReference', channelName: makeRemoveStrongReferenceChannelName(dartPackageName), @@ -847,6 +851,7 @@ if (wrapped == null) { ); _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: 'clear', channelName: makeClearChannelName(dartPackageName), taskQueueType: TaskQueueType.serial, @@ -1188,7 +1193,7 @@ if (wrapped == null) { void _writeWrapResult(Indent indent) { indent.newln(); - indent.write('private fun wrapResult(result: Any?): List '); + indent.write('fun wrapResult(result: Any?): List '); indent.addScoped('{', '}', () { indent.writeln('return listOf(result)'); }); @@ -1196,7 +1201,7 @@ if (wrapped == null) { void _writeWrapError(InternalKotlinOptions generatorOptions, Indent indent) { indent.newln(); - indent.write('private fun wrapError(exception: Throwable): List '); + indent.write('fun wrapError(exception: Throwable): List '); indent.addScoped('{', '}', () { indent.write( 'return if (exception is ${_getErrorClassName(generatorOptions)}) '); @@ -1242,7 +1247,7 @@ if (wrapped == null) { final String errorClassName = _getErrorClassName(generatorOptions); indent.newln(); indent.write( - 'private fun createConnectionError(channelName: String): $errorClassName '); + 'fun createConnectionError(channelName: String): $errorClassName '); indent.addScoped('{', '}', () { indent.write( 'return $errorClassName("channel-error", "Unable to establish connection on channel: \'\$channelName\'.", "")'); @@ -1251,7 +1256,7 @@ if (wrapped == null) { void _writeDeepEquals(InternalKotlinOptions generatorOptions, Indent indent) { indent.format(''' -private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any?, b: Any?): Boolean { +fun deepEquals(a: Any?, b: Any?): Boolean { if (a is ByteArray && b is ByteArray) { return a.contentEquals(b) } @@ -1266,16 +1271,16 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? } if (a is Array<*> && b is Array<*>) { return a.size == b.size && - a.indices.all{ deepEquals${generatorOptions.fileSpecificClassNameComponent}(a[it], b[it]) } + a.indices.all{ deepEquals(a[it], b[it]) } } if (a is List<*> && b is List<*>) { return a.size == b.size && - a.indices.all{ deepEquals${generatorOptions.fileSpecificClassNameComponent}(a[it], b[it]) } + a.indices.all{ deepEquals(a[it], b[it]) } } if (a is Map<*, *> && b is Map<*, *>) { return a.size == b.size && a.all { (b as Map).containsKey(it.key) && - deepEquals${generatorOptions.fileSpecificClassNameComponent}(it.value, b[it.key]) + deepEquals(it.value, b[it.key]) } } return a == b @@ -1290,19 +1295,26 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? Indent indent, { required String dartPackageName, }) { - if (root.containsHostApi || root.containsProxyApi) { - _writeWrapResult(indent); - _writeWrapError(generatorOptions, indent); - } - if (root.containsFlutterApi || root.containsProxyApi) { - _writeCreateConnectionError(generatorOptions, indent); - } + indent.writeScoped( + 'private object ${_getUtilsClassName(generatorOptions)} {', + '}', + () { + if (root.containsFlutterApi || root.containsProxyApi) { + _writeCreateConnectionError(generatorOptions, indent); + } + if (root.containsHostApi || root.containsProxyApi) { + _writeWrapResult(indent); + _writeWrapError(generatorOptions, indent); + } + if (root.classes.isNotEmpty) { + _writeDeepEquals(generatorOptions, indent); + } + }, + ); + if (generatorOptions.includeErrorClass) { _writeErrorClass(generatorOptions, indent); } - if (root.classes.isNotEmpty) { - _writeDeepEquals(generatorOptions, indent); - } } static void _writeMethodDeclaration( @@ -1367,6 +1379,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? void _writeHostMethodMessageHandler( Indent indent, { + required InternalKotlinOptions generatorOptions, required String name, required String channelName, required TaskQueueType taskQueueType, @@ -1419,14 +1432,17 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.addScoped('{ result: Result<$resultType> ->', '}', () { indent.writeln('val error = result.exceptionOrNull()'); indent.writeScoped('if (error != null) {', '}', () { - indent.writeln('reply.reply(wrapError(error))'); + indent.writeln( + 'reply.reply(${_getUtilsClassName(generatorOptions)}.wrapError(error))'); }, addTrailingNewline: false); indent.addScoped(' else {', '}', () { if (returnType.isVoid) { - indent.writeln('reply.reply(wrapResult(null))'); + indent.writeln( + 'reply.reply(${_getUtilsClassName(generatorOptions)}.wrapResult(null))'); } else { indent.writeln('val data = result.getOrNull()'); - indent.writeln('reply.reply(wrapResult(data))'); + indent.writeln( + 'reply.reply(${_getUtilsClassName(generatorOptions)}.wrapResult(data))'); } }); }); @@ -1441,7 +1457,8 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? }, addTrailingNewline: false); indent.add(' catch (exception: Throwable) '); indent.addScoped('{', '}', () { - indent.writeln('wrapError(exception)'); + indent.writeln( + '${_getUtilsClassName(generatorOptions)}.wrapError(exception)'); }); indent.writeln('reply.reply(wrapped)'); } @@ -1465,6 +1482,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? int? minApiRequirement, void Function( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -1486,6 +1504,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.addScoped('{', '}', () { onWriteBody( indent, + generatorOptions: generatorOptions, parameters: parameters, returnType: returnType, channelName: channelName, @@ -1496,6 +1515,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? static void _writeFlutterMethodMessageCall( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -1542,7 +1562,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? }, addTrailingNewline: false); indent.addScoped('else {', '} ', () { indent.writeln( - 'callback(Result.failure(createConnectionError(channelName)))'); + 'callback(Result.failure(${_getUtilsClassName(generatorOptions)}.createConnectionError(channelName)))'); }); }); } @@ -1839,7 +1859,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? ) if (api != null) { channel.setMessageHandler { _, reply -> - reply.reply(wrapError(UnsupportedOperationException( + reply.reply(${_getUtilsClassName(generatorOptions)}.wrapError(UnsupportedOperationException( "Call references class `$className`, which requires api version $apiRequirement." ))) } @@ -1872,6 +1892,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? onWrite: () { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: name, channelName: channelName, taskQueueType: TaskQueueType.serial, @@ -1916,6 +1937,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? onWrite: () { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: field.name, channelName: channelName, taskQueueType: TaskQueueType.serial, @@ -1961,6 +1983,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? onWrite: () { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: method.name, channelName: makeChannelName(api, method, dartPackageName), taskQueueType: method.taskQueueType, @@ -2026,6 +2049,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? ], onWriteBody: ( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -2069,6 +2093,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.writeln('val codec = pigeonRegistrar.codec'); _writeFlutterMethodMessageCall( indent, + generatorOptions: generatorOptions, returnType: returnType, channelName: channelName, errorClassName: errorClassName, @@ -2136,6 +2161,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? ], onWriteBody: ( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -2159,6 +2185,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.writeln('val codec = pigeonRegistrar.codec'); _writeFlutterMethodMessageCall( indent, + generatorOptions: generatorOptions, returnType: returnType, channelName: channelName, errorClassName: errorClassName, @@ -2214,6 +2241,14 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? String _getErrorClassName(InternalKotlinOptions generatorOptions) => generatorOptions.errorClassName ?? 'FlutterError'; +/// Calculates the name of the private utils class that will be generated for +/// the file. +String _getUtilsClassName(InternalKotlinOptions options) { + return toUpperCamelCase( + '${options.fileSpecificClassNameComponent ?? ''}PigeonUtils', + ); +} + String _getArgumentName(int count, NamedType argument) => argument.name.isEmpty ? 'arg$count' : argument.name; diff --git a/packages/pigeon/lib/src/kotlin/templates.dart b/packages/pigeon/lib/src/kotlin/templates.dart index af9f4b357ea..652a0f683af 100644 --- a/packages/pigeon/lib/src/kotlin/templates.dart +++ b/packages/pigeon/lib/src/kotlin/templates.dart @@ -48,6 +48,9 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene private val referenceQueue = java.lang.ref.ReferenceQueue() private val weakReferencesToIdentifiers = HashMap, Long>() private val handler = android.os.Handler(android.os.Looper.getMainLooper()) + private val releaseAllFinalizedInstancesRunnable = Runnable { + this.releaseAllFinalizedInstances() + } private var nextIdentifier: Long = minHostCreatedIdentifier private var hasFinalizationListenerStopped = false @@ -57,16 +60,13 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene */ var clearFinalizedWeakReferencesInterval: Long = 3000 set(value) { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) field = value releaseAllFinalizedInstances() } init { - handler.postDelayed( - { releaseAllFinalizedInstances() }, - clearFinalizedWeakReferencesInterval - ) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } companion object { @@ -136,7 +136,9 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene /** * Adds a new unique instance that was instantiated from the host platform. * - * [identifier] must be >= 0 and unique. + * If the manager contains [instance], this returns the corresponding identifier. If the + * manager does not contain [instance], this adds the instance and returns a unique + * identifier for that [instance]. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() @@ -167,7 +169,7 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene * longer be called and methods will log a warning. */ fun stopFinalizationListener() { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) hasFinalizationListenerStopped = true } @@ -206,10 +208,7 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene finalizationListener.onFinalize(identifier) } } - handler.postDelayed( - { releaseAllFinalizedInstances() }, - clearFinalizedWeakReferencesInterval - ) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } private fun addInstance(instance: Any, identifier: Long) { diff --git a/packages/pigeon/platform_tests/test_plugin/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/android/build.gradle index 2789471f520..69b532200de 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/android/build.gradle @@ -65,7 +65,7 @@ android { } dependencies { - testImplementation 'junit:junit:4.+' + testImplementation 'junit:junit:4.13.2' testImplementation "io.mockk:mockk:1.13.16" // org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions. // See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7 diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index a4da07d66a6..59187acc592 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -16,24 +16,53 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} +private object CoreTestsPigeonUtils { -private fun wrapError(exception: Throwable): List { - return if (exception is FlutterError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + fun createConnectionError(channelName: String): FlutterError { + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } } -} -private fun createConnectionError(channelName: String): FlutterError { - return FlutterError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } } /** @@ -49,34 +78,6 @@ class FlutterError( val details: Any? = null ) : Throwable() -private fun deepEqualsCoreTests(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsCoreTests(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsCoreTests(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && deepEqualsCoreTests(it.value, b[it.key]) - } - } - return a == b -} - enum class AnEnum(val raw: Int) { ONE(0), TWO(1), @@ -123,7 +124,7 @@ data class UnusedClass(val aField: Any? = null) { if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -266,7 +267,7 @@ data class AllTypes( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -421,7 +422,7 @@ data class AllNullableTypes( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -565,7 +566,7 @@ data class AllNullableTypesWithoutRecursion( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -628,7 +629,7 @@ data class AllClassesWrapper( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -660,7 +661,7 @@ data class TestMessage(val testList: List? = null) { if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -1236,7 +1237,7 @@ interface HostIntegrationCoreApi { api.noop() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1258,7 +1259,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAllTypes(everythingArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1278,7 +1279,7 @@ interface HostIntegrationCoreApi { try { listOf(api.throwError()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1299,7 +1300,7 @@ interface HostIntegrationCoreApi { api.throwErrorFromVoid() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1319,7 +1320,7 @@ interface HostIntegrationCoreApi { try { listOf(api.throwFlutterError()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1341,7 +1342,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoInt(anIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1363,7 +1364,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoDouble(aDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1385,7 +1386,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoBool(aBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1407,7 +1408,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoString(aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1429,7 +1430,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoUint8List(aUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1451,7 +1452,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoObject(anObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1473,7 +1474,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoList(listArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1495,7 +1496,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1517,7 +1518,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1539,7 +1540,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1561,7 +1562,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1583,7 +1584,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoMap(mapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1605,7 +1606,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1627,7 +1628,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1649,7 +1650,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1671,7 +1672,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1693,7 +1694,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1715,7 +1716,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1737,7 +1738,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1759,7 +1760,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1781,7 +1782,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoClassWrapper(wrapperArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1803,7 +1804,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoEnum(anEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1825,7 +1826,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAnotherEnum(anotherEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1847,7 +1848,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNamedDefaultString(aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1869,7 +1870,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoOptionalDefaultDouble(aDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1891,7 +1892,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoRequiredInt(anIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1913,7 +1914,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAllNullableTypes(everythingArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1935,7 +1936,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAllNullableTypesWithoutRecursion(everythingArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1957,7 +1958,7 @@ interface HostIntegrationCoreApi { try { listOf(api.extractNestedNullableString(wrapperArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1979,7 +1980,7 @@ interface HostIntegrationCoreApi { try { listOf(api.createNestedNullableString(nullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2005,7 +2006,7 @@ interface HostIntegrationCoreApi { api.sendMultipleNullableTypes( aNullableBoolArg, aNullableIntArg, aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2031,7 +2032,7 @@ interface HostIntegrationCoreApi { api.sendMultipleNullableTypesWithoutRecursion( aNullableBoolArg, aNullableIntArg, aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2053,7 +2054,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableInt(aNullableIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2075,7 +2076,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableDouble(aNullableDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2097,7 +2098,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableBool(aNullableBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2119,7 +2120,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableString(aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2141,7 +2142,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableUint8List(aNullableUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2163,7 +2164,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableObject(aNullableObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2185,7 +2186,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableList(aNullableListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2207,7 +2208,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2229,7 +2230,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2251,7 +2252,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2273,7 +2274,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2295,7 +2296,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableMap(mapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2317,7 +2318,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2339,7 +2340,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2361,7 +2362,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2383,7 +2384,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2405,7 +2406,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2427,7 +2428,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2449,7 +2450,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2471,7 +2472,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2493,7 +2494,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableEnum(anEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2515,7 +2516,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAnotherNullableEnum(anotherEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2537,7 +2538,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoOptionalNullableInt(aNullableIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2559,7 +2560,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNamedNullableString(aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2578,9 +2579,9 @@ interface HostIntegrationCoreApi { api.noopAsync { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -2601,10 +2602,10 @@ interface HostIntegrationCoreApi { api.echoAsyncInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2625,10 +2626,10 @@ interface HostIntegrationCoreApi { api.echoAsyncDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2649,10 +2650,10 @@ interface HostIntegrationCoreApi { api.echoAsyncBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2673,10 +2674,10 @@ interface HostIntegrationCoreApi { api.echoAsyncString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2697,10 +2698,10 @@ interface HostIntegrationCoreApi { api.echoAsyncUint8List(aUint8ListArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2721,10 +2722,10 @@ interface HostIntegrationCoreApi { api.echoAsyncObject(anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2745,10 +2746,10 @@ interface HostIntegrationCoreApi { api.echoAsyncList(listArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2769,10 +2770,10 @@ interface HostIntegrationCoreApi { api.echoAsyncEnumList(enumListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2793,10 +2794,10 @@ interface HostIntegrationCoreApi { api.echoAsyncClassList(classListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2817,10 +2818,10 @@ interface HostIntegrationCoreApi { api.echoAsyncMap(mapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2841,10 +2842,10 @@ interface HostIntegrationCoreApi { api.echoAsyncStringMap(stringMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2865,10 +2866,10 @@ interface HostIntegrationCoreApi { api.echoAsyncIntMap(intMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2889,10 +2890,10 @@ interface HostIntegrationCoreApi { api.echoAsyncEnumMap(enumMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2913,10 +2914,10 @@ interface HostIntegrationCoreApi { api.echoAsyncClassMap(classMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2937,10 +2938,10 @@ interface HostIntegrationCoreApi { api.echoAsyncEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2961,10 +2962,10 @@ interface HostIntegrationCoreApi { api.echoAnotherAsyncEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2983,10 +2984,10 @@ interface HostIntegrationCoreApi { api.throwAsyncError { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3005,9 +3006,9 @@ interface HostIntegrationCoreApi { api.throwAsyncErrorFromVoid { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -3026,10 +3027,10 @@ interface HostIntegrationCoreApi { api.throwAsyncFlutterError { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3050,10 +3051,10 @@ interface HostIntegrationCoreApi { api.echoAsyncAllTypes(everythingArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3075,10 +3076,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3100,10 +3101,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3124,10 +3125,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3148,10 +3149,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3172,10 +3173,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3196,10 +3197,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3220,10 +3221,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableUint8List(aUint8ListArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3244,10 +3245,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableObject(anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3268,10 +3269,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableList(listArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3292,10 +3293,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableEnumList(enumListArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3317,10 +3318,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3341,10 +3342,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableMap(mapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3365,10 +3366,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableStringMap(stringMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3389,10 +3390,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableIntMap(intMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3413,10 +3414,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableEnumMap(enumMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3438,10 +3439,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3462,10 +3463,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3486,10 +3487,10 @@ interface HostIntegrationCoreApi { api.echoAnotherAsyncNullableEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3509,7 +3510,7 @@ interface HostIntegrationCoreApi { try { listOf(api.defaultIsMainThread()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -3530,7 +3531,7 @@ interface HostIntegrationCoreApi { try { listOf(api.taskQueueIsBackgroundThread()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -3549,9 +3550,9 @@ interface HostIntegrationCoreApi { api.callFlutterNoop { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -3570,10 +3571,10 @@ interface HostIntegrationCoreApi { api.callFlutterThrowError { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3592,9 +3593,9 @@ interface HostIntegrationCoreApi { api.callFlutterThrowErrorFromVoid { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -3615,10 +3616,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoAllTypes(everythingArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3640,10 +3641,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3668,10 +3669,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3693,10 +3694,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3721,10 +3722,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3745,10 +3746,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3769,10 +3770,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3793,10 +3794,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3817,10 +3818,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3841,10 +3842,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoUint8List(listArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3865,10 +3866,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoList(listArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3889,10 +3890,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoEnumList(enumListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3913,10 +3914,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoClassList(classListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3937,10 +3938,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNonNullEnumList(enumListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3962,10 +3963,10 @@ interface HostIntegrationCoreApi { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3986,10 +3987,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoMap(mapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4010,10 +4011,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoStringMap(stringMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4034,10 +4035,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoIntMap(intMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4058,10 +4059,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoEnumMap(enumMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4083,10 +4084,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4108,10 +4109,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4132,10 +4133,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNonNullIntMap(intMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4156,10 +4157,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNonNullEnumMap(enumMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4181,10 +4182,10 @@ interface HostIntegrationCoreApi { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4205,10 +4206,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4229,10 +4230,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoAnotherEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4253,10 +4254,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4277,10 +4278,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4301,10 +4302,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4325,10 +4326,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4349,10 +4350,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableUint8List(listArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4373,10 +4374,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableList(listArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4397,10 +4398,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableEnumList(enumListArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4422,10 +4423,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4447,10 +4448,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4472,10 +4473,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4496,10 +4497,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableMap(mapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4521,10 +4522,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4545,10 +4546,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableIntMap(intMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4570,10 +4571,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4595,10 +4596,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4620,10 +4621,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4645,10 +4646,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4670,10 +4671,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4695,10 +4696,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4719,10 +4720,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4743,10 +4744,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoAnotherNullableEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4767,10 +4768,10 @@ interface HostIntegrationCoreApi { api.callFlutterSmallApiEchoString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4810,7 +4811,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4830,7 +4831,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4849,7 +4850,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4876,7 +4877,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4899,7 +4900,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4935,7 +4936,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4958,7 +4959,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4994,7 +4995,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5021,7 +5022,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5048,7 +5049,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5075,7 +5076,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5102,7 +5103,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5129,7 +5130,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5156,7 +5157,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5183,7 +5184,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5213,7 +5214,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5240,7 +5241,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5270,7 +5271,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5297,7 +5298,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5327,7 +5328,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5354,7 +5355,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5384,7 +5385,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5414,7 +5415,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5444,7 +5445,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5471,7 +5472,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5501,7 +5502,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5531,7 +5532,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5558,7 +5559,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5585,7 +5586,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5605,7 +5606,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5625,7 +5626,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5645,7 +5646,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5665,7 +5666,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5685,7 +5686,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5705,7 +5706,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5728,7 +5729,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5751,7 +5752,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5774,7 +5775,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5797,7 +5798,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5817,7 +5818,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5840,7 +5841,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5863,7 +5864,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5886,7 +5887,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5909,7 +5910,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5932,7 +5933,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5955,7 +5956,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5978,7 +5979,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6001,7 +6002,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6021,7 +6022,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6044,7 +6045,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6066,7 +6067,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6093,7 +6094,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6131,7 +6132,7 @@ interface HostTrivialApi { api.noop() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -6177,10 +6178,10 @@ interface HostSmallApi { api.echo(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -6199,9 +6200,9 @@ interface HostSmallApi { api.voidVoid { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -6248,7 +6249,7 @@ class FlutterSmallApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6275,7 +6276,7 @@ class FlutterSmallApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt index 63f971e424a..dc0745c2896 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt @@ -15,6 +15,34 @@ import io.flutter.plugin.common.StandardMethodCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer +private object EventChannelTestsPigeonUtils { + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } +} + /** * Error class for passing custom error details to Flutter via a thrown PlatformException. * @@ -28,35 +56,6 @@ class EventChannelTestsError( val details: Any? = null ) : Throwable() -private fun deepEqualsEventChannelTests(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelTests(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelTests(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && - deepEqualsEventChannelTests(it.value, b[it.key]) - } - } - return a == b -} - enum class EventEnum(val raw: Int) { ONE(0), TWO(1), @@ -230,7 +229,7 @@ data class EventAllNullableTypes( if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -263,7 +262,7 @@ data class IntEvent(val value: Long) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -291,7 +290,7 @@ data class StringEvent(val value: String) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -319,7 +318,7 @@ data class BoolEvent(val value: Boolean) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -347,7 +346,7 @@ data class DoubleEvent(val value: Double) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -375,7 +374,7 @@ data class ObjectsEvent(val value: Any) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -403,7 +402,7 @@ data class EnumEvent(val value: EventEnum) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -431,7 +430,7 @@ data class ClassEvent(val value: EventAllNullableTypes) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt index 88c43a433ea..3b1933827d6 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt @@ -16,24 +16,27 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} +private object ProxyApiTestsPigeonUtils { -private fun wrapError(exception: Throwable): List { - return if (exception is ProxyApiTestsError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + fun createConnectionError(channelName: String): ProxyApiTestsError { + return ProxyApiTestsError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") } -} -private fun createConnectionError(channelName: String): ProxyApiTestsError { - return ProxyApiTestsError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is ProxyApiTestsError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } + } } /** @@ -78,6 +81,9 @@ class ProxyApiTestsPigeonInstanceManager( private val referenceQueue = java.lang.ref.ReferenceQueue() private val weakReferencesToIdentifiers = HashMap, Long>() private val handler = android.os.Handler(android.os.Looper.getMainLooper()) + private val releaseAllFinalizedInstancesRunnable = Runnable { + this.releaseAllFinalizedInstances() + } private var nextIdentifier: Long = minHostCreatedIdentifier private var hasFinalizationListenerStopped = false @@ -87,13 +93,13 @@ class ProxyApiTestsPigeonInstanceManager( */ var clearFinalizedWeakReferencesInterval: Long = 3000 set(value) { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) field = value releaseAllFinalizedInstances() } init { - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } companion object { @@ -162,7 +168,9 @@ class ProxyApiTestsPigeonInstanceManager( /** * Adds a new unique instance that was instantiated from the host platform. * - * [identifier] must be >= 0 and unique. + * If the manager contains [instance], this returns the corresponding identifier. If the manager + * does not contain [instance], this adds the instance and returns a unique identifier for that + * [instance]. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() @@ -195,7 +203,7 @@ class ProxyApiTestsPigeonInstanceManager( * longer be called and methods will log a warning. */ fun stopFinalizationListener() { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) hasFinalizationListenerStopped = true } @@ -235,7 +243,7 @@ class ProxyApiTestsPigeonInstanceManager( finalizationListener.onFinalize(identifier) } } - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } private fun addInstance(instance: Any, identifier: Long) { @@ -288,7 +296,7 @@ private class ProxyApiTestsPigeonInstanceManagerApi(val binaryMessenger: BinaryM instanceManager.remove(identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -309,7 +317,7 @@ private class ProxyApiTestsPigeonInstanceManagerApi(val binaryMessenger: BinaryM instanceManager.clear() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -334,7 +342,7 @@ private class ProxyApiTestsPigeonInstanceManagerApi(val binaryMessenger: BinaryM callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -1086,7 +1094,7 @@ abstract class PigeonApiProxyApiTestClass( pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1147,7 +1155,7 @@ abstract class PigeonApiProxyApiTestClass( pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1172,7 +1180,7 @@ abstract class PigeonApiProxyApiTestClass( api.attachedField(pigeon_instanceArg), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1196,7 +1204,7 @@ abstract class PigeonApiProxyApiTestClass( api.staticAttachedField(), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1219,7 +1227,7 @@ abstract class PigeonApiProxyApiTestClass( api.noop(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1241,7 +1249,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.throwError(pigeon_instanceArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1264,7 +1272,7 @@ abstract class PigeonApiProxyApiTestClass( api.throwErrorFromVoid(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1286,7 +1294,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.throwFlutterError(pigeon_instanceArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1309,7 +1317,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoInt(pigeon_instanceArg, anIntArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1332,7 +1340,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoDouble(pigeon_instanceArg, aDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1355,7 +1363,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoBool(pigeon_instanceArg, aBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1378,7 +1386,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoString(pigeon_instanceArg, aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1401,7 +1409,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoUint8List(pigeon_instanceArg, aUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1424,7 +1432,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoObject(pigeon_instanceArg, anObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1447,7 +1455,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoList(pigeon_instanceArg, aListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1470,7 +1478,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoProxyApiList(pigeon_instanceArg, aListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1493,7 +1501,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoMap(pigeon_instanceArg, aMapArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1516,7 +1524,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoProxyApiMap(pigeon_instanceArg, aMapArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1539,7 +1547,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoEnum(pigeon_instanceArg, anEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1562,7 +1570,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoProxyApi(pigeon_instanceArg, aProxyApiArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1585,7 +1593,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableInt(pigeon_instanceArg, aNullableIntArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1608,7 +1616,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableDouble(pigeon_instanceArg, aNullableDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1631,7 +1639,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableBool(pigeon_instanceArg, aNullableBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1654,7 +1662,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableString(pigeon_instanceArg, aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1677,7 +1685,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableUint8List(pigeon_instanceArg, aNullableUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1700,7 +1708,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableObject(pigeon_instanceArg, aNullableObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1723,7 +1731,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableList(pigeon_instanceArg, aNullableListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1746,7 +1754,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableMap(pigeon_instanceArg, aNullableMapArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1769,7 +1777,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableEnum(pigeon_instanceArg, aNullableEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1792,7 +1800,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableProxyApi(pigeon_instanceArg, aNullableProxyApiArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1813,9 +1821,9 @@ abstract class PigeonApiProxyApiTestClass( api.noopAsync(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -1837,10 +1845,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1862,10 +1870,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncDouble(pigeon_instanceArg, aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1887,10 +1895,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncBool(pigeon_instanceArg, aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1912,10 +1920,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncString(pigeon_instanceArg, aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1937,10 +1945,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncUint8List(pigeon_instanceArg, aUint8ListArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1962,10 +1970,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncObject(pigeon_instanceArg, anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1987,10 +1995,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncList(pigeon_instanceArg, aListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2012,10 +2020,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncMap(pigeon_instanceArg, aMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2037,10 +2045,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncEnum(pigeon_instanceArg, anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2061,10 +2069,10 @@ abstract class PigeonApiProxyApiTestClass( api.throwAsyncError(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2085,9 +2093,9 @@ abstract class PigeonApiProxyApiTestClass( api.throwAsyncErrorFromVoid(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2108,10 +2116,10 @@ abstract class PigeonApiProxyApiTestClass( api.throwAsyncFlutterError(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2133,10 +2141,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2158,10 +2166,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableDouble(pigeon_instanceArg, aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2183,10 +2191,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableBool(pigeon_instanceArg, aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2208,10 +2216,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableString(pigeon_instanceArg, aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2234,10 +2242,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2259,10 +2267,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableObject(pigeon_instanceArg, anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2284,10 +2292,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableList(pigeon_instanceArg, aListArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2310,10 +2318,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2336,10 +2344,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2360,7 +2368,7 @@ abstract class PigeonApiProxyApiTestClass( api.staticNoop() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2382,7 +2390,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoStaticString(aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2401,9 +2409,9 @@ abstract class PigeonApiProxyApiTestClass( api.staticAsyncNoop { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2424,9 +2432,9 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterNoop(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2447,10 +2455,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterThrowError(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2471,9 +2479,9 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterThrowErrorFromVoid(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2495,10 +2503,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoBool(pigeon_instanceArg, aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2520,10 +2528,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2545,10 +2553,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoDouble(pigeon_instanceArg, aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2570,10 +2578,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoString(pigeon_instanceArg, aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2596,10 +2604,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2621,10 +2629,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoList(pigeon_instanceArg, aListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2647,10 +2655,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2673,10 +2681,10 @@ abstract class PigeonApiProxyApiTestClass( -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2699,10 +2707,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2725,10 +2733,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2751,10 +2759,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2777,10 +2785,10 @@ abstract class PigeonApiProxyApiTestClass( -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2802,10 +2810,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoNullableInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2828,10 +2836,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2854,10 +2862,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2880,10 +2888,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2906,10 +2914,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2932,10 +2940,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2958,10 +2966,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2984,10 +2992,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -3008,9 +3016,9 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterNoopAsync(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -3033,10 +3041,10 @@ abstract class PigeonApiProxyApiTestClass( -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -3088,7 +3096,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3117,7 +3125,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3148,7 +3156,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3188,7 +3196,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3227,7 +3235,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3267,7 +3275,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3307,7 +3315,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3347,7 +3355,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3387,7 +3395,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3427,7 +3435,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3466,7 +3474,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3506,7 +3514,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3546,7 +3554,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3586,7 +3594,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3619,7 +3627,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3652,7 +3660,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3685,7 +3693,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3718,7 +3726,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3751,7 +3759,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3784,7 +3792,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3817,7 +3825,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3850,7 +3858,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3883,7 +3891,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3914,7 +3922,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3954,7 +3962,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4000,7 +4008,7 @@ abstract class PigeonApiProxyApiSuperClass( api.pigeon_defaultConstructor(), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4023,7 +4031,7 @@ abstract class PigeonApiProxyApiSuperClass( api.aSuperMethod(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4064,7 +4072,7 @@ abstract class PigeonApiProxyApiSuperClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4102,7 +4110,7 @@ open class PigeonApiProxyApiInterface( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4130,7 +4138,7 @@ open class PigeonApiProxyApiInterface( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4170,7 +4178,7 @@ abstract class PigeonApiClassWithApiRequirement( api.pigeon_defaultConstructor(), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4187,7 +4195,7 @@ abstract class PigeonApiClassWithApiRequirement( if (api != null) { channel.setMessageHandler { _, reply -> reply.reply( - wrapError( + ProxyApiTestsPigeonUtils.wrapError( UnsupportedOperationException( "Call references class `ClassWithApiRequirement`, which requires api version 25."))) } @@ -4211,7 +4219,7 @@ abstract class PigeonApiClassWithApiRequirement( api.aMethod(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4228,7 +4236,7 @@ abstract class PigeonApiClassWithApiRequirement( if (api != null) { channel.setMessageHandler { _, reply -> reply.reply( - wrapError( + ProxyApiTestsPigeonUtils.wrapError( UnsupportedOperationException( "Call references class `ClassWithApiRequirement`, which requires api version 25."))) } @@ -4270,7 +4278,7 @@ abstract class PigeonApiClassWithApiRequirement( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index f1642d77176..fd03c48cee4 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22 -version: 25.3.0 # This must match the version in lib/src/generator_tools.dart +version: 25.3.1 # This must match the version in lib/src/generator_tools.dart environment: sdk: ^3.4.0 diff --git a/packages/pigeon/test/kotlin/proxy_api_test.dart b/packages/pigeon/test/kotlin/proxy_api_test.dart index fc88034531d..561acd364a0 100644 --- a/packages/pigeon/test/kotlin/proxy_api_test.dart +++ b/packages/pigeon/test/kotlin/proxy_api_test.dart @@ -999,6 +999,59 @@ void main() { ); }); }); + + group('InstanceManager', () { + test( + 'InstanceManager passes runnable field and not a new runnable instance', + () { + final Root root = Root( + apis: [ + AstProxyApi( + name: 'Api', + constructors: [], + fields: [], + methods: [], + ), + ], + classes: [], + enums: [], + ); + final StringBuffer sink = StringBuffer(); + const KotlinGenerator generator = KotlinGenerator(); + generator.generate( + const InternalKotlinOptions(kotlinOut: ''), + root, + sink, + dartPackageName: DEFAULT_PACKAGE_NAME, + ); + final String code = sink.toString(); + final String collapsedCode = _collapseNewlineAndIndentation(code); + + expect( + code, + contains( + 'handler.removeCallbacks(releaseAllFinalizedInstancesRunnable)', + ), + ); + expect( + code, + contains( + 'handler.postDelayed(releaseAllFinalizedInstancesRunnable', + ), + ); + + expect( + collapsedCode, + contains( + 'private val releaseAllFinalizedInstancesRunnable = Runnable { this.releaseAllFinalizedInstances() }', + ), + ); + expect( + 'this.releaseAllFinalizedInstances()'.allMatches(code).length, + 1, + ); + }); + }); }); } diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index a22d0bec484..2a72e608804 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -249,7 +249,7 @@ void main() { val wrapped: List = try { listOf(api.doSomething(inputArg)) } catch (exception: Throwable) { - wrapError(exception) + PigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -804,7 +804,7 @@ void main() { final String code = sink.toString(); expect(code, contains('interface Api')); expect(code, contains('api.doSomething(argArg) {')); - expect(code, contains('reply.reply(wrapResult(data))')); + expect(code, contains('reply.reply(PigeonUtils.wrapResult(data))')); }); test('gen one async Flutter Api', () { @@ -1631,7 +1631,7 @@ void main() { expect( code, contains( - 'callback(Result.failure(createConnectionError(channelName)))')); + 'callback(Result.failure(PigeonUtils.createConnectionError(channelName)))')); }); test('gen host uses default error class', () { diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart index 28229972834..7c6c12c428a 100644 --- a/packages/pigeon/tool/run_tests.dart +++ b/packages/pigeon/tool/run_tests.dart @@ -184,6 +184,7 @@ Future main(List args) async { androidJavaUnitTests, androidJavaLint, androidKotlinUnitTests, + androidKotlinLint, androidJavaIntegrationTests, androidKotlinIntegrationTests, linuxUnitTests, diff --git a/packages/pigeon/tool/shared/test_suites.dart b/packages/pigeon/tool/shared/test_suites.dart index fb70cbea0eb..a16afe0c2e7 100644 --- a/packages/pigeon/tool/shared/test_suites.dart +++ b/packages/pigeon/tool/shared/test_suites.dart @@ -16,9 +16,12 @@ import 'process_utils.dart'; const int _noDeviceAvailableExitCode = 100; -const String _testPluginRelativePath = 'platform_tests/test_plugin'; +const String _testPluginName = 'test_plugin'; +const String _alternateLanguageTestPluginName = + 'alternate_language_test_plugin'; +const String _testPluginRelativePath = 'platform_tests/$_testPluginName'; const String _alternateLanguageTestPluginRelativePath = - 'platform_tests/alternate_language_test_plugin'; + 'platform_tests/$_alternateLanguageTestPluginName'; const String _integrationTestFileRelativePath = 'integration_test/test.dart'; /// Information about a test suite. @@ -38,6 +41,7 @@ const String androidJavaUnitTests = 'android_java_unittests'; const String androidJavaLint = 'android_java_lint'; const String androidJavaIntegrationTests = 'android_java_integration_tests'; const String androidKotlinUnitTests = 'android_kotlin_unittests'; +const String androidKotlinLint = 'android_kotlin_lint'; const String androidKotlinIntegrationTests = 'android_kotlin_integration_tests'; const String iOSObjCUnitTests = 'ios_objc_unittests'; const String iOSObjCIntegrationTests = 'ios_objc_integration_tests'; @@ -72,6 +76,9 @@ const Map testSuites = { androidKotlinUnitTests: TestInfo( function: _runAndroidKotlinUnitTests, description: 'Unit tests on generated Kotlin code.'), + androidKotlinLint: TestInfo( + function: _runAndroidKotlinLint, + description: 'Lint generated Kotlin code.'), androidKotlinIntegrationTests: TestInfo( function: _runAndroidKotlinIntegrationTests, description: 'Integration tests on generated Kotlin code.'), @@ -123,26 +130,23 @@ Future _runAndroidJavaIntegrationTests({bool ciMode = false}) async { } Future _runAndroidJavaLint({bool ciMode = false}) async { - const String examplePath = - './$_alternateLanguageTestPluginRelativePath/example'; - const String androidProjectPath = '$examplePath/android'; - final File gradleFile = File(p.join(androidProjectPath, 'gradlew')); - if (!gradleFile.existsSync()) { - final int compileCode = await runFlutterBuild(examplePath, 'apk', - flags: ['--config-only']); - if (compileCode != 0) { - return compileCode; - } - } - - return runGradleBuild( - androidProjectPath, 'alternate_language_test_plugin:lintDebug'); + return _runAndroidLint( + testPluginName: _alternateLanguageTestPluginName, + testPluginPath: _alternateLanguageTestPluginRelativePath, + ); } Future _runAndroidKotlinUnitTests({bool ciMode = false}) async { return _runAndroidUnitTests(_testPluginRelativePath); } +Future _runAndroidKotlinLint({bool ciMode = false}) async { + return _runAndroidLint( + testPluginName: _testPluginName, + testPluginPath: _testPluginRelativePath, + ); +} + Future _runAndroidUnitTests(String testPluginPath) async { final String examplePath = './$testPluginPath/example'; final String androidProjectPath = '$examplePath/android'; @@ -157,6 +161,24 @@ Future _runAndroidUnitTests(String testPluginPath) async { return runGradleBuild(androidProjectPath, 'testDebugUnitTest'); } +Future _runAndroidLint({ + required String testPluginName, + required String testPluginPath, +}) async { + final String examplePath = './$testPluginPath/example'; + final String androidProjectPath = '$examplePath/android'; + final File gradleFile = File(p.join(androidProjectPath, 'gradlew')); + if (!gradleFile.existsSync()) { + final int compileCode = await runFlutterBuild(examplePath, 'apk', + flags: ['--config-only']); + if (compileCode != 0) { + return compileCode; + } + } + + return runGradleBuild(androidProjectPath, '$testPluginName:lintDebug'); +} + Future _runAndroidKotlinIntegrationTests({bool ciMode = false}) async { return _runMobileIntegrationTests('Android', _testPluginRelativePath); } diff --git a/packages/pigeon/tool/test.dart b/packages/pigeon/tool/test.dart index 07c7dfdf61b..dd1b331c43d 100644 --- a/packages/pigeon/tool/test.dart +++ b/packages/pigeon/tool/test.dart @@ -78,6 +78,7 @@ ${parser.usage}'''); androidJavaIntegrationTests, androidKotlinIntegrationTests, androidJavaLint, + androidKotlinLint, ]; const List iOSTests = [ iOSObjCUnitTests,