diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index dc35906630f2..4e5943939712 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,8 @@ +## 9.0.3 + +* [kotlin] Fixes compiler warnings in generated output. +* [swift] Fixes compiler warnings in generated output. + ## 9.0.2 * [swift] Removes safe casting from decode process. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index b7f3b24fc754..0f7c50fd3536 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -11,7 +11,7 @@ import 'ast.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '9.0.2'; +const String pigeonVersion = '9.0.3'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/lib/java_generator.dart b/packages/pigeon/lib/java_generator.dart index 4d348a308975..18677b3a41a4 100644 --- a/packages/pigeon/lib/java_generator.dart +++ b/packages/pigeon/lib/java_generator.dart @@ -458,7 +458,7 @@ class JavaGenerator extends StructuredGenerator { '$returnType $output = channelReply == null ? null : ((Number) channelReply).longValue();'); } else { indent.writeln( - '$returnType $output = ($returnType) channelReply;'); + '$returnType $output = ${_cast('channelReply', javaType: returnType)};'); } indent.writeln('callback.reply($output);'); }); @@ -627,8 +627,8 @@ class JavaGenerator extends StructuredGenerator { String accessor = 'args.get($index)'; if (isEnum(root, arg.type)) { accessor = _intToEnum(accessor, arg.type.baseName); - } else if (argType != 'Object') { - accessor = '($argType) $accessor'; + } else { + accessor = _cast(accessor, javaType: argType); } indent.writeln('$argType $argName = $accessor;'); if (!arg.type.isNullable) { @@ -646,7 +646,7 @@ class JavaGenerator extends StructuredGenerator { method.returnType.isVoid ? 'null' : 'result'; const String resultName = 'resultCallback'; indent.format(''' -Result<$returnType> $resultName = +Result<$returnType> $resultName = \t\tnew Result<$returnType>() { \t\t\tpublic void success($returnType result) { \t\t\t\twrapped.add(0, $resultValue); @@ -871,6 +871,13 @@ String _nullsafeJavaTypeForDartType(TypeDeclaration type) { return '$nullSafe${_javaTypeForDartType(type)}'; } +/// Returns an expression to cast [variable] to [javaType]. +String _cast(String variable, {required String javaType}) { + // Special-case Object, since casting to Object doesn't do anything, and + // causes a warning. + return javaType == 'Object' ? variable : '($javaType) $variable'; +} + /// Casts variable named [varName] to the correct host datatype for [field]. /// This is for use in codecs where we may have a map representation of an /// object. @@ -884,6 +891,6 @@ String _castObject( classes.map((Class x) => x.name).contains(field.type.baseName)) { return '($varName == null) ? null : ${hostDatatype.datatype}.fromList((ArrayList) $varName)'; } else { - return '(${hostDatatype.datatype}) $varName'; + return _cast(varName, javaType: hostDatatype.datatype); } } diff --git a/packages/pigeon/lib/kotlin_generator.dart b/packages/pigeon/lib/kotlin_generator.dart index b775b3923cb2..68584aee1594 100644 --- a/packages/pigeon/lib/kotlin_generator.dart +++ b/packages/pigeon/lib/kotlin_generator.dart @@ -180,12 +180,13 @@ class KotlinGenerator extends StructuredGenerator { final HostDatatype hostDatatype = _getHostDatatype(root, field); String toWriteValue = ''; final String fieldName = field.name; + final String safeCall = field.type.isNullable ? '?' : ''; if (!hostDatatype.isBuiltin && customClassNames.contains(field.type.baseName)) { - toWriteValue = '$fieldName?.toList()'; + toWriteValue = '$fieldName$safeCall.toList()'; } else if (!hostDatatype.isBuiltin && customEnumNames.contains(field.type.baseName)) { - toWriteValue = '$fieldName?.raw'; + toWriteValue = '$fieldName$safeCall.raw'; } else { toWriteValue = fieldName; } @@ -244,7 +245,8 @@ class KotlinGenerator extends StructuredGenerator { indent.addln( '.let { if (it is Int) it.toLong() else it as Long? }'); } else { - indent.writeln('val ${field.name} = $listValue as $fieldType?'); + indent.writeln( + 'val ${field.name} = ${_cast(listValue, kotlinType: '$fieldType?')}'); } } else { if (!hostDatatype.isBuiltin && @@ -260,7 +262,8 @@ class KotlinGenerator extends StructuredGenerator { indent .addln('.let { if (it is Int) it.toLong() else it as Long }'); } else { - indent.writeln('val ${field.name} = $listValue as $fieldType'); + indent.writeln( + 'val ${field.name} = ${_cast(listValue, kotlinType: fieldType)}'); } } }); @@ -380,13 +383,15 @@ class KotlinGenerator extends StructuredGenerator { indent.writeln('callback()'); }); } else { - final String forceUnwrap = func.returnType.isNullable ? '?' : ''; indent.addScoped('{', '}', () { if (func.returnType.baseName == 'int') { + final String forceUnwrap = + func.returnType.isNullable ? '?' : ''; indent.writeln( 'val result = if (it is Int) it.toLong() else it as$forceUnwrap Long'); } else { - indent.writeln('val result = it as$forceUnwrap $returnType'); + indent.writeln( + 'val result = ${_cast('it', kotlinType: returnType, safeCast: func.returnType.isNullable)}'); } indent.writeln('callback(result)'); }); @@ -507,7 +512,6 @@ class KotlinGenerator extends StructuredGenerator { indent.write('channel.setMessageHandler '); indent.addScoped('{ $messageVarName, reply ->', '}', () { - indent.writeln('var wrapped = listOf()'); final List methodArguments = []; if (method.arguments.isNotEmpty) { indent.writeln('val args = message as List'); @@ -543,6 +547,7 @@ class KotlinGenerator extends StructuredGenerator { }); }); } else { + indent.writeln('var wrapped: List'); indent.write('try '); indent.addScoped('{', '}', () { if (method.returnType.isVoid) { @@ -669,15 +674,15 @@ String _castForceUnwrap(String value, TypeDeclaration type, Root root) { type.isNullable ? '$value == null ? null : ' : ''; return '$nullableConditionPrefix${_kotlinTypeForDartType(type)}.ofRaw($value as Int)$forceUnwrap'; } else { - final String castUnwrap = type.isNullable ? '?' : ''; - // The StandardMessageCodec can give us [Integer, Long] for // a Dart 'int'. To keep things simple we just use 64bit // longs in Pigeon with Kotlin. if (type.baseName == 'int') { + final String castUnwrap = type.isNullable ? '?' : ''; return '$value.let { if (it is Int) it.toLong() else it as$castUnwrap Long }'; } else { - return '$value as$castUnwrap ${_kotlinTypeForDartType(type)}'; + return _cast(value, + kotlinType: _kotlinTypeForDartType(type), safeCast: type.isNullable); } } } @@ -741,3 +746,13 @@ String _nullsafeKotlinTypeForDartType(TypeDeclaration type) { final String nullSafe = type.isNullable ? '?' : ''; return '${_kotlinTypeForDartType(type)}$nullSafe'; } + +/// Returns an expression to cast [variable] to [kotlinType]. +String _cast(String variable, + {required String kotlinType, bool safeCast = false}) { + // Special-case Any, since no-op casts cause warnings. + if (kotlinType == 'Any?' || (safeCast && kotlinType == 'Any')) { + return variable; + } + return '$variable as${safeCast ? '?' : ''} $kotlinType'; +} diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart index 71699ed7d164..d804f6b90d27 100644 --- a/packages/pigeon/mock_handler_tester/test/message.dart +++ b/packages/pigeon/mock_handler_tester/test/message.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart index 88c1c1ee092b..22d29c62535d 100644 --- a/packages/pigeon/mock_handler_tester/test/test.dart +++ b/packages/pigeon/mock_handler_tester/test/test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/pigeon/pigeons/android_unittests.dart b/packages/pigeon/pigeons/android_unittests.dart deleted file mode 100644 index 45ecf191cce8..000000000000 --- a/packages/pigeon/pigeons/android_unittests.dart +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:pigeon/pigeon.dart'; - -enum AndroidLoadingState { - loading, - complete, -} - -class AndroidSetRequest { - int? value; - AndroidLoadingState? state; -} - -class AndroidNestedRequest { - String? context; - AndroidSetRequest? request; -} - -@HostApi() -abstract class AndroidApi { - void setValue(AndroidSetRequest request); -} - -@HostApi() -abstract class AndroidNestedApi { - void setValueWithContext(AndroidNestedRequest request); -} diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle index 5b8124bc7cd4..ae0feab72079 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle @@ -50,3 +50,7 @@ android { testImplementation "org.mockito:mockito-core:5.+" } } + +project.getTasks().withType(JavaCompile){ + options.compilerArgs.addAll(["-Xlint:all", "-Werror"]) +} diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index 4cf7c13551bf..165907080150 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.alternate_language_test_plugin; @@ -3239,7 +3239,7 @@ public void throwError(Reply callback) { null, channelReply -> { @SuppressWarnings("ConstantConditions") - Object output = (Object) channelReply; + Object output = channelReply; callback.reply(output); }); } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java index 61324c1fc8a4..e2d6414ad9de 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java @@ -26,6 +26,7 @@ public void nullValues() { ByteBuffer message = invocation.getArgument(1); BinaryMessenger.BinaryReply reply = invocation.getArgument(2); message.position(0); + @SuppressWarnings("unchecked") ArrayList args = (ArrayList) FlutterIntegrationCoreApi.getCodec().decodeMessage(message); ByteBuffer replyData = @@ -101,6 +102,7 @@ public void hasValues() { ByteBuffer message = invocation.getArgument(1); BinaryMessenger.BinaryReply reply = invocation.getArgument(2); message.position(0); + @SuppressWarnings("unchecked") ArrayList args = (ArrayList) FlutterIntegrationCoreApi.getCodec().decodeMessage(message); ByteBuffer replyData = diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java index e5e795380a8f..2434910d8379 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java @@ -61,7 +61,7 @@ public void asyncSuccess() { (bytes) -> { bytes.rewind(); @SuppressWarnings("unchecked") - ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); + ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); assertTrue(wrapped.size() == 1); didCall[0] = true; }); @@ -88,7 +88,7 @@ public void asyncError() { (bytes) -> { bytes.rewind(); @SuppressWarnings("unchecked") - ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); + ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); assertTrue(wrapped.size() > 1); assertEquals("java.lang.Exception: error", (String) wrapped.get(0)); didCall[0] = true; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java index 37ecef9a0320..9594f576d917 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java @@ -28,7 +28,9 @@ public void listInList() { ByteBuffer message = invocation.getArgument(1); BinaryMessenger.BinaryReply reply = invocation.getArgument(2); message.position(0); - ArrayList args = (ArrayList) FlutterSmallApi.getCodec().decodeMessage(message); + @SuppressWarnings("unchecked") + ArrayList args = + (ArrayList) FlutterSmallApi.getCodec().decodeMessage(message); ByteBuffer replyData = FlutterSmallApi.getCodec().encodeMessage(args.get(0)); replyData.position(0); reply.reply(replyData); diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java index ff6e24d5891b..36f172a0bf50 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java @@ -22,6 +22,7 @@ public void subtract() { ByteBuffer message = invocation.getArgument(1); BinaryMessenger.BinaryReply reply = invocation.getArgument(2); message.position(0); + @SuppressWarnings("unchecked") ArrayList args = (ArrayList) MultipleArityFlutterApi.getCodec().decodeMessage(message); Long arg0 = (Long) args.get(0); diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java index 041a83baebf3..640a8ef9123e 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java @@ -39,7 +39,7 @@ public void nullArgHostApi() { (bytes) -> { bytes.rewind(); @SuppressWarnings("unchecked") - ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); + ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); assertTrue(wrapped.size() == 1); }); } @@ -52,8 +52,9 @@ public void nullArgFlutterApi() { ByteBuffer message = invocation.getArgument(1); BinaryMessenger.BinaryReply reply = invocation.getArgument(2); message.position(0); - ArrayList args = - (ArrayList) + @SuppressWarnings("unchecked") + ArrayList args = + (ArrayList) NullableReturns.NullableArgFlutterApi.getCodec().decodeMessage(message); assertNull(args.get(0)); ByteBuffer replyData = diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java index 865d4ef81767..e03ad372a6b1 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java @@ -46,7 +46,7 @@ public void errorMessage() { (bytes) -> { bytes.rewind(); @SuppressWarnings("unchecked") - ArrayList error = (ArrayList) codec.decodeMessage(bytes); + ArrayList error = (ArrayList) codec.decodeMessage(bytes); assertNotNull(error.get(0)); assertNotNull(error.get(1)); String details = (String) error.get(2); diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java index 772b86993e6c..186d80bb1c65 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java @@ -28,7 +28,9 @@ private static BinaryMessenger makeMockBinaryMessenger() { ByteBuffer message = invocation.getArgument(1); BinaryMessenger.BinaryReply reply = invocation.getArgument(2); message.position(0); - ArrayList args = (ArrayList) PrimitiveFlutterApi.getCodec().decodeMessage(message); + @SuppressWarnings("unchecked") + ArrayList args = + (ArrayList) PrimitiveFlutterApi.getCodec().decodeMessage(message); Object arg = args.get(0); if (arg instanceof Long) { Long longArg = (Long) arg; @@ -88,7 +90,7 @@ public void primitiveIntHostApi() { .setMessageHandler(eq("dev.flutter.pigeon.PrimitiveHostApi.anInt"), handler.capture()); MessageCodec codec = PrimitiveHostApi.getCodec(); @SuppressWarnings("unchecked") - ByteBuffer message = codec.encodeMessage(new ArrayList(Arrays.asList((Integer) 1))); + ByteBuffer message = codec.encodeMessage(new ArrayList(Arrays.asList((Integer) 1))); message.rewind(); handler .getValue() @@ -97,7 +99,7 @@ public void primitiveIntHostApi() { (bytes) -> { bytes.rewind(); @SuppressWarnings("unchecked") - ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); + ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes); assertTrue(wrapped.size() > 0); assertEquals(1L, ((Long) wrapped.get(0)).longValue()); }); diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile index 0a6a3794e384..b17acede4cac 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile @@ -38,5 +38,9 @@ end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) + + target.build_configurations.each do |config| + config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES' + end end end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 61dc902f2a8b..5a1498d3ad10 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon #import diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index 64681f92bd53..dbbf7d4e9623 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "CoreTests.gen.h" diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart index 5e38b604c857..9e2d9811b143 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart index 16d19678aec6..de1af35f1600 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart index 103dd5b6092f..6613c48cfde9 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart index 061ee32a7d9f..dc1170af6ec2 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart index 7d7f3376fc8a..30d4dcab2411 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart index 8a09cb33c4d0..c8793703a781 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart index c6189e3f39f0..f36ecfc6f7a4 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index 5e38b604c857..9e2d9811b143 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import diff --git a/packages/pigeon/platform_tests/test_plugin/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/android/build.gradle index 0bc44b2140bf..6fe19e86831d 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/android/build.gradle @@ -34,6 +34,7 @@ android { kotlinOptions { jvmTarget = '1.8' + allWarningsAsErrors = true } sourceSets { 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 032f6dab440b..3f4f25a0edaf 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 @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.test_plugin @@ -82,7 +82,7 @@ data class AllTypes ( aFloatArray, aList, aMap, - anEnum?.raw, + anEnum.raw, aString, ) } @@ -162,7 +162,7 @@ data class AllNullableTypesWrapper ( } fun toList(): List { return listOf( - values?.toList(), + values.toList(), ) } } @@ -381,7 +381,7 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() + var wrapped: List try { api.noop() wrapped = listOf(null) @@ -398,9 +398,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val everythingArg = args[0] as AllTypes + var wrapped: List try { wrapped = listOf(api.echoAllTypes(everythingArg)) } catch (exception: Error) { @@ -416,7 +416,7 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() + var wrapped: List try { wrapped = listOf(api.throwError()) } catch (exception: Error) { @@ -432,7 +432,7 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwErrorFromVoid", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() + var wrapped: List try { api.throwErrorFromVoid() wrapped = listOf(null) @@ -449,9 +449,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long } + var wrapped: List try { wrapped = listOf(api.echoInt(anIntArg)) } catch (exception: Error) { @@ -467,9 +467,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aDoubleArg = args[0] as Double + var wrapped: List try { wrapped = listOf(api.echoDouble(aDoubleArg)) } catch (exception: Error) { @@ -485,9 +485,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aBoolArg = args[0] as Boolean + var wrapped: List try { wrapped = listOf(api.echoBool(aBoolArg)) } catch (exception: Error) { @@ -503,9 +503,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aStringArg = args[0] as String + var wrapped: List try { wrapped = listOf(api.echoString(aStringArg)) } catch (exception: Error) { @@ -521,9 +521,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aUint8ListArg = args[0] as ByteArray + var wrapped: List try { wrapped = listOf(api.echoUint8List(aUint8ListArg)) } catch (exception: Error) { @@ -539,9 +539,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anObjectArg = args[0] as Any + var wrapped: List try { wrapped = listOf(api.echoObject(anObjectArg)) } catch (exception: Error) { @@ -557,9 +557,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoList", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as List + var wrapped: List try { wrapped = listOf(api.echoList(aListArg)) } catch (exception: Error) { @@ -575,9 +575,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoMap", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aMapArg = args[0] as Map + var wrapped: List try { wrapped = listOf(api.echoMap(aMapArg)) } catch (exception: Error) { @@ -593,9 +593,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val everythingArg = args[0] as? AllNullableTypes + var wrapped: List try { wrapped = listOf(api.echoAllNullableTypes(everythingArg)) } catch (exception: Error) { @@ -611,9 +611,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val wrapperArg = args[0] as AllNullableTypesWrapper + var wrapped: List try { wrapped = listOf(api.extractNestedNullableString(wrapperArg)) } catch (exception: Error) { @@ -629,9 +629,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val nullableStringArg = args[0] as? String + var wrapped: List try { wrapped = listOf(api.createNestedNullableString(nullableStringArg)) } catch (exception: Error) { @@ -647,11 +647,11 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableBoolArg = args[0] as? Boolean val aNullableIntArg = args[1].let { if (it is Int) it.toLong() else it as? Long } val aNullableStringArg = args[2] as? String + var wrapped: List try { wrapped = listOf(api.sendMultipleNullableTypes(aNullableBoolArg, aNullableIntArg, aNullableStringArg)) } catch (exception: Error) { @@ -667,9 +667,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long } + var wrapped: List try { wrapped = listOf(api.echoNullableInt(aNullableIntArg)) } catch (exception: Error) { @@ -685,9 +685,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableDoubleArg = args[0] as? Double + var wrapped: List try { wrapped = listOf(api.echoNullableDouble(aNullableDoubleArg)) } catch (exception: Error) { @@ -703,9 +703,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableBoolArg = args[0] as? Boolean + var wrapped: List try { wrapped = listOf(api.echoNullableBool(aNullableBoolArg)) } catch (exception: Error) { @@ -721,9 +721,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableStringArg = args[0] as? String + var wrapped: List try { wrapped = listOf(api.echoNullableString(aNullableStringArg)) } catch (exception: Error) { @@ -739,9 +739,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableUint8ListArg = args[0] as? ByteArray + var wrapped: List try { wrapped = listOf(api.echoNullableUint8List(aNullableUint8ListArg)) } catch (exception: Error) { @@ -757,9 +757,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List - val aNullableObjectArg = args[0] as? Any + val aNullableObjectArg = args[0] + var wrapped: List try { wrapped = listOf(api.echoNullableObject(aNullableObjectArg)) } catch (exception: Error) { @@ -775,9 +775,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableList", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableListArg = args[0] as? List + var wrapped: List try { wrapped = listOf(api.echoNullableList(aNullableListArg)) } catch (exception: Error) { @@ -793,9 +793,9 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableMap", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableMapArg = args[0] as? Map + var wrapped: List try { wrapped = listOf(api.echoNullableMap(aNullableMapArg)) } catch (exception: Error) { @@ -811,7 +811,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.noopAsync() { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -829,7 +828,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncInt", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long } api.echoAsyncInt(anIntArg) { result: Result -> @@ -850,7 +848,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncDouble", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aDoubleArg = args[0] as Double api.echoAsyncDouble(aDoubleArg) { result: Result -> @@ -871,7 +868,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncBool", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aBoolArg = args[0] as Boolean api.echoAsyncBool(aBoolArg) { result: Result -> @@ -892,7 +888,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aStringArg = args[0] as String api.echoAsyncString(aStringArg) { result: Result -> @@ -913,7 +908,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncUint8List", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aUint8ListArg = args[0] as ByteArray api.echoAsyncUint8List(aUint8ListArg) { result: Result -> @@ -934,7 +928,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncObject", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anObjectArg = args[0] as Any api.echoAsyncObject(anObjectArg) { result: Result -> @@ -955,7 +948,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncList", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as List api.echoAsyncList(aListArg) { result: Result> -> @@ -976,7 +968,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncMap", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aMapArg = args[0] as Map api.echoAsyncMap(aMapArg) { result: Result> -> @@ -997,7 +988,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncError", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.throwAsyncError() { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -1016,7 +1006,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncErrorFromVoid", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.throwAsyncErrorFromVoid() { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -1034,7 +1023,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncAllTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val everythingArg = args[0] as AllTypes api.echoAsyncAllTypes(everythingArg) { result: Result -> @@ -1055,7 +1043,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val everythingArg = args[0] as? AllNullableTypes api.echoAsyncNullableAllNullableTypes(everythingArg) { result: Result -> @@ -1076,7 +1063,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableInt", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long } api.echoAsyncNullableInt(anIntArg) { result: Result -> @@ -1097,7 +1083,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableDouble", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aDoubleArg = args[0] as? Double api.echoAsyncNullableDouble(aDoubleArg) { result: Result -> @@ -1118,7 +1103,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableBool", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aBoolArg = args[0] as? Boolean api.echoAsyncNullableBool(aBoolArg) { result: Result -> @@ -1139,7 +1123,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aStringArg = args[0] as? String api.echoAsyncNullableString(aStringArg) { result: Result -> @@ -1160,7 +1143,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableUint8List", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aUint8ListArg = args[0] as? ByteArray api.echoAsyncNullableUint8List(aUint8ListArg) { result: Result -> @@ -1181,9 +1163,8 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableObject", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List - val anObjectArg = args[0] as? Any + val anObjectArg = args[0] api.echoAsyncNullableObject(anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -1202,7 +1183,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableList", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as? List api.echoAsyncNullableList(aListArg) { result: Result?> -> @@ -1223,7 +1203,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableMap", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aMapArg = args[0] as? Map api.echoAsyncNullableMap(aMapArg) { result: Result?> -> @@ -1244,7 +1223,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.callFlutterNoop() { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -1262,7 +1240,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowError", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.callFlutterThrowError() { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -1281,7 +1258,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.callFlutterThrowErrorFromVoid() { result: Result -> val error = result.exceptionOrNull() if (error != null) { @@ -1299,7 +1275,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val everythingArg = args[0] as AllTypes api.callFlutterEchoAllTypes(everythingArg) { result: Result -> @@ -1320,7 +1295,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aNullableBoolArg = args[0] as? Boolean val aNullableIntArg = args[1].let { if (it is Int) it.toLong() else it as? Long } @@ -1343,7 +1317,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aBoolArg = args[0] as Boolean api.callFlutterEchoBool(aBoolArg) { result: Result -> @@ -1364,7 +1337,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long } api.callFlutterEchoInt(anIntArg) { result: Result -> @@ -1385,7 +1357,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aDoubleArg = args[0] as Double api.callFlutterEchoDouble(aDoubleArg) { result: Result -> @@ -1406,7 +1377,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aStringArg = args[0] as String api.callFlutterEchoString(aStringArg) { result: Result -> @@ -1427,7 +1397,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as ByteArray api.callFlutterEchoUint8List(aListArg) { result: Result -> @@ -1448,7 +1417,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as List api.callFlutterEchoList(aListArg) { result: Result> -> @@ -1469,7 +1437,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aMapArg = args[0] as Map api.callFlutterEchoMap(aMapArg) { result: Result> -> @@ -1490,7 +1457,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aBoolArg = args[0] as? Boolean api.callFlutterEchoNullableBool(aBoolArg) { result: Result -> @@ -1511,7 +1477,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long } api.callFlutterEchoNullableInt(anIntArg) { result: Result -> @@ -1532,7 +1497,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aDoubleArg = args[0] as? Double api.callFlutterEchoNullableDouble(aDoubleArg) { result: Result -> @@ -1553,7 +1517,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aStringArg = args[0] as? String api.callFlutterEchoNullableString(aStringArg) { result: Result -> @@ -1574,7 +1537,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as? ByteArray api.callFlutterEchoNullableUint8List(aListArg) { result: Result -> @@ -1595,7 +1557,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aListArg = args[0] as? List api.callFlutterEchoNullableList(aListArg) { result: Result?> -> @@ -1616,7 +1577,6 @@ interface HostIntegrationCoreApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aMapArg = args[0] as? Map api.callFlutterEchoNullableMap(aMapArg) { result: Result?> -> @@ -1714,7 +1674,7 @@ class FlutterIntegrationCoreApi(private val binaryMessenger: BinaryMessenger) { fun throwError(callback: (Any?) -> Unit) { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.throwError", codec) channel.send(null) { - val result = it as? Any? + val result = it callback(result) } } @@ -1904,7 +1864,7 @@ interface HostTrivialApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() + var wrapped: List try { api.noop() wrapped = listOf(null) @@ -1941,7 +1901,6 @@ interface HostSmallApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostSmallApi.echo", codec) if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val aStringArg = args[0] as String api.echo(aStringArg) { result: Result -> @@ -1962,7 +1921,6 @@ interface HostSmallApi { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.HostSmallApi.voidVoid", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped = listOf() api.voidVoid() { result: Result -> val error = result.exceptionOrNull() if (error != null) { diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt index 478102a3ebe2..944e4163cfc6 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt @@ -39,7 +39,7 @@ class TestPlugin: FlutterPlugin, HostIntegrationCoreApi { return everything } - override fun throwError(): Object? { + override fun throwError(): Any? { throw Exception("An error"); } @@ -173,7 +173,7 @@ class TestPlugin: FlutterPlugin, HostIntegrationCoreApi { override fun echoAsyncMap(aMap: Map, callback: (Result>) -> Unit) { callback(Result.success(aMap)) } - + override fun echoAsyncNullableInt(anInt: Long?, callback: (Result) -> Unit) { callback(Result.success(anInt)) } @@ -209,7 +209,7 @@ class TestPlugin: FlutterPlugin, HostIntegrationCoreApi { override fun callFlutterNoop(callback: (Result) -> Unit) { flutterApi!!.noop() { callback(Result.success(Unit)) } } - + override fun callFlutterThrowError(callback: (Result) -> Unit) { // TODO: (tarrinneal) Once flutter api error handling is added, complete these tests. // See issue https://github.com/flutter/flutter/issues/118243 @@ -224,9 +224,9 @@ class TestPlugin: FlutterPlugin, HostIntegrationCoreApi { } override fun callFlutterSendMultipleNullableTypes( - aNullableBool: Boolean?, - aNullableInt: Long?, - aNullableString: String?, + aNullableBool: Boolean?, + aNullableInt: Long?, + aNullableString: String?, callback: (Result) -> Unit ) { flutterApi!!.sendMultipleNullableTypes(aNullableBool, aNullableInt, aNullableString) { diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 9e1fa4bee614..de3055bfefa7 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 9e1fa4bee614..de3055bfefa7 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 2ca8f4d43be8..d29eef090d3c 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index 42ac51a02e76..ce395b4f7283 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v9.0.2), do not edit directly. +// Autogenerated from Pigeon (v9.0.3), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_CORE_TESTS_GEN_H_ diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 70f92c630e21..1a865d49096a 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%3Apigeon -version: 9.0.2 # This must match the version in lib/generator_tools.dart +version: 9.0.3 # This must match the version in lib/generator_tools.dart environment: sdk: ">=2.12.0 <3.0.0" diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index 2aae1029ea66..18196cf1e165 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -185,9 +185,9 @@ void main() { expect(code, contains(''' if (api != null) { channel.setMessageHandler { message, reply -> - var wrapped = listOf() val args = message as List val inputArg = args[0] as Input + var wrapped: List try { wrapped = listOf(api.doSomething(inputArg)) } catch (exception: Error) {