diff --git a/analysis_options.yaml b/analysis_options.yaml index 736235588ba5..09a526583d93 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -19,6 +19,7 @@ analyzer: exclude: # DIFFERENT FROM FLUTTER/FLUTTER # Ignore generated files - '**/*.g.dart' + - '**/*.gen.jni.dart' - '**/*.mocks.dart' # Mockito @GenerateMocks linter: diff --git a/packages/pigeon/example/app/lib/src/messages.g.dart b/packages/pigeon/example/app/lib/src/messages.g.dart index fe3f5abab66d..bd0911c6933b 100644 --- a/packages/pigeon/example/app/lib/src/messages.g.dart +++ b/packages/pigeon/example/app/lib/src/messages.g.dart @@ -47,7 +47,7 @@ bool _deepEquals(Object? a, Object? b) { enum Code { one, - two, + two; } class MessageData { diff --git a/packages/pigeon/lib/src/ast.dart b/packages/pigeon/lib/src/ast.dart index 116654458e52..d4fff9bae63d 100644 --- a/packages/pigeon/lib/src/ast.dart +++ b/packages/pigeon/lib/src/ast.dart @@ -143,6 +143,7 @@ class AstProxyApi extends Api { super.documentationComments = const [], required this.constructors, required this.fields, + this.associatedType, this.superClass, this.interfaces = const {}, this.swiftOptions, @@ -155,6 +156,9 @@ class AstProxyApi extends Api { /// List of fields inside the API. List fields; + /// The TypeDeclaration associated with this ProxyApi. + TypeDeclaration? associatedType; + /// Name of the class this class considers the super class. TypeDeclaration? superClass; @@ -541,32 +545,38 @@ class TypeDeclaration { /// Returns duplicated `TypeDeclaration` with attached `associatedEnum` value. TypeDeclaration copyWithEnum(Enum enumDefinition) { - return TypeDeclaration( + final TypeDeclaration newType = TypeDeclaration( baseName: baseName, isNullable: isNullable, associatedEnum: enumDefinition, typeArguments: typeArguments, ); + enumDefinition.associatedType = newType; + return newType; } /// Returns duplicated `TypeDeclaration` with attached `associatedClass` value. TypeDeclaration copyWithClass(Class classDefinition) { - return TypeDeclaration( + final TypeDeclaration newType = TypeDeclaration( baseName: baseName, isNullable: isNullable, associatedClass: classDefinition, typeArguments: typeArguments, ); + classDefinition.associatedType = newType; + return newType; } /// Returns duplicated `TypeDeclaration` with attached `associatedProxyApi` value. TypeDeclaration copyWithProxyApi(AstProxyApi proxyApiDefinition) { - return TypeDeclaration( + final TypeDeclaration newType = TypeDeclaration( baseName: baseName, isNullable: isNullable, associatedProxyApi: proxyApiDefinition, typeArguments: typeArguments, ); + proxyApiDefinition.associatedType = newType; + return newType; } /// Returns duplicated `TypeDeclaration` with attached `associatedProxyApi` value. @@ -707,6 +717,7 @@ class Class extends Node { required this.fields, this.superClassName, this.superClass, + this.associatedType, this.isSealed = false, this.isReferenced = true, this.isSwiftClass = false, @@ -725,6 +736,9 @@ class Class extends Node { /// The definition of the parent class. Class? superClass; + /// The TypeDeclaration associated with this class. + TypeDeclaration? associatedType; + /// List of class definitions of children. /// /// This is only meant to be used by sealed classes used in event channel methods. @@ -761,6 +775,7 @@ class Enum extends Node { Enum({ required this.name, required this.members, + this.associatedType, this.documentationComments = const [], }); @@ -770,6 +785,9 @@ class Enum extends Node { /// All of the members of the enum. List members; + /// The TypeDeclaration associated with this enum. + TypeDeclaration? associatedType; + /// List of documentation comments, separated by line. /// /// Lines should not include the comment marker itself, but should include any diff --git a/packages/pigeon/lib/src/dart/dart_generator.dart b/packages/pigeon/lib/src/dart/dart_generator.dart index a6955bcdfabc..831e3a408477 100644 --- a/packages/pigeon/lib/src/dart/dart_generator.dart +++ b/packages/pigeon/lib/src/dart/dart_generator.dart @@ -45,6 +45,8 @@ class DartOptions { this.copyrightHeader, this.sourceOutPath, this.testOutPath, + this.useJni = false, + this.dartOut, }); /// A copyright header that will get prepended to generated code. @@ -56,6 +58,12 @@ class DartOptions { /// Path to output generated Test file for tests. final String? testOutPath; + /// Whether to use Jni for generating kotlin interop code. + final bool useJni; + + /// Path to output generated Dart file. + final String? dartOut; + /// Creates a [DartOptions] from a Map representation where: /// `x = DartOptions.fromMap(x.toMap())`. static DartOptions fromMap(Map map) { @@ -65,6 +73,8 @@ class DartOptions { copyrightHeader: copyrightHeader?.cast(), sourceOutPath: map['sourceOutPath'] as String?, testOutPath: map['testOutPath'] as String?, + useJni: map['useJni'] as bool? ?? false, + dartOut: map['dartOut'] as String?, ); } @@ -75,6 +85,8 @@ class DartOptions { if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, if (sourceOutPath != null) 'sourceOutPath': sourceOutPath!, if (testOutPath != null) 'testOutPath': testOutPath!, + if (useJni) 'useJni': useJni, + if (dartOut != null) 'dartOut': dartOut!, }; return result; } @@ -86,6 +98,279 @@ class DartOptions { } } +class _JniType { + _JniType({ + required this.typeName, + required this.jniName, + required this.getToDartCall, + required this.getToJniCall, + required this.isBuiltIn, + this.nonNullableNeedsUnwrapping = false, + }); + + static _JniType fromTypeDeclaration(TypeDeclaration? type) { + if (type == null) { + // throw + return _JniType( + typeName: '', + jniName: '', + getToDartCall: ( + TypeDeclaration type, { + String? varName, + bool forceConversion = false, + }) => + '', + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + '', + isBuiltIn: false, + ); + } + _JniType? jniType = _jniTypeForDartType[type.baseName]; + if (type.isClass) { + jniType = jniType ?? + _JniType( + typeName: type.baseName, + jniName: 'bridge.${type.baseName}', + getToDartCall: ( + TypeDeclaration type, { + String? varName, + bool forceConversion = false, + }) => + '${type.baseName}.fromJni($varName)${_getForceNonNullSymbol(!type.isNullable)}', + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + _wrapInNullCheckIfNullable( + field.type, field.name, '${field.name}.toJni()'), + isBuiltIn: false, + nonNullableNeedsUnwrapping: true, + ); + } else if (type.isEnum) { + jniType = jniType ?? + _JniType( + typeName: type.baseName, + jniName: 'bridge.${type.baseName}', + getToDartCall: ( + TypeDeclaration type, { + String? varName, + bool forceConversion = false, + }) => + '${type.baseName}.fromJni($varName)${_getForceNonNullSymbol(!type.isNullable)}', + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + _wrapInNullCheckIfNullable(field.type, field.name, + '${field.name}${_getForceNonNullSymbol(type.isNullable && forceNonNull)}.toJni()'), + isBuiltIn: false, + nonNullableNeedsUnwrapping: true, + ); + } + return jniType ?? + _JniType( + typeName: '', + jniName: '', + isBuiltIn: false, + getToDartCall: + (_, {bool forceConversion = true, String varName = ''}) => '', + getToJniCall: ( + _, + __, { + bool forceNonNull = true, + }) => + ''); + } + + final String typeName; + final String jniName; + final bool isBuiltIn; + final bool nonNullableNeedsUnwrapping; + final String Function( + TypeDeclaration type, { + String varName, + bool forceConversion, + }) getToDartCall; + String Function( + NamedType field, + _JniType jniType, { + bool forceNonNull, + }) getToJniCall; + + // String getToDartCall( + // TypeDeclaration type, { + // String? varName, + // bool forceConversion = false, + // }) { + // varName = varName ?? ''; + // if (isBuiltIn) { + // return !type.isNullable && !nonNullableNeedsUnwrapping && !forceConversion + // ? '' + // : type.isNullable + // ? '$varName$conversionToNullableDart' + // : '$varName$conversionToDart'; + // } + // return '$conversionToDart($varName)${type.isNullable ? '' : '!'}'; + // } + + String getJniGetterMethodName(String field) { + return 'get${toUpperCamelCase(field)}()'; + } + + String getApiCallReturnType(Method method) { + if (method.isAsynchronous || + method.returnType.isNullable || + nonNullableNeedsUnwrapping) { + return '$jniName${_getNullableSymbol(method.returnType)}'; + } + return typeName; + } +} + +String _standardToJniCall( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, +}) { + return field.type.isNullable + ? '${field.name} == null ? null : ${jniType.jniName}(${field.name}${_getForceNonNullSymbol(forceNonNull)})' + : field.name; + // return '${field.name}${field.type.isNullable ? '?' : ''}$conversionToJni'; +} + +String _getNullableSymbol(TypeDeclaration type) => type.isNullable ? '?' : ''; + +String _getForceNonNullSymbol(bool force) => force ? '!' : ''; + +String _wrapInNullCheckIfNullable( + TypeDeclaration type, String varName, String code) => + type.isNullable ? '$varName == null ? null : $code' : code; + +final Map _jniTypeForDartType = { + 'String': _JniType( + typeName: 'String', + jniName: 'JString', + getToDartCall: ( + TypeDeclaration type, { + String varName = '', + bool forceConversion = false, + }) => + '$varName${_getNullableSymbol(type)}.toDartString(releaseOriginal: true)', + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + _wrapInNullCheckIfNullable(field.type, field.name, + 'JString.fromString(${field.name}${_getForceNonNullSymbol(field.type.isNullable && forceNonNull)})'), + isBuiltIn: true, + nonNullableNeedsUnwrapping: true, + ), + 'void': _JniType( + typeName: 'void', + jniName: 'JVoid', + getToDartCall: ( + TypeDeclaration type, { + String varName = '', + bool forceConversion = false, + }) => + '', + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + '', + isBuiltIn: true, + ), + 'bool': _JniType( + typeName: 'bool', + jniName: 'JBoolean', + getToDartCall: ( + TypeDeclaration type, { + String varName = '', + bool forceConversion = false, + }) => + type.isNullable || forceConversion + ? '$varName${_getNullableSymbol(type)}.booleanValue(releaseOriginal: true)' + : varName, + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + _standardToJniCall(field, jniType, forceNonNull: forceNonNull), + isBuiltIn: true, + ), + 'int': _JniType( + typeName: 'int', + jniName: 'JLong', + getToDartCall: ( + TypeDeclaration type, { + String varName = '', + bool forceConversion = false, + }) => + type.isNullable || forceConversion + ? '$varName${_getNullableSymbol(type)}.intValue(releaseOriginal: true)' + : varName, + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + _standardToJniCall(field, jniType, forceNonNull: forceNonNull), + isBuiltIn: true, + ), + 'double': _JniType( + typeName: 'double', + jniName: 'JDouble', + getToDartCall: ( + TypeDeclaration type, { + String varName = '', + bool forceConversion = false, + }) => + type.isNullable || forceConversion + ? '$varName${_getNullableSymbol(type)}.doubleValue(releaseOriginal: true)' + : varName, + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + _standardToJniCall(field, jniType, forceNonNull: forceNonNull), + isBuiltIn: true, + ), + // 'Uint8List': 'ByteArray', + // 'Int32List': 'IntArray', + // 'Int64List': 'LongArray', + // 'Float32List': 'FloatArray', + // 'Float64List': 'DoubleArray', + 'Object': _JniType( + typeName: 'Object', + jniName: 'JObject', + getToDartCall: ( + TypeDeclaration type, { + String varName = '', + bool forceConversion = false, + }) => + '_PigeonJniCodec.readValue($varName)${_getForceNonNullSymbol(!type.isNullable)}', + getToJniCall: ( + NamedType field, + _JniType jniType, { + bool forceNonNull = false, + }) => + '_PigeonJniCodec.writeValue(${field.name})${_getForceNonNullSymbol(!field.type.isNullable)}', + isBuiltIn: true, + nonNullableNeedsUnwrapping: true, + ), +}; + /// Options that control how Dart code will be generated. class InternalDartOptions extends InternalOptions { /// Constructor for InternalDartOptions. @@ -93,6 +378,7 @@ class InternalDartOptions extends InternalOptions { this.copyrightHeader, this.dartOut, this.testOut, + this.useJni = false, }); /// Creates InternalDartOptions from DartOptions. @@ -103,7 +389,8 @@ class InternalDartOptions extends InternalOptions { String? testOut, }) : copyrightHeader = copyrightHeader ?? options.copyrightHeader, dartOut = (dartOut ?? options.sourceOutPath)!, - testOut = testOut ?? options.testOutPath; + testOut = testOut ?? options.testOutPath, + useJni = options.useJni; /// A copyright header that will get prepended to generated code. final Iterable? copyrightHeader; @@ -113,6 +400,9 @@ class InternalDartOptions extends InternalOptions { /// Path to output generated Test file for tests. final String? testOut; + + /// Whether to use Jni for generating kotlin interop code. + final bool useJni; } /// Class that manages all Dart code generation. @@ -159,6 +449,12 @@ class DartGenerator extends StructuredGenerator { "import 'package:flutter/widgets.dart' show WidgetsFlutterBinding;", ); } + if (generatorOptions.useJni) { + indent.writeln("import 'package:jni/jni.dart';"); + final String jniFileImportName = path.basename(generatorOptions.dartOut!); + indent.writeln( + "import './${path.withoutExtension(jniFileImportName)}.jni.dart' as bridge;"); + } } @override @@ -172,12 +468,30 @@ class DartGenerator extends StructuredGenerator { indent.newln(); addDocumentationComments( indent, anEnum.documentationComments, _docCommentSpec); - indent.write('enum ${anEnum.name} '); - indent.addScoped('{', '}', () { + indent.addScoped('enum ${anEnum.name} {', '}', () { for (final EnumMember member in anEnum.members) { + final String separatorSymbol = + member == anEnum.members.last ? ';' : ','; addDocumentationComments( indent, member.documentationComments, _docCommentSpec); - indent.writeln('${member.name},'); + indent.writeln('${member.name}$separatorSymbol'); + } + + if (generatorOptions.useJni) { + final _JniType jniType = + _JniType.fromTypeDeclaration(anEnum.associatedType); + indent.newln(); + indent.writeScoped('${jniType.jniName} toJni() {', '}', () { + indent.writeln('return ${jniType.jniName}.Companion.ofRaw(index)!;'); + }); + + indent.newln(); + indent.writeScoped( + 'static ${anEnum.name}? fromJni(${jniType.jniName}? jniEnum) {', + '}', () { + indent.writeln( + 'return jniEnum == null ? null : ${anEnum.name}.values[jniEnum.getRaw()];'); + }); } }); } @@ -258,17 +572,6 @@ class DartGenerator extends StructuredGenerator { }); } - void _writeToList(Indent indent, Class classDefinition) { - indent.writeScoped('List _toList() {', '}', () { - indent.writeScoped('return [', '];', () { - for (final NamedType field - in getFieldsInSerializationOrder(classDefinition)) { - indent.writeln('${field.name},'); - } - }); - }); - } - @override void writeClassEncode( InternalDartOptions generatorOptions, @@ -277,6 +580,10 @@ class DartGenerator extends StructuredGenerator { Class classDefinition, { required String dartPackageName, }) { + if (generatorOptions.useJni) { + _writeToJni(indent, classDefinition); + indent.newln(); + } indent.write('Object encode() '); indent.addScoped('{', '}', () { indent.write( @@ -285,6 +592,47 @@ class DartGenerator extends StructuredGenerator { }); } + void _writeToList(Indent indent, Class classDefinition) { + indent.writeScoped('List _toList() {', '}', () { + indent.writeScoped('return [', '];', () { + for (final NamedType field + in getFieldsInSerializationOrder(classDefinition)) { + indent.writeln('${field.name},'); + } + }); + }); + } + + void _writeToJni(Indent indent, Class classDefinition) { + indent.writeScoped('bridge.${classDefinition.name} toJni() {', '}', () { + indent.writeScoped('return bridge.${classDefinition.name} (', ');', () { + for (final NamedType field + in getFieldsInSerializationOrder(classDefinition)) { + final _JniType jniType = _JniType.fromTypeDeclaration(field.type); + indent.writeln( + '${jniType.getToJniCall(field, jniType, forceNonNull: true)},'); + } + }); + }); + } + + void _writeFromJni(Indent indent, Class classDefinition) { + indent.writeScoped( + 'static ${classDefinition.name}? fromJni(bridge.${classDefinition.name}? jniClass) {', + '}', () { + indent.writeScoped( + 'return jniClass == null ? null : ${classDefinition.name}(', ');', + () { + for (final NamedType field + in getFieldsInSerializationOrder(classDefinition)) { + final _JniType jniType = _JniType.fromTypeDeclaration(field.type); + indent.writeln( + '${field.name}: ${jniType.getToDartCall(field.type, varName: 'jniClass.${jniType.getJniGetterMethodName(field.name)}')},'); + } + }); + }); + } + @override void writeClassDecode( InternalDartOptions generatorOptions, @@ -293,6 +641,10 @@ class DartGenerator extends StructuredGenerator { Class classDefinition, { required String dartPackageName, }) { + if (generatorOptions.useJni) { + _writeFromJni(indent, classDefinition); + indent.newln(); + } void writeValueDecode(NamedType field, int index) { final String resultAt = 'result[$index]'; final String castCallPrefix = field.type.isNullable ? '?' : '!'; @@ -315,10 +667,8 @@ class DartGenerator extends StructuredGenerator { } } - indent.write( - 'static ${classDefinition.name} decode(Object result) ', - ); - indent.addScoped('{', '}', () { + indent.writeScoped( + 'static ${classDefinition.name} decode(Object result) {', '}', () { indent.writeln('result as List;'); indent.write('return ${classDefinition.name}'); indent.addScoped('(', ');', () { @@ -376,6 +726,12 @@ class DartGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { + if (generatorOptions.useJni && + !root.containsProxyApi && + !root.containsEventChannel && + !root.containsFlutterApi) { + return; + } void writeEncodeLogic( EnumeratedType customType, int nonSerializedClassCount) { indent.writeScoped('else if (value is ${customType.name}) {', '}', () { @@ -555,6 +911,86 @@ class DartGenerator extends StructuredGenerator { }); } + @override + void writeApis(InternalDartOptions generatorOptions, Root root, Indent indent, + {required String dartPackageName}) { + if (generatorOptions.useJni) { + indent.writeln( + "const String defaultInstanceName = 'PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u';"); + } + super.writeApis(generatorOptions, root, indent, + dartPackageName: dartPackageName); + } + + void _writeJniApi( + InternalDartOptions generatorOptions, + Root root, + Indent indent, + AstHostApi api, { + required String dartPackageName, + }) { + final String dartApiName = api.name; + final String jniApiRegistrarName = 'bridge.${dartApiName}Registrar'; + indent.newln(); + indent.writeScoped('class $dartApiName {', '}', () { + indent.format(''' + $dartApiName._withRegistrar($jniApiRegistrarName api) : _api = api; + + /// Returns instance of $dartApiName with specified [channelName] if one has been registered. + static $dartApiName? getInstance({String channelName = defaultInstanceName}) { + final $jniApiRegistrarName? link = + $jniApiRegistrarName().getInstance(JString.fromString(channelName)); + if (link == null) { + String nameString = 'named \$channelName'; + if (channelName == defaultInstanceName) { + nameString = 'with no name'; + } + final String error = 'No instance \$nameString has been registered.'; + throw ArgumentError(error); + } + final $dartApiName res = $dartApiName._withRegistrar(link); + return res; + } + + late final $jniApiRegistrarName _api; +'''); + for (final Method method in api.methods) { + indent.writeScoped( + '${method.isAsynchronous ? 'Future<' : ''}${_addGenericTypesNullable(method.returnType)}${method.isAsynchronous ? '>' : ''} ${method.name}(${_getMethodParameterSignature(method.parameters)}) ${method.isAsynchronous ? 'async ' : ''}{', + '}', () { + final _JniType returnType = + _JniType.fromTypeDeclaration(method.returnType); + final String methodCallReturnString = returnType.typeName == 'void' && + method.isAsynchronous + ? '' + : (!returnType.nonNullableNeedsUnwrapping && + !method.returnType.isNullable && + !method.isAsynchronous) + ? 'return ' + : 'final ${returnType.getApiCallReturnType(method)} res = '; + indent.writeln( + '$methodCallReturnString${method.isAsynchronous ? 'await ' : ''}_api.${method.name}(${_getJniMethodCallArguments(method.parameters)});'); + if ((method.returnType.isNullable || + method.isAsynchronous || + returnType.nonNullableNeedsUnwrapping) && + returnType.typeName != 'void') { + indent.writeln( + 'final ${returnType.typeName}${_getNullableSymbol(method.returnType)} dartTypeRes = ${returnType.getToDartCall(method.returnType, varName: 'res', forceConversion: method.isAsynchronous)};'); + indent.writeln('return dartTypeRes;'); + } + }); + indent.newln(); + } + }); + } + + String _getJniMethodCallArguments(Iterable parameters) { + return parameters.map((Parameter parameter) { + final _JniType jniType = _JniType.fromTypeDeclaration(parameter.type); + return jniType.getToJniCall(parameter, jniType); + }).join(', '); + } + /// Writes the code for host [Api], [api]. /// Example: /// class FooCodec extends StandardMessageCodec {...} @@ -580,6 +1016,11 @@ class DartGenerator extends StructuredGenerator { AstHostApi api, { required String dartPackageName, }) { + if (generatorOptions.useJni) { + _writeJniApi(generatorOptions, root, indent, api, + dartPackageName: dartPackageName); + return; + } indent.newln(); bool first = true; addDocumentationComments( @@ -1075,7 +1516,8 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; Indent indent, { required String dartPackageName, }) { - if (root.containsHostApi || root.containsProxyApi) { + if ((root.containsHostApi && !generatorOptions.useJni) || + root.containsProxyApi) { _writeCreateConnectionError(indent); } if (root.containsFlutterApi || @@ -1088,6 +1530,106 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; .any((NamedType field) => isCollectionType(field.type)))) { _writeDeepEquals(indent); } + if (generatorOptions.useJni) { + _writeJniCodec(indent, root); + } + } + + void _writeJniCodec(Indent indent, Root root) { + indent.newln(); + indent.format(''' +class _PigeonJniCodec { + static Object? readValue(JObject? value) { + if (value == null) { + return null; + } else if (value.isA(JLong.type)) { + return (value.as(JLong.type)).intValue(); + } else if (value.isA(JDouble.type)) { + return (value.as(JDouble.type)).doubleValue(); + } else if (value.isA(JString.type)) { + return (value.as(JString.type)).toDartString(); + } else if (value.isA(JBoolean.type)) { + return (value.as(JBoolean.type)).booleanValue(); + } else if (value.isA>(JList.type(JObject.type))) { + final JList list = (value.as(JList.type(JObject.type))); + final List res = []; + for (int i = 0; i < list.length; i++) { + res.add(readValue(list[i])); + } + return res; + } else if (value.isA>( + JMap.type(JObject.type, JObject.type))) { + final JMap map = + (value.as(JMap.type(JObject.type, JObject.type))); + final Map res = {}; + for (final MapEntry entry in map.entries) { + res[readValue(entry.key)] = readValue(entry.value); + } + return res; + ${root.classes.map((Class dataClass) { + final _JniType jniType = + _JniType.fromTypeDeclaration(dataClass.associatedType); + return ''' + } else if (value.isA<${jniType.jniName}>( + ${jniType.jniName}.type)) { + return ${jniType.typeName}.fromJni(value.as(${jniType.jniName}.type)); + '''; + }).join()} + } else { + throw ArgumentError.value(value); + } + } + + static JObject? writeValue(Object? value) { + if (value == null) { + return null; + } else if (value is bool) { + return JBoolean(value); + } else if (value is double) { + return JDouble(value); + } else if (value is int) { + return JLong(value); + } else if (value is String) { + return JString.fromString(value); + } else if (value is Uint8List) { + //TODO + return null; + } else if (value is Int32List) { + //TODO + return null; + } else if (value is Int64List) { + //TODO + return null; + } else if (value is Float64List) { + //TODO + return null; + } else if (value is List) { + final JList res = JList.array(JObject.type); + for (int i = 0; i < value.length; i++) { + res.add(writeValue(value[i])); + } + return res; + } else if (value is Map) { + final JMap res = + JMap.hash(JObject.type, JObject.type); + for (final MapEntry entry in value.entries) { + res[writeValue(entry.key)] = writeValue(entry.value); + } + return res; + ${root.classes.map((Class dataClass) { + final _JniType jniType = + _JniType.fromTypeDeclaration(dataClass.associatedType); + return ''' + } else if (value is ${jniType.typeName}) { + return value.toJni(); + '''; + }).join()} + } else { + throw ArgumentError.value(value); + } + } +} + '''); } /// Writes [wrapResponse] method. @@ -1222,15 +1764,10 @@ if (wrapped == null) { required bool addSuffixVariable, bool insideAsyncMethod = true, }) { - String sendArgument = 'null'; - if (parameters.isNotEmpty) { - final Iterable argExpressions = - indexMap(parameters, (int index, NamedType type) { - final String name = _getParameterName(index, type); - return name; - }); - sendArgument = '[${argExpressions.join(', ')}]'; - } + final String? arguments = _getArgumentsForMethodCall(parameters); + final String sendArgument = + arguments == null ? 'null' : '[$arguments]'; + final String channelSuffix = addSuffixVariable ? '\$$_suffixVarName' : ''; final String constOrFinal = addSuffixVariable ? 'final' : 'const'; indent.writeln( @@ -2343,7 +2880,7 @@ String _flattenTypeArguments(List args) { /// Creates the type declaration for use in Dart code from a [NamedType] making sure /// that type arguments are used for primitive generic types. -String _addGenericTypes(TypeDeclaration type) { +String _addGenericTypes(TypeDeclaration type, {bool useJni = false}) { final List typeArguments = type.typeArguments; switch (type.baseName) { case 'List': @@ -2355,13 +2892,16 @@ String _addGenericTypes(TypeDeclaration type) { ? 'Map' : 'Map<${_flattenTypeArguments(typeArguments)}>'; default: - return type.baseName; + return useJni + ? _JniType.fromTypeDeclaration(type).jniName + : type.baseName; } } -String _addGenericTypesNullable(TypeDeclaration type) { - final String genericType = _addGenericTypes(type); - return type.isNullable ? '$genericType?' : genericType; +String _addGenericTypesNullable(TypeDeclaration type, {bool useJni = false}) { + final String genericType = _addGenericTypes(type, useJni: useJni); + final String nullableSymbol = type.isNullable ? '?' : ''; + return '$genericType$nullableSymbol'; } /// Converts [inputPath] to a posix absolute path. @@ -2369,3 +2909,13 @@ String _posixify(String inputPath) { final path.Context context = path.Context(style: path.Style.posix); return context.fromUri(path.toUri(path.absolute(inputPath))); } + +String? _getArgumentsForMethodCall(Iterable parameters) { + if (parameters.isNotEmpty) { + return indexMap(parameters, (int index, NamedType type) { + final String name = _getParameterName(index, type); + return name; + }).join(', '); + } + return null; +} diff --git a/packages/pigeon/lib/src/kotlin/jnigen_yaml_generator.dart b/packages/pigeon/lib/src/kotlin/jnigen_yaml_generator.dart new file mode 100644 index 000000000000..242468ba5932 --- /dev/null +++ b/packages/pigeon/lib/src/kotlin/jnigen_yaml_generator.dart @@ -0,0 +1,81 @@ +// 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:path/path.dart' as path; + +import '../ast.dart'; +import '../dart/dart_generator.dart' show InternalDartOptions; +import '../generator.dart'; +import '../generator_tools.dart'; +import 'kotlin_generator.dart' show InternalKotlinOptions; + +/// Options for [JnigenYamlGenerator]. +class InternalJnigenYamlOptions extends InternalOptions { + /// Creates a [InternalJnigenYamlOptions]. + InternalJnigenYamlOptions( + this.dartOptions, + this.kotlinOptions, + this.basePath, + this.dartOut, + this.exampleAppDirectory, + ); + + /// Dart options. + final InternalDartOptions dartOptions; + + /// Kotlin options. + final InternalKotlinOptions kotlinOptions; + + /// A base path to be prepended to all provided output paths. + final String? basePath; + + /// Dart output path. + final String? dartOut; + + /// Android example app directory. + final String? exampleAppDirectory; +} + +/// Generator for jnigen yaml configuration file. +class JnigenYamlGenerator extends Generator { + @override + void generate( + InternalJnigenYamlOptions generatorOptions, Root root, StringSink sink, + {required String dartPackageName}) { + final Indent indent = Indent(sink); + + indent.format(''' + android_sdk_config: + add_gradle_deps: true + android_example: '${generatorOptions.exampleAppDirectory ?? ''}' + + # source_path: + # - 'android/src/main/java' + + summarizer: + backend: asm + + output: + dart: + path: ${path.posix.join(generatorOptions.basePath ?? '', path.withoutExtension(generatorOptions.dartOut ?? ''))}.jni.dart + structure: single_file + + log_level: all + '''); + indent.writeScoped('classes:', '', () { + for (final Api api in root.apis) { + if (api is AstHostApi) { + indent.writeln("- '${api.name}'"); + indent.writeln("- '${api.name}Registrar'"); + } + } + for (final Class dataClass in root.classes) { + indent.writeln("- '${dataClass.name}'"); + } + for (final Enum enumType in root.enums) { + indent.writeln("- '${enumType.name}'"); + } + }); + } +} diff --git a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart index f64dacae70bb..b4c2b88f3330 100644 --- a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart +++ b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart @@ -41,6 +41,8 @@ class KotlinOptions { const KotlinOptions({ this.package, this.copyrightHeader, + this.useJni = false, + this.exampleAppDirectory, this.errorClassName, this.includeErrorClass = true, this.fileSpecificClassNameComponent, @@ -52,6 +54,12 @@ class KotlinOptions { /// A copyright header that will get prepended to generated code. final Iterable? copyrightHeader; + /// Whether to use Jni when possible. + final bool useJni; + + /// The directory that the example app exists in, this is required for Jni APIs. + final String? exampleAppDirectory; + /// The name of the error class used for passing custom error parameters. final String? errorClassName; @@ -69,6 +77,8 @@ class KotlinOptions { static KotlinOptions fromMap(Map map) { return KotlinOptions( package: map['package'] as String?, + useJni: map['useJni'] as bool? ?? false, + exampleAppDirectory: map['exampleAppDirectory'] as String?, copyrightHeader: map['copyrightHeader'] as Iterable?, errorClassName: map['errorClassName'] as String?, includeErrorClass: map['includeErrorClass'] as bool? ?? true, @@ -82,6 +92,9 @@ class KotlinOptions { Map toMap() { final Map result = { if (package != null) 'package': package!, + if (useJni) 'useJni': useJni, + if (exampleAppDirectory != null) + 'exampleAppDirectory': exampleAppDirectory!, if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, if (errorClassName != null) 'errorClassName': errorClassName!, 'includeErrorClass': includeErrorClass, @@ -107,6 +120,8 @@ class InternalKotlinOptions extends InternalOptions { this.copyrightHeader, this.errorClassName, this.includeErrorClass = true, + this.useJni = false, + this.exampleAppDirectory, this.fileSpecificClassNameComponent, }); @@ -119,6 +134,8 @@ class InternalKotlinOptions extends InternalOptions { copyrightHeader = options.copyrightHeader ?? copyrightHeader, errorClassName = options.errorClassName, includeErrorClass = options.includeErrorClass, + useJni = options.useJni, + exampleAppDirectory = options.exampleAppDirectory, fileSpecificClassNameComponent = options.fileSpecificClassNameComponent ?? kotlinOut.split('/').lastOrNull?.split('.').first; @@ -141,6 +158,12 @@ class InternalKotlinOptions extends InternalOptions { /// Kotlin file in the same directory. final bool includeErrorClass; + /// Whether to use Jni for generating kotlin interop code. + final bool useJni; + + /// The directory that the example app exists in, this is required for Jni APIs. + final String? exampleAppDirectory; + /// A String to augment class names to avoid cross file collisions. final String? fileSpecificClassNameComponent; } @@ -202,11 +225,14 @@ class KotlinGenerator extends StructuredGenerator { required String dartPackageName, }) { indent.newln(); - if (generatorOptions.package != null) { + if (generatorOptions.package != null && !generatorOptions.useJni) { indent.writeln('package ${generatorOptions.package}'); } indent.newln(); indent.writeln('import android.util.Log'); + if (generatorOptions.useJni) { + indent.writeln('import androidx.annotation.Keep'); + } indent.writeln('import io.flutter.plugin.common.BasicMessageChannel'); indent.writeln('import io.flutter.plugin.common.BinaryMessenger'); indent.writeln('import io.flutter.plugin.common.EventChannel'); @@ -448,6 +474,12 @@ class KotlinGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { + if (generatorOptions.useJni && + !root.containsEventChannel && + !root.containsFlutterApi && + !root.containsProxyApi) { + return; + } final List enumeratedTypes = getEnumeratedTypes(root, excludeSealedClasses: true).toList(); @@ -683,6 +715,86 @@ if (wrapped == null) { }); } + void _writeJniApi( + InternalKotlinOptions generatorOptions, + Root root, + Indent indent, + AstHostApi api, { + required String dartPackageName, + }) { + indent.writeln( + 'val ${api.name}Instances: MutableMap = mutableMapOf()'); + indent.writeln('@Keep'); + indent.writeScoped('abstract class ${api.name} {', '}', () { + for (final Method method in api.methods) { + _writeMethodDeclaration( + indent, + name: method.name, + documentationComments: method.documentationComments, + returnType: method.returnType, + parameters: method.parameters, + isAsynchronous: method.isAsynchronous, + useJni: true, + isAbstract: true, + ); + } + }); + + indent.writeln('@Keep'); + indent.writeScoped('class ${api.name}Registrar : ${api.name}() {', '}', () { + indent.writeln('var api: ${api.name}? = null'); + + indent.writeScoped('fun register(', '):', () { + indent.writeln('api: ${api.name},'); + indent.writeln( + 'name: String = "PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u"'); + }, addTrailingNewline: false); + indent.writeScoped(' ${api.name}Registrar {', '}', () { + indent.writeln('this.api = api'); + indent.writeln('${api.name}Instances[name] = this'); + indent.writeln('return this'); + }); + + indent.writeln('@Keep'); + indent.writeScoped( + 'fun getInstance(name: String): ${api.name}Registrar? {', '}', () { + indent.writeln('return ${api.name}Instances[name]'); + }); + + for (final Method method in api.methods) { + _writeMethodDeclaration( + indent, + name: method.name, + documentationComments: method.documentationComments, + returnType: method.returnType, + parameters: method.parameters, + isAsynchronous: method.isAsynchronous, + isOverride: true, + useJni: true, + ); + final String argNames = + method.parameters.map((Parameter arg) => arg.name).join(', '); + indent.addScoped(' {', '}', () { + indent.writeScoped('api?.let {', '}', () { + indent.writeScoped( + 'try {', + '}', + () { + indent.writeln('return api!!.${method.name}($argNames)'); + }, + addTrailingNewline: false, + ); + indent.addScoped(' catch (e: Exception) {', '}', () { + indent.writeln('throw e'); + }); + }); + + indent.writeln('error("${api.name} has not been set")'); + }); + } + }); + } + /// Write the kotlin code that represents a host [Api], [api]. /// Example: /// interface Foo { @@ -700,6 +812,11 @@ if (wrapped == null) { AstHostApi api, { required String dartPackageName, }) { + if (generatorOptions.useJni) { + _writeJniApi(generatorOptions, root, indent, api, + dartPackageName: dartPackageName); + return; + } final String apiName = api.name; const List generatedMessages = [ @@ -1293,7 +1410,8 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? Indent indent, { required String dartPackageName, }) { - if (root.containsHostApi || root.containsProxyApi) { + if ((root.containsHostApi && !generatorOptions.useJni) || + root.containsProxyApi) { _writeWrapResult(indent); _writeWrapError(generatorOptions, indent); } @@ -1320,6 +1438,8 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? bool isAsynchronous = false, bool isOpen = false, bool isAbstract = false, + bool isOverride = false, + bool useJni = false, String Function(int index, NamedType type) getArgumentName = _getArgumentName, }) { @@ -1352,20 +1472,25 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? } final String openKeyword = isOpen ? 'open ' : ''; - final String abstractKeyword = isAbstract ? 'abstract ' : ''; - - if (isAsynchronous) { + final String inheritanceKeyword = isAbstract + ? 'abstract ' + : isOverride + ? 'override ' + : ''; + final String suspendKeyword = isAsynchronous && useJni ? 'suspend ' : ''; + + if (isAsynchronous && !useJni) { argSignature.add('callback: (Result<$resultType>) -> Unit'); indent.writeln( - '$openKeyword${abstractKeyword}fun $name(${argSignature.join(', ')})', + '$openKeyword$inheritanceKeyword${suspendKeyword}fun $name(${argSignature.join(', ')})', ); } else if (returnType.isVoid) { indent.writeln( - '$openKeyword${abstractKeyword}fun $name(${argSignature.join(', ')})', + '$openKeyword$inheritanceKeyword${suspendKeyword}fun $name(${argSignature.join(', ')})', ); } else { indent.writeln( - '$openKeyword${abstractKeyword}fun $name(${argSignature.join(', ')}): $returnTypeString', + '$openKeyword$inheritanceKeyword${suspendKeyword}fun $name(${argSignature.join(', ')}): $returnTypeString', ); } } diff --git a/packages/pigeon/lib/src/pigeon_lib.dart b/packages/pigeon/lib/src/pigeon_lib.dart index a60659ac3c58..fc0643def497 100644 --- a/packages/pigeon/lib/src/pigeon_lib.dart +++ b/packages/pigeon/lib/src/pigeon_lib.dart @@ -658,6 +658,7 @@ ${_argParser.usage}'''; JavaGeneratorAdapter(), SwiftGeneratorAdapter(), KotlinGeneratorAdapter(), + JnigenYamlGeneratorAdapter(), CppGeneratorAdapter(), GObjectGeneratorAdapter(), DartTestGeneratorAdapter(), diff --git a/packages/pigeon/lib/src/pigeon_lib_internal.dart b/packages/pigeon/lib/src/pigeon_lib_internal.dart index 842fbe7c13da..128d2d37a182 100644 --- a/packages/pigeon/lib/src/pigeon_lib_internal.dart +++ b/packages/pigeon/lib/src/pigeon_lib_internal.dart @@ -23,6 +23,7 @@ import 'dart/dart_generator.dart'; import 'generator_tools.dart'; import 'gobject/gobject_generator.dart'; import 'java/java_generator.dart'; +import 'kotlin/jnigen_yaml_generator.dart'; import 'kotlin/kotlin_generator.dart'; import 'objc/objc_generator.dart'; import 'pigeon_lib.dart'; @@ -619,6 +620,51 @@ class KotlinGeneratorAdapter implements GeneratorAdapter { List validate(InternalPigeonOptions options, Root root) => []; } +/// A [GeneratorAdapter] that generates JnigenYaml source code. +class JnigenYamlGeneratorAdapter implements GeneratorAdapter { + /// Constructor for [JnigenYamlGeneratorAdapter]. + JnigenYamlGeneratorAdapter( + {this.fileTypeList = const [FileType.na]}); + + @override + List fileTypeList; + + @override + void generate(StringSink sink, InternalPigeonOptions options, Root root, + FileType fileType) { + if (options.kotlinOptions == null) { + return; + } + final JnigenYamlGenerator generator = JnigenYamlGenerator(); + final InternalJnigenYamlOptions jnigenYamlOptions = + InternalJnigenYamlOptions( + options.dartOptions!, + options.kotlinOptions!, + options.basePath, + options.dartOptions?.dartOut, + options.kotlinOptions!.exampleAppDirectory, + ); + + generator.generate( + jnigenYamlOptions, + root, + sink, + dartPackageName: options.dartPackageName, + ); + } + + @override + IOSink? shouldGenerate(InternalPigeonOptions options, FileType _) => + options.kotlinOptions?.kotlinOut != null && + (options.kotlinOptions?.useJni ?? false) + ? _openSink('jnigen.yaml', + basePath: options.kotlinOptions?.exampleAppDirectory ?? '') + : null; + + @override + List validate(InternalPigeonOptions options, Root root) => []; +} + dart_ast.Annotation? _findMetadata( dart_ast.NodeList metadata, String query) { final Iterable annotations = metadata diff --git a/packages/pigeon/pigeons/jni_tests.dart b/packages/pigeon/pigeons/jni_tests.dart new file mode 100644 index 000000000000..291eb950ba8e --- /dev/null +++ b/packages/pigeon/pigeons/jni_tests.dart @@ -0,0 +1,102 @@ +// 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'; + +@ConfigurePigeon(PigeonOptions( + dartOptions: DartOptions(useJni: true), + kotlinOptions: KotlinOptions(useJni: true), +)) +enum SomeEnum { + value1, + value2, + value3, +} + +class SomeTypes { + const SomeTypes( + this.aString, + this.anInt, + this.aDouble, + this.aBool, + this.anObject, + this.anEnum, + ); + final String aString; + final int anInt; + final double aDouble; + final bool aBool; + final Object anObject; + final SomeEnum anEnum; +} + +class SomeNullableTypes { + String? aString; + int? anInt; + double? aDouble; + bool? aBool; + Object? anObject; + SomeEnum? anEnum; +} + +@HostApi() +abstract class JniMessageApi { + void doNothing(); + String echoString(String request); + int echoInt(int request); + double echoDouble(double request); + bool echoBool(bool request); + Object echoObj(Object request); + SomeTypes sendSomeTypes(SomeTypes someTypes); + SomeEnum sendSomeEnum(SomeEnum anEnum); +} + +@HostApi() +abstract class JniMessageApiNullable { + String? echoString(String? request); + int? echoInt(int? request); + double? echoDouble(double? request); + bool? echoBool(bool? request); + Object? echoObj(Object? request); + SomeNullableTypes? sendSomeNullableTypes(SomeNullableTypes? someTypes); + SomeEnum? sendSomeEnum(SomeEnum? anEnum); +} + +@HostApi() +abstract class JniMessageApiAsync { + @async + void doNothing(); + @async + String echoString(String request); + @async + int echoInt(int request); + @async + double echoDouble(double request); + @async + bool echoBool(bool request); + @async + Object echoObj(Object request); + @async + SomeTypes sendSomeTypes(SomeTypes someTypes); + @async + SomeEnum sendSomeEnum(SomeEnum anEnum); +} + +@HostApi() +abstract class JniMessageApiNullableAsync { + @async + String? echoString(String? request); + @async + int? echoInt(int? request); + @async + double? echoDouble(double? request); + @async + bool? echoBool(bool? request); + @async + Object? echoObj(Object? request); + @async + SomeNullableTypes? sendSomeNullableTypes(SomeNullableTypes? someTypes); + @async + SomeEnum? sendSomeEnum(SomeEnum? anEnum); +} diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/example_app.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/example_app.dart index 31075ae532f6..5af09eec9a7d 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/example_app.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/example_app.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'generated.dart'; +import 'src/generated/jni_tests.gen.dart'; void main() { runApp(const ExampleApp()); @@ -39,6 +40,18 @@ class _ExampleAppState extends State { // Make a single trivial call just to validate that everything is wired // up. await api.noop(); + final JniMessageApi? jniMessage = JniMessageApi.getInstance(); + print('before sendSomeTypes'); + final SomeTypes toSend = SomeTypes( + aString: 'hi', + anInt: 5, + aDouble: 5.0, + aBool: false, + anObject: 'obj', + anEnum: SomeEnum.value2, + ); + final SomeTypes sync = jniMessage!.sendSomeTypes(toSend); + print(sync); } catch (e) { setState(() { status = 'Failed: $e'; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart index 48b495dd6a33..37282590cf88 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart @@ -12,6 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'generated.dart'; +import 'src/generated/jni_tests.gen.dart'; import 'test_types.dart'; /// Possible host languages that test can target. @@ -45,6 +46,113 @@ const Set proxyApiSupportedLanguages = { void runPigeonIntegrationTests(TargetGenerator targetGenerator) { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + testWidgets('jni', (WidgetTester _) async { + final JniMessageApi? jniMessage = JniMessageApi.getInstance(); + expect(jniMessage, isNotNull); + expect(jniMessage!.echoString('hello'), 'hello'); + final SomeTypes toSend = SomeTypes( + aString: 'hi', + anInt: 5, + aDouble: 5.0, + aBool: false, + anObject: 'obj', + anEnum: SomeEnum.value2, + ); + final SomeTypes sync = jniMessage.sendSomeTypes(toSend); + expect(sync, toSend); + expect(jniMessage.echoBool(true), true); + expect(jniMessage.echoBool(false), false); + expect(jniMessage.echoDouble(2.0), 2.0); + expect(jniMessage.echoInt(2), 2); + expect(jniMessage.echoString('hello'), 'hello'); + expect(jniMessage.echoObj('hello'), 'hello'); + expect(jniMessage.echoObj(sync), sync); + expect(jniMessage.sendSomeEnum(SomeEnum.value2), SomeEnum.value2); + //nullable + final JniMessageApiNullable? jniMessageNullable = + JniMessageApiNullable.getInstance(); + expect(jniMessageNullable, isNotNull); + expect(jniMessageNullable!.echoString('hello'), 'hello'); + expect(jniMessageNullable.echoString(null), null); + final SomeNullableTypes? syncNullable = + jniMessageNullable.sendSomeNullableTypes(SomeNullableTypes()); + expect(syncNullable!.aString, null); + expect(syncNullable.anInt, null); + expect(syncNullable.aDouble, null); + expect(syncNullable.aBool, null); + expect(syncNullable.anObject, null); + final SomeNullableTypes? syncNull = + jniMessageNullable.sendSomeNullableTypes(null); + expect(syncNull, null); + expect(jniMessageNullable.echoBool(true), true); + expect(jniMessageNullable.echoBool(false), false); + expect(jniMessageNullable.echoDouble(2.0), 2.0); + expect(jniMessageNullable.echoInt(2), 2); + expect(jniMessageNullable.echoString('hello'), 'hello'); + expect(jniMessageNullable.echoObj('hello'), 'hello'); + expect(jniMessageNullable.echoObj(syncNullable), syncNullable); + expect(jniMessageNullable.sendSomeEnum(SomeEnum.value3), SomeEnum.value3); + expect(jniMessageNullable.echoBool(null), null); + expect(jniMessageNullable.echoDouble(null), null); + expect(jniMessageNullable.echoInt(null), null); + expect(jniMessageNullable.echoString(null), null); + expect(jniMessageNullable.echoObj(null), null); + //async + final JniMessageApiAsync? jniMessageAsync = + JniMessageApiAsync.getInstance(); + + final SomeTypes nonSync = await jniMessageAsync!.sendSomeTypes(toSend); + expect(nonSync, toSend); + expect(await jniMessageAsync.echoBool(true), true); + expect(await jniMessageAsync.echoBool(false), false); + expect(await jniMessageAsync.echoDouble(2.0), 2.0); + expect(await jniMessageAsync.echoInt(2), 2); + expect(await jniMessageAsync.echoString('hello'), 'hello'); + expect(await jniMessageAsync.echoObj('hello'), 'hello'); + expect(await jniMessageAsync.echoObj(sync), sync); + expect( + await jniMessageAsync.sendSomeEnum(SomeEnum.value3), SomeEnum.value3); + //nullable async + final JniMessageApiNullableAsync? jniMessageNullableAsync = + JniMessageApiNullableAsync.getInstance(); + expect(jniMessageNullableAsync, isNotNull); + expect(await jniMessageNullableAsync!.echoString('hello'), 'hello'); + expect(await jniMessageNullableAsync.echoString(null), null); + final SomeNullableTypes? syncNullableAsync = await jniMessageNullableAsync + .sendSomeNullableTypes(SomeNullableTypes()); + expect(syncNullableAsync!.aString, null); + expect(syncNullableAsync.anInt, null); + expect(syncNullableAsync.aDouble, null); + expect(syncNullableAsync.aBool, null); + expect(syncNullableAsync.anObject, null); + final SomeNullableTypes? syncNullAsync = + await jniMessageNullableAsync.sendSomeNullableTypes(null); + expect(syncNull, null); + expect(await jniMessageNullableAsync.echoBool(true), true); + expect(await jniMessageNullableAsync.echoBool(false), false); + expect(await jniMessageNullableAsync.echoDouble(2.0), 2.0); + expect(await jniMessageNullableAsync.echoInt(2), 2); + expect(await jniMessageNullableAsync.echoString('hello'), 'hello'); + expect(await jniMessageNullableAsync.echoObj('hello'), 'hello'); + expect(await jniMessageNullableAsync.echoObj(syncNullable), syncNullable); + expect(await jniMessageNullableAsync.sendSomeEnum(SomeEnum.value3), + SomeEnum.value3); + expect(await jniMessageNullableAsync.echoBool(null), null); + expect(await jniMessageNullableAsync.echoDouble(null), null); + expect(await jniMessageNullableAsync.echoInt(null), null); + expect(await jniMessageNullableAsync.echoString(null), null); + expect(await jniMessageNullableAsync.echoObj(null), null); + //named + final JniMessageApi? jniMessageNamed = + JniMessageApi.getInstance(channelName: 'name'); + final JniMessageApiAsync? jniMessageAsyncNamed = + JniMessageApiAsync.getInstance(channelName: 'name'); + expect(jniMessageNamed, isNotNull); + expect(jniMessageNamed!.echoString('hello'), 'hello1'); + expect(await jniMessageAsync.echoInt(5), 5); + expect(await jniMessageAsyncNamed!.echoInt(5), 6); + }, skip: targetGenerator != TargetGenerator.kotlin); + group('Host sync API tests', () { testWidgets('basic void->void call works', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); 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 46be9723deb1..5ffccdbb8708 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 @@ -51,11 +51,11 @@ enum AnEnum { two, three, fortyTwo, - fourHundredTwentyTwo, + fourHundredTwentyTwo; } enum AnotherEnum { - justInCase, + justInCase; } class UnusedClass { diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart index 290a812f7570..9d1d11656dca 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart @@ -42,7 +42,7 @@ enum EnumState { Error, /// This comment is to test enum member (SnakeCase) documentation comments. - SnakeCase, + SnakeCase; } /// This comment is to test class documentation comments. diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart index 51e63738aae9..99aaa0115919 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart @@ -33,11 +33,11 @@ enum EventEnum { two, three, fortyTwo, - fourHundredTwentyTwo, + fourHundredTwentyTwo; } enum AnotherEventEnum { - justInCase, + justInCase; } /// A class containing all supported nullable types. diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.dart new file mode 100644 index 000000000000..537f0fddc9bd --- /dev/null +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.dart @@ -0,0 +1,592 @@ +// 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. +// +// Autogenerated from Pigeon, 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, no_leading_underscores_for_local_identifiers + +import 'dart:async'; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; + +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; +import 'package:flutter/services.dart'; +import 'package:jni/jni.dart'; +import './jni_tests.gen.jni.dart' as bridge; + +class _PigeonJniCodec { + static Object? readValue(JObject? value) { + if (value == null) { + return null; + } else if (value.isA(JLong.type)) { + return (value.as(JLong.type)).intValue(); + } else if (value.isA(JDouble.type)) { + return (value.as(JDouble.type)).doubleValue(); + } else if (value.isA(JString.type)) { + return (value.as(JString.type)).toDartString(); + } else if (value.isA(JBoolean.type)) { + return (value.as(JBoolean.type)).booleanValue(); + } else if (value.isA>(JList.type(JObject.type))) { + final JList list = (value.as(JList.type(JObject.type))); + final List res = []; + for (int i = 0; i < list.length; i++) { + res.add(readValue(list[i])); + } + return res; + } else if (value.isA>( + JMap.type(JObject.type, JObject.type))) { + final JMap map = + (value.as(JMap.type(JObject.type, JObject.type))); + final Map res = {}; + for (final MapEntry entry in map.entries) { + res[readValue(entry.key)] = readValue(entry.value); + } + return res; + } else if (value.isA(bridge.SomeTypes.type)) { + return SomeTypes.fromJni(value.as(bridge.SomeTypes.type)); + } else if (value + .isA(bridge.SomeNullableTypes.type)) { + return SomeNullableTypes.fromJni(value.as(bridge.SomeNullableTypes.type)); + } else { + throw ArgumentError.value(value); + } + } + + static JObject? writeValue(Object? value) { + if (value == null) { + return null; + } else if (value is bool) { + return JBoolean(value); + } else if (value is double) { + return JDouble(value); + } else if (value is int) { + return JLong(value); + } else if (value is String) { + return JString.fromString(value); + } else if (value is Uint8List) { + //TODO + return null; + } else if (value is Int32List) { + //TODO + return null; + } else if (value is Int64List) { + //TODO + return null; + } else if (value is Float64List) { + //TODO + return null; + } else if (value is List) { + final JList res = JList.array(JObject.type); + for (int i = 0; i < value.length; i++) { + res.add(writeValue(value[i])); + } + return res; + } else if (value is Map) { + final JMap res = + JMap.hash(JObject.type, JObject.type); + for (final MapEntry entry in value.entries) { + res[writeValue(entry.key)] = writeValue(entry.value); + } + return res; + } else if (value is SomeTypes) { + return value.toJni(); + } else if (value is SomeNullableTypes) { + return value.toJni(); + } else { + throw ArgumentError.value(value); + } + } +} + +enum SomeEnum { + value1, + value2, + value3; + + bridge.SomeEnum toJni() { + return bridge.SomeEnum.Companion.ofRaw(index)!; + } + + static SomeEnum? fromJni(bridge.SomeEnum? jniEnum) { + return jniEnum == null ? null : SomeEnum.values[jniEnum.getRaw()]; + } +} + +class SomeTypes { + SomeTypes({ + required this.aString, + required this.anInt, + required this.aDouble, + required this.aBool, + required this.anObject, + required this.anEnum, + }); + + String aString; + + int anInt; + + double aDouble; + + bool aBool; + + Object anObject; + + SomeEnum anEnum; + + List _toList() { + return [ + aString, + anInt, + aDouble, + aBool, + anObject, + anEnum, + ]; + } + + bridge.SomeTypes toJni() { + return bridge.SomeTypes( + JString.fromString(aString), + anInt, + aDouble, + aBool, + _PigeonJniCodec.writeValue(anObject)!, + anEnum.toJni(), + ); + } + + Object encode() { + return _toList(); + } + + static SomeTypes? fromJni(bridge.SomeTypes? jniClass) { + return jniClass == null + ? null + : SomeTypes( + aString: jniClass.getAString().toDartString(releaseOriginal: true), + anInt: jniClass.getAnInt(), + aDouble: jniClass.getADouble(), + aBool: jniClass.getABool(), + anObject: _PigeonJniCodec.readValue(jniClass.getAnObject())!, + anEnum: SomeEnum.fromJni(jniClass.getAnEnum())!, + ); + } + + static SomeTypes decode(Object result) { + result as List; + return SomeTypes( + aString: result[0]! as String, + anInt: result[1]! as int, + aDouble: result[2]! as double, + aBool: result[3]! as bool, + anObject: result[4]!, + anEnum: result[5]! as SomeEnum, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SomeTypes || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return aString == other.aString && + anInt == other.anInt && + aDouble == other.aDouble && + aBool == other.aBool && + anObject == other.anObject && + anEnum == other.anEnum; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + +class SomeNullableTypes { + SomeNullableTypes({ + this.aString, + this.anInt, + this.aDouble, + this.aBool, + this.anObject, + this.anEnum, + }); + + String? aString; + + int? anInt; + + double? aDouble; + + bool? aBool; + + Object? anObject; + + SomeEnum? anEnum; + + List _toList() { + return [ + aString, + anInt, + aDouble, + aBool, + anObject, + anEnum, + ]; + } + + bridge.SomeNullableTypes toJni() { + return bridge.SomeNullableTypes( + aString == null ? null : JString.fromString(aString!), + anInt == null ? null : JLong(anInt!), + aDouble == null ? null : JDouble(aDouble!), + aBool == null ? null : JBoolean(aBool!), + _PigeonJniCodec.writeValue(anObject), + anEnum == null ? null : anEnum!.toJni(), + ); + } + + Object encode() { + return _toList(); + } + + static SomeNullableTypes? fromJni(bridge.SomeNullableTypes? jniClass) { + return jniClass == null + ? null + : SomeNullableTypes( + aString: jniClass.getAString()?.toDartString(releaseOriginal: true), + anInt: jniClass.getAnInt()?.intValue(releaseOriginal: true), + aDouble: jniClass.getADouble()?.doubleValue(releaseOriginal: true), + aBool: jniClass.getABool()?.booleanValue(releaseOriginal: true), + anObject: _PigeonJniCodec.readValue(jniClass.getAnObject()), + anEnum: SomeEnum.fromJni(jniClass.getAnEnum()), + ); + } + + static SomeNullableTypes decode(Object result) { + result as List; + return SomeNullableTypes( + aString: result[0] as String?, + anInt: result[1] as int?, + aDouble: result[2] as double?, + aBool: result[3] as bool?, + anObject: result[4], + anEnum: result[5] as SomeEnum?, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SomeNullableTypes || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return aString == other.aString && + anInt == other.anInt && + aDouble == other.aDouble && + aBool == other.aBool && + anObject == other.anObject && + anEnum == other.anEnum; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + +const String defaultInstanceName = + 'PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u'; + +class JniMessageApi { + JniMessageApi._withRegistrar(bridge.JniMessageApiRegistrar api) : _api = api; + + /// Returns instance of JniMessageApi with specified [channelName] if one has been registered. + static JniMessageApi? getInstance( + {String channelName = defaultInstanceName}) { + final bridge.JniMessageApiRegistrar? link = bridge.JniMessageApiRegistrar() + .getInstance(JString.fromString(channelName)); + if (link == null) { + String nameString = 'named $channelName'; + if (channelName == defaultInstanceName) { + nameString = 'with no name'; + } + final String error = 'No instance $nameString has been registered.'; + throw ArgumentError(error); + } + final JniMessageApi res = JniMessageApi._withRegistrar(link); + return res; + } + + late final bridge.JniMessageApiRegistrar _api; + + void doNothing() { + return _api.doNothing(); + } + + String echoString(String request) { + final JString res = _api.echoString(JString.fromString(request)); + final String dartTypeRes = res.toDartString(releaseOriginal: true); + return dartTypeRes; + } + + int echoInt(int request) { + return _api.echoInt(request); + } + + double echoDouble(double request) { + return _api.echoDouble(request); + } + + bool echoBool(bool request) { + return _api.echoBool(request); + } + + Object echoObj(Object request) { + final JObject res = _api.echoObj(_PigeonJniCodec.writeValue(request)!); + final Object dartTypeRes = _PigeonJniCodec.readValue(res)!; + return dartTypeRes; + } + + SomeTypes sendSomeTypes(SomeTypes someTypes) { + final bridge.SomeTypes res = _api.sendSomeTypes(someTypes.toJni()); + final SomeTypes dartTypeRes = SomeTypes.fromJni(res)!; + return dartTypeRes; + } + + SomeEnum sendSomeEnum(SomeEnum anEnum) { + final bridge.SomeEnum res = _api.sendSomeEnum(anEnum.toJni()); + final SomeEnum dartTypeRes = SomeEnum.fromJni(res)!; + return dartTypeRes; + } +} + +class JniMessageApiNullable { + JniMessageApiNullable._withRegistrar( + bridge.JniMessageApiNullableRegistrar api) + : _api = api; + + /// Returns instance of JniMessageApiNullable with specified [channelName] if one has been registered. + static JniMessageApiNullable? getInstance( + {String channelName = defaultInstanceName}) { + final bridge.JniMessageApiNullableRegistrar? link = + bridge.JniMessageApiNullableRegistrar() + .getInstance(JString.fromString(channelName)); + if (link == null) { + String nameString = 'named $channelName'; + if (channelName == defaultInstanceName) { + nameString = 'with no name'; + } + final String error = 'No instance $nameString has been registered.'; + throw ArgumentError(error); + } + final JniMessageApiNullable res = + JniMessageApiNullable._withRegistrar(link); + return res; + } + + late final bridge.JniMessageApiNullableRegistrar _api; + + String? echoString(String? request) { + final JString? res = + _api.echoString(request == null ? null : JString.fromString(request)); + final String? dartTypeRes = res?.toDartString(releaseOriginal: true); + return dartTypeRes; + } + + int? echoInt(int? request) { + final JLong? res = _api.echoInt(request == null ? null : JLong(request)); + final int? dartTypeRes = res?.intValue(releaseOriginal: true); + return dartTypeRes; + } + + double? echoDouble(double? request) { + final JDouble? res = + _api.echoDouble(request == null ? null : JDouble(request)); + final double? dartTypeRes = res?.doubleValue(releaseOriginal: true); + return dartTypeRes; + } + + bool? echoBool(bool? request) { + final JBoolean? res = + _api.echoBool(request == null ? null : JBoolean(request)); + final bool? dartTypeRes = res?.booleanValue(releaseOriginal: true); + return dartTypeRes; + } + + Object? echoObj(Object? request) { + final JObject? res = _api.echoObj(_PigeonJniCodec.writeValue(request)); + final Object? dartTypeRes = _PigeonJniCodec.readValue(res); + return dartTypeRes; + } + + SomeNullableTypes? sendSomeNullableTypes(SomeNullableTypes? someTypes) { + final bridge.SomeNullableTypes? res = _api + .sendSomeNullableTypes(someTypes == null ? null : someTypes.toJni()); + final SomeNullableTypes? dartTypeRes = SomeNullableTypes.fromJni(res); + return dartTypeRes; + } + + SomeEnum? sendSomeEnum(SomeEnum? anEnum) { + final bridge.SomeEnum? res = + _api.sendSomeEnum(anEnum == null ? null : anEnum.toJni()); + final SomeEnum? dartTypeRes = SomeEnum.fromJni(res); + return dartTypeRes; + } +} + +class JniMessageApiAsync { + JniMessageApiAsync._withRegistrar(bridge.JniMessageApiAsyncRegistrar api) + : _api = api; + + /// Returns instance of JniMessageApiAsync with specified [channelName] if one has been registered. + static JniMessageApiAsync? getInstance( + {String channelName = defaultInstanceName}) { + final bridge.JniMessageApiAsyncRegistrar? link = + bridge.JniMessageApiAsyncRegistrar() + .getInstance(JString.fromString(channelName)); + if (link == null) { + String nameString = 'named $channelName'; + if (channelName == defaultInstanceName) { + nameString = 'with no name'; + } + final String error = 'No instance $nameString has been registered.'; + throw ArgumentError(error); + } + final JniMessageApiAsync res = JniMessageApiAsync._withRegistrar(link); + return res; + } + + late final bridge.JniMessageApiAsyncRegistrar _api; + + Future doNothing() async { + await _api.doNothing(); + } + + Future echoString(String request) async { + final JString res = await _api.echoString(JString.fromString(request)); + final String dartTypeRes = res.toDartString(releaseOriginal: true); + return dartTypeRes; + } + + Future echoInt(int request) async { + final JLong res = await _api.echoInt(request); + final int dartTypeRes = res.intValue(releaseOriginal: true); + return dartTypeRes; + } + + Future echoDouble(double request) async { + final JDouble res = await _api.echoDouble(request); + final double dartTypeRes = res.doubleValue(releaseOriginal: true); + return dartTypeRes; + } + + Future echoBool(bool request) async { + final JBoolean res = await _api.echoBool(request); + final bool dartTypeRes = res.booleanValue(releaseOriginal: true); + return dartTypeRes; + } + + Future echoObj(Object request) async { + final JObject res = + await _api.echoObj(_PigeonJniCodec.writeValue(request)!); + final Object dartTypeRes = _PigeonJniCodec.readValue(res)!; + return dartTypeRes; + } + + Future sendSomeTypes(SomeTypes someTypes) async { + final bridge.SomeTypes res = await _api.sendSomeTypes(someTypes.toJni()); + final SomeTypes dartTypeRes = SomeTypes.fromJni(res)!; + return dartTypeRes; + } + + Future sendSomeEnum(SomeEnum anEnum) async { + final bridge.SomeEnum res = await _api.sendSomeEnum(anEnum.toJni()); + final SomeEnum dartTypeRes = SomeEnum.fromJni(res)!; + return dartTypeRes; + } +} + +class JniMessageApiNullableAsync { + JniMessageApiNullableAsync._withRegistrar( + bridge.JniMessageApiNullableAsyncRegistrar api) + : _api = api; + + /// Returns instance of JniMessageApiNullableAsync with specified [channelName] if one has been registered. + static JniMessageApiNullableAsync? getInstance( + {String channelName = defaultInstanceName}) { + final bridge.JniMessageApiNullableAsyncRegistrar? link = + bridge.JniMessageApiNullableAsyncRegistrar() + .getInstance(JString.fromString(channelName)); + if (link == null) { + String nameString = 'named $channelName'; + if (channelName == defaultInstanceName) { + nameString = 'with no name'; + } + final String error = 'No instance $nameString has been registered.'; + throw ArgumentError(error); + } + final JniMessageApiNullableAsync res = + JniMessageApiNullableAsync._withRegistrar(link); + return res; + } + + late final bridge.JniMessageApiNullableAsyncRegistrar _api; + + Future echoString(String? request) async { + final JString? res = await _api + .echoString(request == null ? null : JString.fromString(request)); + final String? dartTypeRes = res?.toDartString(releaseOriginal: true); + return dartTypeRes; + } + + Future echoInt(int? request) async { + final JLong? res = + await _api.echoInt(request == null ? null : JLong(request)); + final int? dartTypeRes = res?.intValue(releaseOriginal: true); + return dartTypeRes; + } + + Future echoDouble(double? request) async { + final JDouble? res = + await _api.echoDouble(request == null ? null : JDouble(request)); + final double? dartTypeRes = res?.doubleValue(releaseOriginal: true); + return dartTypeRes; + } + + Future echoBool(bool? request) async { + final JBoolean? res = + await _api.echoBool(request == null ? null : JBoolean(request)); + final bool? dartTypeRes = res?.booleanValue(releaseOriginal: true); + return dartTypeRes; + } + + Future echoObj(Object? request) async { + final JObject? res = + await _api.echoObj(_PigeonJniCodec.writeValue(request)); + final Object? dartTypeRes = _PigeonJniCodec.readValue(res); + return dartTypeRes; + } + + Future sendSomeNullableTypes( + SomeNullableTypes? someTypes) async { + final bridge.SomeNullableTypes? res = await _api + .sendSomeNullableTypes(someTypes == null ? null : someTypes.toJni()); + final SomeNullableTypes? dartTypeRes = SomeNullableTypes.fromJni(res); + return dartTypeRes; + } + + Future sendSomeEnum(SomeEnum? anEnum) async { + final bridge.SomeEnum? res = + await _api.sendSomeEnum(anEnum == null ? null : anEnum.toJni()); + final SomeEnum? dartTypeRes = SomeEnum.fromJni(res); + return dartTypeRes; + } +} diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.jni.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.jni.dart new file mode 100644 index 000000000000..3050f9a212d4 --- /dev/null +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.jni.dart @@ -0,0 +1,5787 @@ +// AUTO GENERATED BY JNIGEN 0.14.2. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: argument_type_not_assignable +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: comment_references +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: inference_failure_on_untyped_parameter +// ignore_for_file: invalid_internal_annotation +// ignore_for_file: invalid_use_of_internal_member +// ignore_for_file: library_prefixes +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_library_prefixes +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: only_throw_errors +// ignore_for_file: overridden_fields +// ignore_for_file: prefer_double_quotes +// ignore_for_file: unintended_html_in_doc_comment +// ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import 'dart:core' show Object, String, bool, double, int; +import 'dart:core' as core$_; + +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; + +/// from: `JniMessageApi` +class JniMessageApi extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApi.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApi'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApi$NullableType(); + static const type = $JniMessageApi$Type(); + static final _id_doNothing = _class.instanceMethodId( + r'doNothing', + r'()V', + ); + + static final _doNothing = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public abstract void doNothing()` + void doNothing() { + _doNothing(reference.pointer, _id_doNothing as jni$_.JMethodIDPtr).check(); + } + + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.String echoString(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString echoString( + jni$_.JString string, + ) { + final _$string = string.reference; + return _echoString(reference.pointer, _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const jni$_.JStringType()); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(J)J', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public abstract long echoInt(long j)` + int echoInt( + int j, + ) { + return _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, j) + .long; + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(D)D', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Double,)>)>>('globalEnv_CallDoubleMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); + + /// from: `public abstract double echoDouble(double d)` + double echoDouble( + double d, + ) { + return _echoDouble( + reference.pointer, _id_echoDouble as jni$_.JMethodIDPtr, d) + .doubleFloat; + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(Z)Z', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public abstract boolean echoBool(boolean z)` + bool echoBool( + bool z, + ) { + return _echoBool( + reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, z ? 1 : 0) + .boolean; + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoObj(java.lang.Object object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject echoObj( + jni$_.JObject object, + ) { + final _$object = object.reference; + return _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer) + .object(const jni$_.JObjectType()); + } + + static final _id_sendSomeTypes = _class.instanceMethodId( + r'sendSomeTypes', + r'(LSomeTypes;)LSomeTypes;', + ); + + static final _sendSomeTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract SomeTypes sendSomeTypes(SomeTypes someTypes)` + /// The returned object must be released after use, by calling the [release] method. + SomeTypes sendSomeTypes( + SomeTypes someTypes, + ) { + final _$someTypes = someTypes.reference; + return _sendSomeTypes(reference.pointer, + _id_sendSomeTypes as jni$_.JMethodIDPtr, _$someTypes.pointer) + .object(const $SomeTypes$Type()); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;)LSomeEnum;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract SomeEnum sendSomeEnum(SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum sendSomeEnum( + SomeEnum someEnum, + ) { + final _$someEnum = someEnum.reference; + return _sendSomeEnum(reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, _$someEnum.pointer) + .object(const $SomeEnum$Type()); + } +} + +final class $JniMessageApi$NullableType extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApi$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApi;'; + + @jni$_.internal + @core$_.override + JniMessageApi? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : JniMessageApi.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApi$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApi$NullableType) && + other is $JniMessageApi$NullableType; + } +} + +final class $JniMessageApi$Type extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApi$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApi;'; + + @jni$_.internal + @core$_.override + JniMessageApi fromReference(jni$_.JReference reference) => + JniMessageApi.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApi$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApi$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApi$Type) && + other is $JniMessageApi$Type; + } +} + +/// from: `JniMessageApiRegistrar` +class JniMessageApiRegistrar extends JniMessageApi { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiRegistrar.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApiRegistrar'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApiRegistrar$NullableType(); + static const type = $JniMessageApiRegistrar$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory JniMessageApiRegistrar() { + return JniMessageApiRegistrar.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) + .reference); + } + + static final _id_getApi = _class.instanceMethodId( + r'getApi', + r'()LJniMessageApi;', + ); + + static final _getApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final JniMessageApi getApi()` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApi? getApi() { + return _getApi(reference.pointer, _id_getApi as jni$_.JMethodIDPtr) + .object(const $JniMessageApi$NullableType()); + } + + static final _id_setApi = _class.instanceMethodId( + r'setApi', + r'(LJniMessageApi;)V', + ); + + static final _setApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final void setApi(JniMessageApi jniMessageApi)` + void setApi( + JniMessageApi? jniMessageApi, + ) { + final _$jniMessageApi = jniMessageApi?.reference ?? jni$_.jNullReference; + _setApi(reference.pointer, _id_setApi as jni$_.JMethodIDPtr, + _$jniMessageApi.pointer) + .check(); + } + + static final _id_register = _class.instanceMethodId( + r'register', + r'(LJniMessageApi;Ljava/lang/String;)LJniMessageApiRegistrar;', + ); + + static final _register = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final JniMessageApiRegistrar register(JniMessageApi jniMessageApi, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiRegistrar register( + JniMessageApi jniMessageApi, + jni$_.JString string, + ) { + final _$jniMessageApi = jniMessageApi.reference; + final _$string = string.reference; + return _register(reference.pointer, _id_register as jni$_.JMethodIDPtr, + _$jniMessageApi.pointer, _$string.pointer) + .object(const $JniMessageApiRegistrar$Type()); + } + + static final _id_getInstance = _class.instanceMethodId( + r'getInstance', + r'(Ljava/lang/String;)LJniMessageApiRegistrar;', + ); + + static final _getInstance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final JniMessageApiRegistrar getInstance(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiRegistrar? getInstance( + jni$_.JString string, + ) { + final _$string = string.reference; + return _getInstance(reference.pointer, + _id_getInstance as jni$_.JMethodIDPtr, _$string.pointer) + .object( + const $JniMessageApiRegistrar$NullableType()); + } + + static final _id_doNothing = _class.instanceMethodId( + r'doNothing', + r'()V', + ); + + static final _doNothing = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void doNothing()` + void doNothing() { + _doNothing(reference.pointer, _id_doNothing as jni$_.JMethodIDPtr).check(); + } + + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.String echoString(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString echoString( + jni$_.JString string, + ) { + final _$string = string.reference; + return _echoString(reference.pointer, _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const jni$_.JStringType()); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(J)J', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public long echoInt(long j)` + int echoInt( + int j, + ) { + return _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, j) + .long; + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(D)D', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Double,)>)>>('globalEnv_CallDoubleMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, double)>(); + + /// from: `public double echoDouble(double d)` + double echoDouble( + double d, + ) { + return _echoDouble( + reference.pointer, _id_echoDouble as jni$_.JMethodIDPtr, d) + .doubleFloat; + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(Z)Z', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public boolean echoBool(boolean z)` + bool echoBool( + bool z, + ) { + return _echoBool( + reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, z ? 1 : 0) + .boolean; + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoObj(java.lang.Object object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject echoObj( + jni$_.JObject object, + ) { + final _$object = object.reference; + return _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer) + .object(const jni$_.JObjectType()); + } + + static final _id_sendSomeTypes = _class.instanceMethodId( + r'sendSomeTypes', + r'(LSomeTypes;)LSomeTypes;', + ); + + static final _sendSomeTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public SomeTypes sendSomeTypes(SomeTypes someTypes)` + /// The returned object must be released after use, by calling the [release] method. + SomeTypes sendSomeTypes( + SomeTypes someTypes, + ) { + final _$someTypes = someTypes.reference; + return _sendSomeTypes(reference.pointer, + _id_sendSomeTypes as jni$_.JMethodIDPtr, _$someTypes.pointer) + .object(const $SomeTypes$Type()); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;)LSomeEnum;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public SomeEnum sendSomeEnum(SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum sendSomeEnum( + SomeEnum someEnum, + ) { + final _$someEnum = someEnum.reference; + return _sendSomeEnum(reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, _$someEnum.pointer) + .object(const $SomeEnum$Type()); + } +} + +final class $JniMessageApiRegistrar$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiRegistrar? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApi$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiRegistrar$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiRegistrar$NullableType) && + other is $JniMessageApiRegistrar$NullableType; + } +} + +final class $JniMessageApiRegistrar$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiRegistrar$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiRegistrar fromReference(jni$_.JReference reference) => + JniMessageApiRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApi$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiRegistrar$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiRegistrar$Type) && + other is $JniMessageApiRegistrar$Type; + } +} + +/// from: `JniMessageApiNullable` +class JniMessageApiNullable extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiNullable.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApiNullable'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApiNullable$NullableType(); + static const type = $JniMessageApiNullable$Type(); + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.String echoString(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? echoString( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _echoString(reference.pointer, _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const jni$_.JStringNullableType()); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(Ljava/lang/Long;)Ljava/lang/Long;', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Long echoInt(java.lang.Long long)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JLong? echoInt( + jni$_.JLong? long, + ) { + final _$long = long?.reference ?? jni$_.jNullReference; + return _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, + _$long.pointer) + .object(const jni$_.JLongNullableType()); + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(Ljava/lang/Double;)Ljava/lang/Double;', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Double echoDouble(java.lang.Double double)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JDouble? echoDouble( + jni$_.JDouble? double, + ) { + final _$double = double?.reference ?? jni$_.jNullReference; + return _echoDouble(reference.pointer, _id_echoDouble as jni$_.JMethodIDPtr, + _$double.pointer) + .object(const jni$_.JDoubleNullableType()); + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(Ljava/lang/Boolean;)Ljava/lang/Boolean;', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Boolean echoBool(java.lang.Boolean boolean)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JBoolean? echoBool( + jni$_.JBoolean? boolean, + ) { + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + return _echoBool(reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, + _$boolean.pointer) + .object(const jni$_.JBooleanNullableType()); + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoObj(java.lang.Object object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? echoObj( + jni$_.JObject? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_sendSomeNullableTypes = _class.instanceMethodId( + r'sendSomeNullableTypes', + r'(LSomeNullableTypes;)LSomeNullableTypes;', + ); + + static final _sendSomeNullableTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract SomeNullableTypes sendSomeNullableTypes(SomeNullableTypes someNullableTypes)` + /// The returned object must be released after use, by calling the [release] method. + SomeNullableTypes? sendSomeNullableTypes( + SomeNullableTypes? someNullableTypes, + ) { + final _$someNullableTypes = + someNullableTypes?.reference ?? jni$_.jNullReference; + return _sendSomeNullableTypes( + reference.pointer, + _id_sendSomeNullableTypes as jni$_.JMethodIDPtr, + _$someNullableTypes.pointer) + .object(const $SomeNullableTypes$NullableType()); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;)LSomeEnum;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract SomeEnum sendSomeEnum(SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum? sendSomeEnum( + SomeEnum? someEnum, + ) { + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + return _sendSomeEnum(reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, _$someEnum.pointer) + .object(const $SomeEnum$NullableType()); + } +} + +final class $JniMessageApiNullable$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullable$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullable;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullable? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiNullable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApiNullable$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiNullable$NullableType) && + other is $JniMessageApiNullable$NullableType; + } +} + +final class $JniMessageApiNullable$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullable$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullable;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullable fromReference(jni$_.JReference reference) => + JniMessageApiNullable.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiNullable$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApiNullable$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiNullable$Type) && + other is $JniMessageApiNullable$Type; + } +} + +/// from: `JniMessageApiNullableRegistrar` +class JniMessageApiNullableRegistrar extends JniMessageApiNullable { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiNullableRegistrar.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApiNullableRegistrar'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApiNullableRegistrar$NullableType(); + static const type = $JniMessageApiNullableRegistrar$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory JniMessageApiNullableRegistrar() { + return JniMessageApiNullableRegistrar.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) + .reference); + } + + static final _id_getApi = _class.instanceMethodId( + r'getApi', + r'()LJniMessageApiNullable;', + ); + + static final _getApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final JniMessageApiNullable getApi()` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiNullable? getApi() { + return _getApi(reference.pointer, _id_getApi as jni$_.JMethodIDPtr) + .object( + const $JniMessageApiNullable$NullableType()); + } + + static final _id_setApi = _class.instanceMethodId( + r'setApi', + r'(LJniMessageApiNullable;)V', + ); + + static final _setApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final void setApi(JniMessageApiNullable jniMessageApiNullable)` + void setApi( + JniMessageApiNullable? jniMessageApiNullable, + ) { + final _$jniMessageApiNullable = + jniMessageApiNullable?.reference ?? jni$_.jNullReference; + _setApi(reference.pointer, _id_setApi as jni$_.JMethodIDPtr, + _$jniMessageApiNullable.pointer) + .check(); + } + + static final _id_register = _class.instanceMethodId( + r'register', + r'(LJniMessageApiNullable;Ljava/lang/String;)LJniMessageApiNullableRegistrar;', + ); + + static final _register = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final JniMessageApiNullableRegistrar register(JniMessageApiNullable jniMessageApiNullable, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiNullableRegistrar register( + JniMessageApiNullable jniMessageApiNullable, + jni$_.JString string, + ) { + final _$jniMessageApiNullable = jniMessageApiNullable.reference; + final _$string = string.reference; + return _register(reference.pointer, _id_register as jni$_.JMethodIDPtr, + _$jniMessageApiNullable.pointer, _$string.pointer) + .object( + const $JniMessageApiNullableRegistrar$Type()); + } + + static final _id_getInstance = _class.instanceMethodId( + r'getInstance', + r'(Ljava/lang/String;)LJniMessageApiNullableRegistrar;', + ); + + static final _getInstance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final JniMessageApiNullableRegistrar getInstance(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiNullableRegistrar? getInstance( + jni$_.JString string, + ) { + final _$string = string.reference; + return _getInstance(reference.pointer, + _id_getInstance as jni$_.JMethodIDPtr, _$string.pointer) + .object( + const $JniMessageApiNullableRegistrar$NullableType()); + } + + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.String echoString(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? echoString( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _echoString(reference.pointer, _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const jni$_.JStringNullableType()); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(Ljava/lang/Long;)Ljava/lang/Long;', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.Long echoInt(java.lang.Long long)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JLong? echoInt( + jni$_.JLong? long, + ) { + final _$long = long?.reference ?? jni$_.jNullReference; + return _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, + _$long.pointer) + .object(const jni$_.JLongNullableType()); + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(Ljava/lang/Double;)Ljava/lang/Double;', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.Double echoDouble(java.lang.Double double)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JDouble? echoDouble( + jni$_.JDouble? double, + ) { + final _$double = double?.reference ?? jni$_.jNullReference; + return _echoDouble(reference.pointer, _id_echoDouble as jni$_.JMethodIDPtr, + _$double.pointer) + .object(const jni$_.JDoubleNullableType()); + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(Ljava/lang/Boolean;)Ljava/lang/Boolean;', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.Boolean echoBool(java.lang.Boolean boolean)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JBoolean? echoBool( + jni$_.JBoolean? boolean, + ) { + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + return _echoBool(reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, + _$boolean.pointer) + .object(const jni$_.JBooleanNullableType()); + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoObj(java.lang.Object object)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? echoObj( + jni$_.JObject? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_sendSomeNullableTypes = _class.instanceMethodId( + r'sendSomeNullableTypes', + r'(LSomeNullableTypes;)LSomeNullableTypes;', + ); + + static final _sendSomeNullableTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public SomeNullableTypes sendSomeNullableTypes(SomeNullableTypes someNullableTypes)` + /// The returned object must be released after use, by calling the [release] method. + SomeNullableTypes? sendSomeNullableTypes( + SomeNullableTypes? someNullableTypes, + ) { + final _$someNullableTypes = + someNullableTypes?.reference ?? jni$_.jNullReference; + return _sendSomeNullableTypes( + reference.pointer, + _id_sendSomeNullableTypes as jni$_.JMethodIDPtr, + _$someNullableTypes.pointer) + .object(const $SomeNullableTypes$NullableType()); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;)LSomeEnum;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public SomeEnum sendSomeEnum(SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum? sendSomeEnum( + SomeEnum? someEnum, + ) { + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + return _sendSomeEnum(reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, _$someEnum.pointer) + .object(const $SomeEnum$NullableType()); + } +} + +final class $JniMessageApiNullableRegistrar$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullableRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullableRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullableRegistrar? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiNullableRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApiNullable$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiNullableRegistrar$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($JniMessageApiNullableRegistrar$NullableType) && + other is $JniMessageApiNullableRegistrar$NullableType; + } +} + +final class $JniMessageApiNullableRegistrar$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullableRegistrar$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullableRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullableRegistrar fromReference(jni$_.JReference reference) => + JniMessageApiNullableRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApiNullable$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiNullableRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiNullableRegistrar$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiNullableRegistrar$Type) && + other is $JniMessageApiNullableRegistrar$Type; + } +} + +/// from: `JniMessageApiAsync` +class JniMessageApiAsync extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiAsync.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApiAsync'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApiAsync$NullableType(); + static const type = $JniMessageApiAsync$Type(); + static final _id_doNothing = _class.instanceMethodId( + r'doNothing', + r'(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _doNothing = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object doNothing(kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future doNothing() async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _doNothing(reference.pointer, + _id_doNothing as jni$_.JMethodIDPtr, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JObjectType(), + releaseOriginal: true, + ); + } + + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoString(java.lang.String string, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoString( + jni$_.JString string, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$string = string.reference; + final $r = _echoString( + reference.pointer, + _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JStringType(), + releaseOriginal: true, + ); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(JLkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int64, jni$_.Pointer)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoInt(long j, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoInt( + int j, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, j, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JLongType(), + releaseOriginal: true, + ); + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(DLkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Double, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, double, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoDouble(double d, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoDouble( + double d, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _echoDouble(reference.pointer, + _id_echoDouble as jni$_.JMethodIDPtr, d, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JDoubleType(), + releaseOriginal: true, + ); + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32, jni$_.Pointer)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoBool(boolean z, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoBool( + bool z, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _echoBool(reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, + z ? 1 : 0, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JBooleanType(), + releaseOriginal: true, + ); + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoObj(java.lang.Object object, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoObj( + jni$_.JObject object, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$object = object.reference; + final $r = _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JObjectType(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeTypes = _class.instanceMethodId( + r'sendSomeTypes', + r'(LSomeTypes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object sendSomeTypes(SomeTypes someTypes, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeTypes( + SomeTypes someTypes, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someTypes = someTypes.reference; + final $r = _sendSomeTypes( + reference.pointer, + _id_sendSomeTypes as jni$_.JMethodIDPtr, + _$someTypes.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const $SomeTypes$Type(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object sendSomeEnum(SomeEnum someEnum, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeEnum( + SomeEnum someEnum, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someEnum = someEnum.reference; + final $r = _sendSomeEnum( + reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, + _$someEnum.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const $SomeEnum$Type(), + releaseOriginal: true, + ); + } +} + +final class $JniMessageApiAsync$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiAsync$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiAsync;'; + + @jni$_.internal + @core$_.override + JniMessageApiAsync? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiAsync.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApiAsync$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiAsync$NullableType) && + other is $JniMessageApiAsync$NullableType; + } +} + +final class $JniMessageApiAsync$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiAsync$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiAsync;'; + + @jni$_.internal + @core$_.override + JniMessageApiAsync fromReference(jni$_.JReference reference) => + JniMessageApiAsync.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiAsync$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApiAsync$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiAsync$Type) && + other is $JniMessageApiAsync$Type; + } +} + +/// from: `JniMessageApiAsyncRegistrar` +class JniMessageApiAsyncRegistrar extends JniMessageApiAsync { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiAsyncRegistrar.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApiAsyncRegistrar'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApiAsyncRegistrar$NullableType(); + static const type = $JniMessageApiAsyncRegistrar$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory JniMessageApiAsyncRegistrar() { + return JniMessageApiAsyncRegistrar.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) + .reference); + } + + static final _id_getApi = _class.instanceMethodId( + r'getApi', + r'()LJniMessageApiAsync;', + ); + + static final _getApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final JniMessageApiAsync getApi()` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiAsync? getApi() { + return _getApi(reference.pointer, _id_getApi as jni$_.JMethodIDPtr) + .object(const $JniMessageApiAsync$NullableType()); + } + + static final _id_setApi = _class.instanceMethodId( + r'setApi', + r'(LJniMessageApiAsync;)V', + ); + + static final _setApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final void setApi(JniMessageApiAsync jniMessageApiAsync)` + void setApi( + JniMessageApiAsync? jniMessageApiAsync, + ) { + final _$jniMessageApiAsync = + jniMessageApiAsync?.reference ?? jni$_.jNullReference; + _setApi(reference.pointer, _id_setApi as jni$_.JMethodIDPtr, + _$jniMessageApiAsync.pointer) + .check(); + } + + static final _id_register = _class.instanceMethodId( + r'register', + r'(LJniMessageApiAsync;Ljava/lang/String;)LJniMessageApiAsyncRegistrar;', + ); + + static final _register = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final JniMessageApiAsyncRegistrar register(JniMessageApiAsync jniMessageApiAsync, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiAsyncRegistrar register( + JniMessageApiAsync jniMessageApiAsync, + jni$_.JString string, + ) { + final _$jniMessageApiAsync = jniMessageApiAsync.reference; + final _$string = string.reference; + return _register(reference.pointer, _id_register as jni$_.JMethodIDPtr, + _$jniMessageApiAsync.pointer, _$string.pointer) + .object( + const $JniMessageApiAsyncRegistrar$Type()); + } + + static final _id_getInstance = _class.instanceMethodId( + r'getInstance', + r'(Ljava/lang/String;)LJniMessageApiAsyncRegistrar;', + ); + + static final _getInstance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final JniMessageApiAsyncRegistrar getInstance(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiAsyncRegistrar? getInstance( + jni$_.JString string, + ) { + final _$string = string.reference; + return _getInstance(reference.pointer, + _id_getInstance as jni$_.JMethodIDPtr, _$string.pointer) + .object( + const $JniMessageApiAsyncRegistrar$NullableType()); + } + + static final _id_doNothing = _class.instanceMethodId( + r'doNothing', + r'(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _doNothing = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.Object doNothing(kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future doNothing() async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _doNothing(reference.pointer, + _id_doNothing as jni$_.JMethodIDPtr, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JObjectType(), + releaseOriginal: true, + ); + } + + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoString(java.lang.String string, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoString( + jni$_.JString string, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$string = string.reference; + final $r = _echoString( + reference.pointer, + _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JStringType(), + releaseOriginal: true, + ); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(JLkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int64, jni$_.Pointer)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoInt(long j, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoInt( + int j, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, j, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JLongType(), + releaseOriginal: true, + ); + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(DLkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Double, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, double, jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoDouble(double d, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoDouble( + double d, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _echoDouble(reference.pointer, + _id_echoDouble as jni$_.JMethodIDPtr, d, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JDoubleType(), + releaseOriginal: true, + ); + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32, jni$_.Pointer)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoBool(boolean z, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoBool( + bool z, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + + final $r = _echoBool(reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, + z ? 1 : 0, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JBooleanType(), + releaseOriginal: true, + ); + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoObj(java.lang.Object object, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoObj( + jni$_.JObject object, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$object = object.reference; + final $r = _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer, _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const jni$_.JObjectType(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeTypes = _class.instanceMethodId( + r'sendSomeTypes', + r'(LSomeTypes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object sendSomeTypes(SomeTypes someTypes, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeTypes( + SomeTypes someTypes, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someTypes = someTypes.reference; + final $r = _sendSomeTypes( + reference.pointer, + _id_sendSomeTypes as jni$_.JMethodIDPtr, + _$someTypes.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const $SomeTypes$Type(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object sendSomeEnum(SomeEnum someEnum, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeEnum( + SomeEnum someEnum, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someEnum = someEnum.reference; + final $r = _sendSomeEnum( + reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, + _$someEnum.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectType()); + _$continuation.release(); + final jni$_.JObject $o; + if ($r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o.as( + const $SomeEnum$Type(), + releaseOriginal: true, + ); + } +} + +final class $JniMessageApiAsyncRegistrar$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiAsyncRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiAsyncRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiAsyncRegistrar? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiAsyncRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApiAsync$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiAsyncRegistrar$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiAsyncRegistrar$NullableType) && + other is $JniMessageApiAsyncRegistrar$NullableType; + } +} + +final class $JniMessageApiAsyncRegistrar$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiAsyncRegistrar$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiAsyncRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiAsyncRegistrar fromReference(jni$_.JReference reference) => + JniMessageApiAsyncRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApiAsync$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiAsyncRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiAsyncRegistrar$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiAsyncRegistrar$Type) && + other is $JniMessageApiAsyncRegistrar$Type; + } +} + +/// from: `JniMessageApiNullableAsync` +class JniMessageApiNullableAsync extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiNullableAsync.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'JniMessageApiNullableAsync'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $JniMessageApiNullableAsync$NullableType(); + static const type = $JniMessageApiNullableAsync$Type(); + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoString(java.lang.String string, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoString( + jni$_.JString? string, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$string = string?.reference ?? jni$_.jNullReference; + final $r = _echoString( + reference.pointer, + _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JStringNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(Ljava/lang/Long;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoInt(java.lang.Long long, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoInt( + jni$_.JLong? long, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$long = long?.reference ?? jni$_.jNullReference; + final $r = _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, + _$long.pointer, _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JLongNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(Ljava/lang/Double;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoDouble(java.lang.Double double, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoDouble( + jni$_.JDouble? double, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$double = double?.reference ?? jni$_.jNullReference; + final $r = _echoDouble( + reference.pointer, + _id_echoDouble as jni$_.JMethodIDPtr, + _$double.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JDoubleNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(Ljava/lang/Boolean;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoBool(java.lang.Boolean boolean, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoBool( + jni$_.JBoolean? boolean, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + final $r = _echoBool(reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, + _$boolean.pointer, _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JBooleanNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object echoObj(java.lang.Object object, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoObj( + jni$_.JObject? object, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$object = object?.reference ?? jni$_.jNullReference; + final $r = _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer, _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JObjectNullableType(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeNullableTypes = _class.instanceMethodId( + r'sendSomeNullableTypes', + r'(LSomeNullableTypes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeNullableTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object sendSomeNullableTypes(SomeNullableTypes someNullableTypes, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeNullableTypes( + SomeNullableTypes? someNullableTypes, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someNullableTypes = + someNullableTypes?.reference ?? jni$_.jNullReference; + final $r = _sendSomeNullableTypes( + reference.pointer, + _id_sendSomeNullableTypes as jni$_.JMethodIDPtr, + _$someNullableTypes.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const $SomeNullableTypes$NullableType(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public abstract java.lang.Object sendSomeEnum(SomeEnum someEnum, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeEnum( + SomeEnum? someEnum, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + final $r = _sendSomeEnum( + reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, + _$someEnum.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const $SomeEnum$NullableType(), + releaseOriginal: true, + ); + } +} + +final class $JniMessageApiNullableAsync$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullableAsync$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullableAsync;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullableAsync? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiNullableAsync.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApiNullableAsync$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiNullableAsync$NullableType) && + other is $JniMessageApiNullableAsync$NullableType; + } +} + +final class $JniMessageApiNullableAsync$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullableAsync$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullableAsync;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullableAsync fromReference(jni$_.JReference reference) => + JniMessageApiNullableAsync.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiNullableAsync$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($JniMessageApiNullableAsync$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiNullableAsync$Type) && + other is $JniMessageApiNullableAsync$Type; + } +} + +/// from: `JniMessageApiNullableAsyncRegistrar` +class JniMessageApiNullableAsyncRegistrar extends JniMessageApiNullableAsync { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + JniMessageApiNullableAsyncRegistrar.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'JniMessageApiNullableAsyncRegistrar'); + + /// The type which includes information such as the signature of this class. + static const nullableType = + $JniMessageApiNullableAsyncRegistrar$NullableType(); + static const type = $JniMessageApiNullableAsyncRegistrar$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory JniMessageApiNullableAsyncRegistrar() { + return JniMessageApiNullableAsyncRegistrar.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) + .reference); + } + + static final _id_getApi = _class.instanceMethodId( + r'getApi', + r'()LJniMessageApiNullableAsync;', + ); + + static final _getApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final JniMessageApiNullableAsync getApi()` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiNullableAsync? getApi() { + return _getApi(reference.pointer, _id_getApi as jni$_.JMethodIDPtr) + .object( + const $JniMessageApiNullableAsync$NullableType()); + } + + static final _id_setApi = _class.instanceMethodId( + r'setApi', + r'(LJniMessageApiNullableAsync;)V', + ); + + static final _setApi = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final void setApi(JniMessageApiNullableAsync jniMessageApiNullableAsync)` + void setApi( + JniMessageApiNullableAsync? jniMessageApiNullableAsync, + ) { + final _$jniMessageApiNullableAsync = + jniMessageApiNullableAsync?.reference ?? jni$_.jNullReference; + _setApi(reference.pointer, _id_setApi as jni$_.JMethodIDPtr, + _$jniMessageApiNullableAsync.pointer) + .check(); + } + + static final _id_register = _class.instanceMethodId( + r'register', + r'(LJniMessageApiNullableAsync;Ljava/lang/String;)LJniMessageApiNullableAsyncRegistrar;', + ); + + static final _register = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final JniMessageApiNullableAsyncRegistrar register(JniMessageApiNullableAsync jniMessageApiNullableAsync, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiNullableAsyncRegistrar register( + JniMessageApiNullableAsync jniMessageApiNullableAsync, + jni$_.JString string, + ) { + final _$jniMessageApiNullableAsync = jniMessageApiNullableAsync.reference; + final _$string = string.reference; + return _register(reference.pointer, _id_register as jni$_.JMethodIDPtr, + _$jniMessageApiNullableAsync.pointer, _$string.pointer) + .object( + const $JniMessageApiNullableAsyncRegistrar$Type()); + } + + static final _id_getInstance = _class.instanceMethodId( + r'getInstance', + r'(Ljava/lang/String;)LJniMessageApiNullableAsyncRegistrar;', + ); + + static final _getInstance = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final JniMessageApiNullableAsyncRegistrar getInstance(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + JniMessageApiNullableAsyncRegistrar? getInstance( + jni$_.JString string, + ) { + final _$string = string.reference; + return _getInstance(reference.pointer, + _id_getInstance as jni$_.JMethodIDPtr, _$string.pointer) + .object( + const $JniMessageApiNullableAsyncRegistrar$NullableType()); + } + + static final _id_echoString = _class.instanceMethodId( + r'echoString', + r'(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoString(java.lang.String string, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoString( + jni$_.JString? string, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$string = string?.reference ?? jni$_.jNullReference; + final $r = _echoString( + reference.pointer, + _id_echoString as jni$_.JMethodIDPtr, + _$string.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JStringNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoInt = _class.instanceMethodId( + r'echoInt', + r'(Ljava/lang/Long;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoInt(java.lang.Long long, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoInt( + jni$_.JLong? long, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$long = long?.reference ?? jni$_.jNullReference; + final $r = _echoInt(reference.pointer, _id_echoInt as jni$_.JMethodIDPtr, + _$long.pointer, _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JLongNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoDouble = _class.instanceMethodId( + r'echoDouble', + r'(Ljava/lang/Double;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoDouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoDouble(java.lang.Double double, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoDouble( + jni$_.JDouble? double, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$double = double?.reference ?? jni$_.jNullReference; + final $r = _echoDouble( + reference.pointer, + _id_echoDouble as jni$_.JMethodIDPtr, + _$double.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JDoubleNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoBool = _class.instanceMethodId( + r'echoBool', + r'(Ljava/lang/Boolean;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoBool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoBool(java.lang.Boolean boolean, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoBool( + jni$_.JBoolean? boolean, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + final $r = _echoBool(reference.pointer, _id_echoBool as jni$_.JMethodIDPtr, + _$boolean.pointer, _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JBooleanNullableType(), + releaseOriginal: true, + ); + } + + static final _id_echoObj = _class.instanceMethodId( + r'echoObj', + r'(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _echoObj = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object echoObj(java.lang.Object object, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future echoObj( + jni$_.JObject? object, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$object = object?.reference ?? jni$_.jNullReference; + final $r = _echoObj(reference.pointer, _id_echoObj as jni$_.JMethodIDPtr, + _$object.pointer, _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const jni$_.JObjectNullableType(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeNullableTypes = _class.instanceMethodId( + r'sendSomeNullableTypes', + r'(LSomeNullableTypes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeNullableTypes = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object sendSomeNullableTypes(SomeNullableTypes someNullableTypes, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeNullableTypes( + SomeNullableTypes? someNullableTypes, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someNullableTypes = + someNullableTypes?.reference ?? jni$_.jNullReference; + final $r = _sendSomeNullableTypes( + reference.pointer, + _id_sendSomeNullableTypes as jni$_.JMethodIDPtr, + _$someNullableTypes.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const $SomeNullableTypes$NullableType(), + releaseOriginal: true, + ); + } + + static final _id_sendSomeEnum = _class.instanceMethodId( + r'sendSomeEnum', + r'(LSomeEnum;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;', + ); + + static final _sendSomeEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public java.lang.Object sendSomeEnum(SomeEnum someEnum, kotlin.coroutines.Continuation continuation)` + /// The returned object must be released after use, by calling the [release] method. + core$_.Future sendSomeEnum( + SomeEnum? someEnum, + ) async { + final $p = jni$_.ReceivePort(); + final _$continuation = jni$_.ProtectedJniExtensions.newPortContinuation($p); + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + final $r = _sendSomeEnum( + reference.pointer, + _id_sendSomeEnum as jni$_.JMethodIDPtr, + _$someEnum.pointer, + _$continuation.pointer) + .object(const jni$_.JObjectNullableType()); + _$continuation.release(); + final jni$_.JObject? $o; + if ($r != null && $r.isInstanceOf(jni$_.coroutineSingletonsClass)) { + $r.release(); + final $a = await $p.first; + $o = $a == 0 + ? null + : jni$_.JObject.fromReference( + jni$_.JGlobalReference(jni$_.JObjectPtr.fromAddress($a))); + if ($o != null && $o.isInstanceOf(jni$_.result$FailureClass)) { + final $e = + jni$_.failureExceptionField.get($o, const jni$_.JObjectType()); + $o.release(); + jni$_.Jni.throwException($e.reference.toPointer()); + } + } else { + $o = $r; + } + return $o?.as( + const $SomeEnum$NullableType(), + releaseOriginal: true, + ); + } +} + +final class $JniMessageApiNullableAsyncRegistrar$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullableAsyncRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullableAsyncRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullableAsyncRegistrar? fromReference( + jni$_.JReference reference) => + reference.isNull + ? null + : JniMessageApiNullableAsyncRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApiNullableAsync$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => + ($JniMessageApiNullableAsyncRegistrar$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == + ($JniMessageApiNullableAsyncRegistrar$NullableType) && + other is $JniMessageApiNullableAsyncRegistrar$NullableType; + } +} + +final class $JniMessageApiNullableAsyncRegistrar$Type + extends jni$_.JObjType { + @jni$_.internal + const $JniMessageApiNullableAsyncRegistrar$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LJniMessageApiNullableAsyncRegistrar;'; + + @jni$_.internal + @core$_.override + JniMessageApiNullableAsyncRegistrar fromReference( + jni$_.JReference reference) => + JniMessageApiNullableAsyncRegistrar.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const $JniMessageApiNullableAsync$Type(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $JniMessageApiNullableAsyncRegistrar$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 2; + + @core$_.override + int get hashCode => ($JniMessageApiNullableAsyncRegistrar$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($JniMessageApiNullableAsyncRegistrar$Type) && + other is $JniMessageApiNullableAsyncRegistrar$Type; + } +} + +/// from: `SomeTypes$Companion` +class SomeTypes$Companion extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SomeTypes$Companion.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'SomeTypes$Companion'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SomeTypes$Companion$NullableType(); + static const type = $SomeTypes$Companion$Type(); + static final _id_fromList = _class.instanceMethodId( + r'fromList', + r'(Ljava/util/List;)LSomeTypes;', + ); + + static final _fromList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final SomeTypes fromList(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + SomeTypes fromList( + jni$_.JList list, + ) { + final _$list = list.reference; + return _fromList(reference.pointer, _id_fromList as jni$_.JMethodIDPtr, + _$list.pointer) + .object(const $SomeTypes$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory SomeTypes$Companion( + jni$_.JObject? defaultConstructorMarker, + ) { + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return SomeTypes$Companion.fromReference(_new$(_class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, _$defaultConstructorMarker.pointer) + .reference); + } +} + +final class $SomeTypes$Companion$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SomeTypes$Companion$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeTypes$Companion;'; + + @jni$_.internal + @core$_.override + SomeTypes$Companion? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SomeTypes$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeTypes$Companion$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeTypes$Companion$NullableType) && + other is $SomeTypes$Companion$NullableType; + } +} + +final class $SomeTypes$Companion$Type + extends jni$_.JObjType { + @jni$_.internal + const $SomeTypes$Companion$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeTypes$Companion;'; + + @jni$_.internal + @core$_.override + SomeTypes$Companion fromReference(jni$_.JReference reference) => + SomeTypes$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SomeTypes$Companion$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeTypes$Companion$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeTypes$Companion$Type) && + other is $SomeTypes$Companion$Type; + } +} + +/// from: `SomeTypes` +class SomeTypes extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SomeTypes.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'SomeTypes'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SomeTypes$NullableType(); + static const type = $SomeTypes$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'LSomeTypes$Companion;', + ); + + /// from: `static public final SomeTypes$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static SomeTypes$Companion get Companion => + _id_Companion.get(_class, const $SomeTypes$Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/String;JDZLjava/lang/Object;LSomeEnum;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int64, + jni$_.Double, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + double, + int, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (java.lang.String string, long j, double d, boolean z, java.lang.Object object, SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + factory SomeTypes( + jni$_.JString string, + int j, + double d, + bool z, + jni$_.JObject object, + SomeEnum someEnum, + ) { + final _$string = string.reference; + final _$object = object.reference; + final _$someEnum = someEnum.reference; + return SomeTypes.fromReference(_new$( + _class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, + _$string.pointer, + j, + d, + z ? 1 : 0, + _$object.pointer, + _$someEnum.pointer) + .reference); + } + + static final _id_getAString = _class.instanceMethodId( + r'getAString', + r'()Ljava/lang/String;', + ); + + static final _getAString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String getAString()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString getAString() { + return _getAString(reference.pointer, _id_getAString as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); + } + + static final _id_getAnInt = _class.instanceMethodId( + r'getAnInt', + r'()J', + ); + + static final _getAnInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final long getAnInt()` + int getAnInt() { + return _getAnInt(reference.pointer, _id_getAnInt as jni$_.JMethodIDPtr) + .long; + } + + static final _id_getADouble = _class.instanceMethodId( + r'getADouble', + r'()D', + ); + + static final _getADouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final double getADouble()` + double getADouble() { + return _getADouble(reference.pointer, _id_getADouble as jni$_.JMethodIDPtr) + .doubleFloat; + } + + static final _id_getABool = _class.instanceMethodId( + r'getABool', + r'()Z', + ); + + static final _getABool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final boolean getABool()` + bool getABool() { + return _getABool(reference.pointer, _id_getABool as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_getAnObject = _class.instanceMethodId( + r'getAnObject', + r'()Ljava/lang/Object;', + ); + + static final _getAnObject = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Object getAnObject()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject getAnObject() { + return _getAnObject( + reference.pointer, _id_getAnObject as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectType()); + } + + static final _id_getAnEnum = _class.instanceMethodId( + r'getAnEnum', + r'()LSomeEnum;', + ); + + static final _getAnEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final SomeEnum getAnEnum()` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum getAnEnum() { + return _getAnEnum(reference.pointer, _id_getAnEnum as jni$_.JMethodIDPtr) + .object(const $SomeEnum$Type()); + } + + static final _id_toList = _class.instanceMethodId( + r'toList', + r'()Ljava/util/List;', + ); + + static final _toList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List toList()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList toList() { + return _toList(reference.pointer, _id_toList as jni$_.JMethodIDPtr) + .object>( + const jni$_.JListType(jni$_.JObjectNullableType())); + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + jni$_.JObject? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _equals(reference.pointer, _id_equals as jni$_.JMethodIDPtr, + _$object.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as jni$_.JMethodIDPtr) + .integer; + } + + static final _id_component1 = _class.instanceMethodId( + r'component1', + r'()Ljava/lang/String;', + ); + + static final _component1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String component1()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString component1() { + return _component1(reference.pointer, _id_component1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); + } + + static final _id_component2 = _class.instanceMethodId( + r'component2', + r'()J', + ); + + static final _component2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final long component2()` + int component2() { + return _component2(reference.pointer, _id_component2 as jni$_.JMethodIDPtr) + .long; + } + + static final _id_component3 = _class.instanceMethodId( + r'component3', + r'()D', + ); + + static final _component3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final double component3()` + double component3() { + return _component3(reference.pointer, _id_component3 as jni$_.JMethodIDPtr) + .doubleFloat; + } + + static final _id_component4 = _class.instanceMethodId( + r'component4', + r'()Z', + ); + + static final _component4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final boolean component4()` + bool component4() { + return _component4(reference.pointer, _id_component4 as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_component5 = _class.instanceMethodId( + r'component5', + r'()Ljava/lang/Object;', + ); + + static final _component5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Object component5()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject component5() { + return _component5(reference.pointer, _id_component5 as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectType()); + } + + static final _id_component6 = _class.instanceMethodId( + r'component6', + r'()LSomeEnum;', + ); + + static final _component6 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final SomeEnum component6()` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum component6() { + return _component6(reference.pointer, _id_component6 as jni$_.JMethodIDPtr) + .object(const $SomeEnum$Type()); + } + + static final _id_copy = _class.instanceMethodId( + r'copy', + r'(Ljava/lang/String;JDZLjava/lang/Object;LSomeEnum;)LSomeTypes;', + ); + + static final _copy = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int64, + jni$_.Double, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + double, + int, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final SomeTypes copy(java.lang.String string, long j, double d, boolean z, java.lang.Object object, SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + SomeTypes copy( + jni$_.JString string, + int j, + double d, + bool z, + jni$_.JObject object, + SomeEnum someEnum, + ) { + final _$string = string.reference; + final _$object = object.reference; + final _$someEnum = someEnum.reference; + return _copy( + reference.pointer, + _id_copy as jni$_.JMethodIDPtr, + _$string.pointer, + j, + d, + z ? 1 : 0, + _$object.pointer, + _$someEnum.pointer) + .object(const $SomeTypes$Type()); + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); + } +} + +final class $SomeTypes$NullableType extends jni$_.JObjType { + @jni$_.internal + const $SomeTypes$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeTypes;'; + + @jni$_.internal + @core$_.override + SomeTypes? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : SomeTypes.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeTypes$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeTypes$NullableType) && + other is $SomeTypes$NullableType; + } +} + +final class $SomeTypes$Type extends jni$_.JObjType { + @jni$_.internal + const $SomeTypes$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeTypes;'; + + @jni$_.internal + @core$_.override + SomeTypes fromReference(jni$_.JReference reference) => + SomeTypes.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SomeTypes$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeTypes$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeTypes$Type) && other is $SomeTypes$Type; + } +} + +/// from: `SomeNullableTypes$Companion` +class SomeNullableTypes$Companion extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SomeNullableTypes$Companion.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'SomeNullableTypes$Companion'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SomeNullableTypes$Companion$NullableType(); + static const type = $SomeNullableTypes$Companion$Type(); + static final _id_fromList = _class.instanceMethodId( + r'fromList', + r'(Ljava/util/List;)LSomeNullableTypes;', + ); + + static final _fromList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public final SomeNullableTypes fromList(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + SomeNullableTypes fromList( + jni$_.JList list, + ) { + final _$list = list.reference; + return _fromList(reference.pointer, _id_fromList as jni$_.JMethodIDPtr, + _$list.pointer) + .object(const $SomeNullableTypes$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory SomeNullableTypes$Companion( + jni$_.JObject? defaultConstructorMarker, + ) { + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return SomeNullableTypes$Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, + _$defaultConstructorMarker.pointer) + .reference); + } +} + +final class $SomeNullableTypes$Companion$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SomeNullableTypes$Companion$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeNullableTypes$Companion;'; + + @jni$_.internal + @core$_.override + SomeNullableTypes$Companion? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SomeNullableTypes$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeNullableTypes$Companion$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeNullableTypes$Companion$NullableType) && + other is $SomeNullableTypes$Companion$NullableType; + } +} + +final class $SomeNullableTypes$Companion$Type + extends jni$_.JObjType { + @jni$_.internal + const $SomeNullableTypes$Companion$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeNullableTypes$Companion;'; + + @jni$_.internal + @core$_.override + SomeNullableTypes$Companion fromReference(jni$_.JReference reference) => + SomeNullableTypes$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SomeNullableTypes$Companion$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeNullableTypes$Companion$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeNullableTypes$Companion$Type) && + other is $SomeNullableTypes$Companion$Type; + } +} + +/// from: `SomeNullableTypes` +class SomeNullableTypes extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SomeNullableTypes.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'SomeNullableTypes'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SomeNullableTypes$NullableType(); + static const type = $SomeNullableTypes$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'LSomeNullableTypes$Companion;', + ); + + /// from: `static public final SomeNullableTypes$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static SomeNullableTypes$Companion get Companion => + _id_Companion.get(_class, const $SomeNullableTypes$Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Double;Ljava/lang/Boolean;Ljava/lang/Object;LSomeEnum;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (java.lang.String string, java.lang.Long long, java.lang.Double double, java.lang.Boolean boolean, java.lang.Object object, SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + factory SomeNullableTypes( + jni$_.JString? string, + jni$_.JLong? long, + jni$_.JDouble? double, + jni$_.JBoolean? boolean, + jni$_.JObject? object, + SomeEnum? someEnum, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$long = long?.reference ?? jni$_.jNullReference; + final _$double = double?.reference ?? jni$_.jNullReference; + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + return SomeNullableTypes.fromReference(_new$( + _class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, + _$string.pointer, + _$long.pointer, + _$double.pointer, + _$boolean.pointer, + _$object.pointer, + _$someEnum.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Double;Ljava/lang/Boolean;Ljava/lang/Object;LSomeEnum;ILkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `synthetic public void (java.lang.String string, java.lang.Long long, java.lang.Double double, java.lang.Boolean boolean, java.lang.Object object, SomeEnum someEnum, int i, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory SomeNullableTypes.new$1( + jni$_.JString? string, + jni$_.JLong? long, + jni$_.JDouble? double, + jni$_.JBoolean? boolean, + jni$_.JObject? object, + SomeEnum? someEnum, + int i, + jni$_.JObject? defaultConstructorMarker, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$long = long?.reference ?? jni$_.jNullReference; + final _$double = double?.reference ?? jni$_.jNullReference; + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return SomeNullableTypes.fromReference(_new$1( + _class.reference.pointer, + _id_new$1 as jni$_.JMethodIDPtr, + _$string.pointer, + _$long.pointer, + _$double.pointer, + _$boolean.pointer, + _$object.pointer, + _$someEnum.pointer, + i, + _$defaultConstructorMarker.pointer) + .reference); + } + + static final _id_getAString = _class.instanceMethodId( + r'getAString', + r'()Ljava/lang/String;', + ); + + static final _getAString = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String getAString()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getAString() { + return _getAString(reference.pointer, _id_getAString as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_getAnInt = _class.instanceMethodId( + r'getAnInt', + r'()Ljava/lang/Long;', + ); + + static final _getAnInt = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Long getAnInt()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JLong? getAnInt() { + return _getAnInt(reference.pointer, _id_getAnInt as jni$_.JMethodIDPtr) + .object(const jni$_.JLongNullableType()); + } + + static final _id_getADouble = _class.instanceMethodId( + r'getADouble', + r'()Ljava/lang/Double;', + ); + + static final _getADouble = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Double getADouble()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JDouble? getADouble() { + return _getADouble(reference.pointer, _id_getADouble as jni$_.JMethodIDPtr) + .object(const jni$_.JDoubleNullableType()); + } + + static final _id_getABool = _class.instanceMethodId( + r'getABool', + r'()Ljava/lang/Boolean;', + ); + + static final _getABool = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Boolean getABool()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JBoolean? getABool() { + return _getABool(reference.pointer, _id_getABool as jni$_.JMethodIDPtr) + .object(const jni$_.JBooleanNullableType()); + } + + static final _id_getAnObject = _class.instanceMethodId( + r'getAnObject', + r'()Ljava/lang/Object;', + ); + + static final _getAnObject = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Object getAnObject()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getAnObject() { + return _getAnObject( + reference.pointer, _id_getAnObject as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_getAnEnum = _class.instanceMethodId( + r'getAnEnum', + r'()LSomeEnum;', + ); + + static final _getAnEnum = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final SomeEnum getAnEnum()` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum? getAnEnum() { + return _getAnEnum(reference.pointer, _id_getAnEnum as jni$_.JMethodIDPtr) + .object(const $SomeEnum$NullableType()); + } + + static final _id_toList = _class.instanceMethodId( + r'toList', + r'()Ljava/util/List;', + ); + + static final _toList = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List toList()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JList toList() { + return _toList(reference.pointer, _id_toList as jni$_.JMethodIDPtr) + .object>( + const jni$_.JListType(jni$_.JObjectNullableType())); + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + jni$_.JObject? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _equals(reference.pointer, _id_equals as jni$_.JMethodIDPtr, + _$object.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as jni$_.JMethodIDPtr) + .integer; + } + + static final _id_component1 = _class.instanceMethodId( + r'component1', + r'()Ljava/lang/String;', + ); + + static final _component1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String component1()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? component1() { + return _component1(reference.pointer, _id_component1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_component2 = _class.instanceMethodId( + r'component2', + r'()Ljava/lang/Long;', + ); + + static final _component2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Long component2()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JLong? component2() { + return _component2(reference.pointer, _id_component2 as jni$_.JMethodIDPtr) + .object(const jni$_.JLongNullableType()); + } + + static final _id_component3 = _class.instanceMethodId( + r'component3', + r'()Ljava/lang/Double;', + ); + + static final _component3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Double component3()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JDouble? component3() { + return _component3(reference.pointer, _id_component3 as jni$_.JMethodIDPtr) + .object(const jni$_.JDoubleNullableType()); + } + + static final _id_component4 = _class.instanceMethodId( + r'component4', + r'()Ljava/lang/Boolean;', + ); + + static final _component4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Boolean component4()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JBoolean? component4() { + return _component4(reference.pointer, _id_component4 as jni$_.JMethodIDPtr) + .object(const jni$_.JBooleanNullableType()); + } + + static final _id_component5 = _class.instanceMethodId( + r'component5', + r'()Ljava/lang/Object;', + ); + + static final _component5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Object component5()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? component5() { + return _component5(reference.pointer, _id_component5 as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_component6 = _class.instanceMethodId( + r'component6', + r'()LSomeEnum;', + ); + + static final _component6 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final SomeEnum component6()` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum? component6() { + return _component6(reference.pointer, _id_component6 as jni$_.JMethodIDPtr) + .object(const $SomeEnum$NullableType()); + } + + static final _id_copy = _class.instanceMethodId( + r'copy', + r'(Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Double;Ljava/lang/Boolean;Ljava/lang/Object;LSomeEnum;)LSomeNullableTypes;', + ); + + static final _copy = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public final SomeNullableTypes copy(java.lang.String string, java.lang.Long long, java.lang.Double double, java.lang.Boolean boolean, java.lang.Object object, SomeEnum someEnum)` + /// The returned object must be released after use, by calling the [release] method. + SomeNullableTypes copy( + jni$_.JString? string, + jni$_.JLong? long, + jni$_.JDouble? double, + jni$_.JBoolean? boolean, + jni$_.JObject? object, + SomeEnum? someEnum, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$long = long?.reference ?? jni$_.jNullReference; + final _$double = double?.reference ?? jni$_.jNullReference; + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + final _$object = object?.reference ?? jni$_.jNullReference; + final _$someEnum = someEnum?.reference ?? jni$_.jNullReference; + return _copy( + reference.pointer, + _id_copy as jni$_.JMethodIDPtr, + _$string.pointer, + _$long.pointer, + _$double.pointer, + _$boolean.pointer, + _$object.pointer, + _$someEnum.pointer) + .object(const $SomeNullableTypes$Type()); + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringType()); + } + + static final _id_new$2 = _class.constructorId( + r'()V', + ); + + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory SomeNullableTypes.new$2() { + return SomeNullableTypes.fromReference( + _new$2(_class.reference.pointer, _id_new$2 as jni$_.JMethodIDPtr) + .reference); + } +} + +final class $SomeNullableTypes$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SomeNullableTypes$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeNullableTypes;'; + + @jni$_.internal + @core$_.override + SomeNullableTypes? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SomeNullableTypes.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeNullableTypes$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeNullableTypes$NullableType) && + other is $SomeNullableTypes$NullableType; + } +} + +final class $SomeNullableTypes$Type extends jni$_.JObjType { + @jni$_.internal + const $SomeNullableTypes$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeNullableTypes;'; + + @jni$_.internal + @core$_.override + SomeNullableTypes fromReference(jni$_.JReference reference) => + SomeNullableTypes.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SomeNullableTypes$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeNullableTypes$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeNullableTypes$Type) && + other is $SomeNullableTypes$Type; + } +} + +/// from: `SomeEnum$Companion` +class SomeEnum$Companion extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SomeEnum$Companion.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'SomeEnum$Companion'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SomeEnum$Companion$NullableType(); + static const type = $SomeEnum$Companion$Type(); + static final _id_ofRaw = _class.instanceMethodId( + r'ofRaw', + r'(I)LSomeEnum;', + ); + + static final _ofRaw = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public final SomeEnum ofRaw(int i)` + /// The returned object must be released after use, by calling the [release] method. + SomeEnum? ofRaw( + int i, + ) { + return _ofRaw(reference.pointer, _id_ofRaw as jni$_.JMethodIDPtr, i) + .object(const $SomeEnum$NullableType()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory SomeEnum$Companion( + jni$_.JObject? defaultConstructorMarker, + ) { + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return SomeEnum$Companion.fromReference(_new$(_class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, _$defaultConstructorMarker.pointer) + .reference); + } +} + +final class $SomeEnum$Companion$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SomeEnum$Companion$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeEnum$Companion;'; + + @jni$_.internal + @core$_.override + SomeEnum$Companion? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SomeEnum$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeEnum$Companion$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeEnum$Companion$NullableType) && + other is $SomeEnum$Companion$NullableType; + } +} + +final class $SomeEnum$Companion$Type + extends jni$_.JObjType { + @jni$_.internal + const $SomeEnum$Companion$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeEnum$Companion;'; + + @jni$_.internal + @core$_.override + SomeEnum$Companion fromReference(jni$_.JReference reference) => + SomeEnum$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SomeEnum$Companion$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeEnum$Companion$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeEnum$Companion$Type) && + other is $SomeEnum$Companion$Type; + } +} + +/// from: `SomeEnum` +class SomeEnum extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SomeEnum.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'SomeEnum'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SomeEnum$NullableType(); + static const type = $SomeEnum$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'LSomeEnum$Companion;', + ); + + /// from: `static public final SomeEnum$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static SomeEnum$Companion get Companion => + _id_Companion.get(_class, const $SomeEnum$Companion$Type()); + + static final _id_VALUE1 = _class.staticFieldId( + r'VALUE1', + r'LSomeEnum;', + ); + + /// from: `static public final SomeEnum VALUE1` + /// The returned object must be released after use, by calling the [release] method. + static SomeEnum get VALUE1 => _id_VALUE1.get(_class, const $SomeEnum$Type()); + + static final _id_VALUE2 = _class.staticFieldId( + r'VALUE2', + r'LSomeEnum;', + ); + + /// from: `static public final SomeEnum VALUE2` + /// The returned object must be released after use, by calling the [release] method. + static SomeEnum get VALUE2 => _id_VALUE2.get(_class, const $SomeEnum$Type()); + + static final _id_VALUE3 = _class.staticFieldId( + r'VALUE3', + r'LSomeEnum;', + ); + + /// from: `static public final SomeEnum VALUE3` + /// The returned object must be released after use, by calling the [release] method. + static SomeEnum get VALUE3 => _id_VALUE3.get(_class, const $SomeEnum$Type()); + + static final _id_getRaw = _class.instanceMethodId( + r'getRaw', + r'()I', + ); + + static final _getRaw = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final int getRaw()` + int getRaw() { + return _getRaw(reference.pointer, _id_getRaw as jni$_.JMethodIDPtr).integer; + } + + static final _id_values = _class.staticMethodId( + r'values', + r'()[LSomeEnum;', + ); + + static final _values = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `static public SomeEnum[] values()` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $SomeEnum$NullableType())); + } + + static final _id_valueOf = _class.staticMethodId( + r'valueOf', + r'(Ljava/lang/String;)LSomeEnum;', + ); + + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `static public SomeEnum valueOf(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static SomeEnum? valueOf( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$string.pointer) + .object(const $SomeEnum$NullableType()); + } + + static final _id_getEntries = _class.staticMethodId( + r'getEntries', + r'()Lkotlin/enums/EnumEntries;', + ); + + static final _getEntries = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `static public kotlin.enums.EnumEntries getEntries()` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JObject getEntries() { + return _getEntries( + _class.reference.pointer, _id_getEntries as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectType()); + } +} + +final class $SomeEnum$NullableType extends jni$_.JObjType { + @jni$_.internal + const $SomeEnum$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeEnum;'; + + @jni$_.internal + @core$_.override + SomeEnum? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : SomeEnum.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeEnum$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeEnum$NullableType) && + other is $SomeEnum$NullableType; + } +} + +final class $SomeEnum$Type extends jni$_.JObjType { + @jni$_.internal + const $SomeEnum$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'LSomeEnum;'; + + @jni$_.internal + @core$_.override + SomeEnum fromReference(jni$_.JReference reference) => SomeEnum.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $SomeEnum$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SomeEnum$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SomeEnum$Type) && other is $SomeEnum$Type; + } +} diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart index d25c97ce3756..88b8f3aa973c 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart @@ -40,7 +40,7 @@ List wrapResponse( enum MessageRequestState { pending, success, - failure, + failure; } /// This comment is to test class documentation comments. diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart index 3ebff9c56bd7..da8ab23b7bdd 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart @@ -48,7 +48,7 @@ bool _deepEquals(Object? a, Object? b) { enum ReplyType { success, - error, + error; } class NonNullFieldSearchRequest { diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart index b281a87d9c3a..3d7b53dc327b 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart @@ -48,7 +48,7 @@ bool _deepEquals(Object? a, Object? b) { enum NullFieldsSearchReplyType { success, - failure, + failure; } class NullFieldsSearchRequest { diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart index 227b6792179c..44f00344c030 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart @@ -413,7 +413,7 @@ class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { enum ProxyApiTestEnum { one, two, - three, + three; } class _PigeonCodec extends StandardMessageCodec { diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml b/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml index a345c4c7d304..63845dfd15f9 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml @@ -18,4 +18,9 @@ dependencies: sdk: flutter integration_test: sdk: flutter + jni: + git: + url: https://github.com/dart-lang/native/ + path: pkgs/jni + ref: 735250a19b1a429869bfacccba833ecc93db34b6 mockito: ^5.4.4 diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/.gitignore b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/.gitignore index bbe6aef544f5..debb3751da53 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/.gitignore +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/.gitignore @@ -5,9 +5,10 @@ !TestPlugin.kt !CoreTests.gen.kt # This contains the declaration of the test classes wrapped by the ProxyApi tests and the -# implemetations of their APIs. +# implementations of their APIs. !ProxyApiTestApiImpls.kt # Including these makes it easier to review code generation changes. !ProxyApiTests.gen.kt !EventChannelTests.gen.kt +!jniTests.gen.kt \ No newline at end of file diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/JniTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/JniTests.gen.kt new file mode 100644 index 000000000000..c977a46dd23b --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/JniTests.gen.kt @@ -0,0 +1,622 @@ +// 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. +// +// Autogenerated from Pigeon, do not edit directly. +// See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") + +import androidx.annotation.Keep + +/** + * Error class for passing custom error details to Flutter via a thrown PlatformException. + * + * @property code The error code. + * @property message The error message. + * @property details The error details. Must be a datatype supported by the api codec. + */ +class JniTestsError( + val code: String, + override val message: String? = null, + val details: Any? = null +) : Throwable() + +enum class SomeEnum(val raw: Int) { + VALUE1(0), + VALUE2(1), + VALUE3(2); + + companion object { + fun ofRaw(raw: Int): SomeEnum? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class SomeTypes( + val aString: String, + val anInt: Long, + val aDouble: Double, + val aBool: Boolean, + val anObject: Any, + val anEnum: SomeEnum +) { + companion object { + fun fromList(pigeonVar_list: List): SomeTypes { + val aString = pigeonVar_list[0] as String + val anInt = pigeonVar_list[1] as Long + val aDouble = pigeonVar_list[2] as Double + val aBool = pigeonVar_list[3] as Boolean + val anObject = pigeonVar_list[4] as Any + val anEnum = pigeonVar_list[5] as SomeEnum + return SomeTypes(aString, anInt, aDouble, aBool, anObject, anEnum) + } + } + + fun toList(): List { + return listOf( + aString, + anInt, + aDouble, + aBool, + anObject, + anEnum, + ) + } + + override fun equals(other: Any?): Boolean { + if (other !is SomeTypes) { + return false + } + if (this === other) { + return true + } + return aString == other.aString && + anInt == other.anInt && + aDouble == other.aDouble && + aBool == other.aBool && + anObject == other.anObject && + anEnum == other.anEnum + } + + override fun hashCode(): Int = toList().hashCode() +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class SomeNullableTypes( + val aString: String? = null, + val anInt: Long? = null, + val aDouble: Double? = null, + val aBool: Boolean? = null, + val anObject: Any? = null, + val anEnum: SomeEnum? = null +) { + companion object { + fun fromList(pigeonVar_list: List): SomeNullableTypes { + val aString = pigeonVar_list[0] as String? + val anInt = pigeonVar_list[1] as Long? + val aDouble = pigeonVar_list[2] as Double? + val aBool = pigeonVar_list[3] as Boolean? + val anObject = pigeonVar_list[4] + val anEnum = pigeonVar_list[5] as SomeEnum? + return SomeNullableTypes(aString, anInt, aDouble, aBool, anObject, anEnum) + } + } + + fun toList(): List { + return listOf( + aString, + anInt, + aDouble, + aBool, + anObject, + anEnum, + ) + } + + override fun equals(other: Any?): Boolean { + if (other !is SomeNullableTypes) { + return false + } + if (this === other) { + return true + } + return aString == other.aString && + anInt == other.anInt && + aDouble == other.aDouble && + aBool == other.aBool && + anObject == other.anObject && + anEnum == other.anEnum + } + + override fun hashCode(): Int = toList().hashCode() +} + +val JniMessageApiInstances: MutableMap = mutableMapOf() + +@Keep +abstract class JniMessageApi { + abstract fun doNothing() + + abstract fun echoString(request: String): String + + abstract fun echoInt(request: Long): Long + + abstract fun echoDouble(request: Double): Double + + abstract fun echoBool(request: Boolean): Boolean + + abstract fun echoObj(request: Any): Any + + abstract fun sendSomeTypes(someTypes: SomeTypes): SomeTypes + + abstract fun sendSomeEnum(anEnum: SomeEnum): SomeEnum +} + +@Keep +class JniMessageApiRegistrar : JniMessageApi() { + var api: JniMessageApi? = null + + fun register( + api: JniMessageApi, + name: String = "PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u" + ): JniMessageApiRegistrar { + this.api = api + JniMessageApiInstances[name] = this + return this + } + + @Keep + fun getInstance(name: String): JniMessageApiRegistrar? { + return JniMessageApiInstances[name] + } + + override fun doNothing() { + api?.let { + try { + return api!!.doNothing() + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun echoString(request: String): String { + api?.let { + try { + return api!!.echoString(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun echoInt(request: Long): Long { + api?.let { + try { + return api!!.echoInt(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun echoDouble(request: Double): Double { + api?.let { + try { + return api!!.echoDouble(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun echoBool(request: Boolean): Boolean { + api?.let { + try { + return api!!.echoBool(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun echoObj(request: Any): Any { + api?.let { + try { + return api!!.echoObj(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun sendSomeTypes(someTypes: SomeTypes): SomeTypes { + api?.let { + try { + return api!!.sendSomeTypes(someTypes) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } + + override fun sendSomeEnum(anEnum: SomeEnum): SomeEnum { + api?.let { + try { + return api!!.sendSomeEnum(anEnum) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApi has not been set") + } +} + +val JniMessageApiNullableInstances: MutableMap = + mutableMapOf() + +@Keep +abstract class JniMessageApiNullable { + abstract fun echoString(request: String?): String? + + abstract fun echoInt(request: Long?): Long? + + abstract fun echoDouble(request: Double?): Double? + + abstract fun echoBool(request: Boolean?): Boolean? + + abstract fun echoObj(request: Any?): Any? + + abstract fun sendSomeNullableTypes(someTypes: SomeNullableTypes?): SomeNullableTypes? + + abstract fun sendSomeEnum(anEnum: SomeEnum?): SomeEnum? +} + +@Keep +class JniMessageApiNullableRegistrar : JniMessageApiNullable() { + var api: JniMessageApiNullable? = null + + fun register( + api: JniMessageApiNullable, + name: String = "PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u" + ): JniMessageApiNullableRegistrar { + this.api = api + JniMessageApiNullableInstances[name] = this + return this + } + + @Keep + fun getInstance(name: String): JniMessageApiNullableRegistrar? { + return JniMessageApiNullableInstances[name] + } + + override fun echoString(request: String?): String? { + api?.let { + try { + return api!!.echoString(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } + + override fun echoInt(request: Long?): Long? { + api?.let { + try { + return api!!.echoInt(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } + + override fun echoDouble(request: Double?): Double? { + api?.let { + try { + return api!!.echoDouble(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } + + override fun echoBool(request: Boolean?): Boolean? { + api?.let { + try { + return api!!.echoBool(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } + + override fun echoObj(request: Any?): Any? { + api?.let { + try { + return api!!.echoObj(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } + + override fun sendSomeNullableTypes(someTypes: SomeNullableTypes?): SomeNullableTypes? { + api?.let { + try { + return api!!.sendSomeNullableTypes(someTypes) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } + + override fun sendSomeEnum(anEnum: SomeEnum?): SomeEnum? { + api?.let { + try { + return api!!.sendSomeEnum(anEnum) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullable has not been set") + } +} + +val JniMessageApiAsyncInstances: MutableMap = mutableMapOf() + +@Keep +abstract class JniMessageApiAsync { + abstract suspend fun doNothing() + + abstract suspend fun echoString(request: String): String + + abstract suspend fun echoInt(request: Long): Long + + abstract suspend fun echoDouble(request: Double): Double + + abstract suspend fun echoBool(request: Boolean): Boolean + + abstract suspend fun echoObj(request: Any): Any + + abstract suspend fun sendSomeTypes(someTypes: SomeTypes): SomeTypes + + abstract suspend fun sendSomeEnum(anEnum: SomeEnum): SomeEnum +} + +@Keep +class JniMessageApiAsyncRegistrar : JniMessageApiAsync() { + var api: JniMessageApiAsync? = null + + fun register( + api: JniMessageApiAsync, + name: String = "PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u" + ): JniMessageApiAsyncRegistrar { + this.api = api + JniMessageApiAsyncInstances[name] = this + return this + } + + @Keep + fun getInstance(name: String): JniMessageApiAsyncRegistrar? { + return JniMessageApiAsyncInstances[name] + } + + override suspend fun doNothing() { + api?.let { + try { + return api!!.doNothing() + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun echoString(request: String): String { + api?.let { + try { + return api!!.echoString(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun echoInt(request: Long): Long { + api?.let { + try { + return api!!.echoInt(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun echoDouble(request: Double): Double { + api?.let { + try { + return api!!.echoDouble(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun echoBool(request: Boolean): Boolean { + api?.let { + try { + return api!!.echoBool(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun echoObj(request: Any): Any { + api?.let { + try { + return api!!.echoObj(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun sendSomeTypes(someTypes: SomeTypes): SomeTypes { + api?.let { + try { + return api!!.sendSomeTypes(someTypes) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } + + override suspend fun sendSomeEnum(anEnum: SomeEnum): SomeEnum { + api?.let { + try { + return api!!.sendSomeEnum(anEnum) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiAsync has not been set") + } +} + +val JniMessageApiNullableAsyncInstances: MutableMap = + mutableMapOf() + +@Keep +abstract class JniMessageApiNullableAsync { + abstract suspend fun echoString(request: String?): String? + + abstract suspend fun echoInt(request: Long?): Long? + + abstract suspend fun echoDouble(request: Double?): Double? + + abstract suspend fun echoBool(request: Boolean?): Boolean? + + abstract suspend fun echoObj(request: Any?): Any? + + abstract suspend fun sendSomeNullableTypes(someTypes: SomeNullableTypes?): SomeNullableTypes? + + abstract suspend fun sendSomeEnum(anEnum: SomeEnum?): SomeEnum? +} + +@Keep +class JniMessageApiNullableAsyncRegistrar : JniMessageApiNullableAsync() { + var api: JniMessageApiNullableAsync? = null + + fun register( + api: JniMessageApiNullableAsync, + name: String = "PigeonDefaultClassName32uh4ui3lh445uh4h3l2l455g4y34u" + ): JniMessageApiNullableAsyncRegistrar { + this.api = api + JniMessageApiNullableAsyncInstances[name] = this + return this + } + + @Keep + fun getInstance(name: String): JniMessageApiNullableAsyncRegistrar? { + return JniMessageApiNullableAsyncInstances[name] + } + + override suspend fun echoString(request: String?): String? { + api?.let { + try { + return api!!.echoString(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } + + override suspend fun echoInt(request: Long?): Long? { + api?.let { + try { + return api!!.echoInt(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } + + override suspend fun echoDouble(request: Double?): Double? { + api?.let { + try { + return api!!.echoDouble(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } + + override suspend fun echoBool(request: Boolean?): Boolean? { + api?.let { + try { + return api!!.echoBool(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } + + override suspend fun echoObj(request: Any?): Any? { + api?.let { + try { + return api!!.echoObj(request) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } + + override suspend fun sendSomeNullableTypes(someTypes: SomeNullableTypes?): SomeNullableTypes? { + api?.let { + try { + return api!!.sendSomeNullableTypes(someTypes) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } + + override suspend fun sendSomeEnum(anEnum: SomeEnum?): SomeEnum? { + api?.let { + try { + return api!!.sendSomeEnum(anEnum) + } catch (e: Exception) { + throw e + } + } + error("JniMessageApiNullableAsync has not been set") + } +} 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 7c6707c25a41..84285ec78958 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 @@ -4,6 +4,17 @@ package com.example.test_plugin +import JniMessageApi +import JniMessageApiAsync +import JniMessageApiAsyncRegistrar +import JniMessageApiNullable +import JniMessageApiNullableAsync +import JniMessageApiNullableAsyncRegistrar +import JniMessageApiNullableRegistrar +import JniMessageApiRegistrar +import SomeEnum +import SomeNullableTypes +import SomeTypes import android.os.Handler import android.os.Looper import io.flutter.embedding.engine.plugins.FlutterPlugin @@ -15,6 +26,12 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { private var flutterSmallApiOne: FlutterSmallApi? = null private var flutterSmallApiTwo: FlutterSmallApi? = null private var proxyApiRegistrar: ProxyApiRegistrar? = null + private var jniMessageApi: JniMessageApiRegistrar? = null + private var jniMessageApiNamed: JniMessageApiRegistrar? = null + private var jniMessageApiNullable: JniMessageApiNullableRegistrar? = null + private var jniMessageApiAsync: JniMessageApiAsyncRegistrar? = null + private var jniMessageApiAsyncNamed: JniMessageApiAsyncRegistrar? = null + private var jniMessageApiNullableAsync: JniMessageApiNullableAsyncRegistrar? = null override fun onAttachedToEngine(binding: FlutterPluginBinding) { HostIntegrationCoreApi.setUp(binding.binaryMessenger, this) @@ -22,6 +39,16 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { testSuffixApiOne.setUp(binding, "suffixOne") val testSuffixApiTwo = TestPluginWithSuffix() testSuffixApiTwo.setUp(binding, "suffixTwo") + + jniMessageApi = JniMessageApiRegistrar().register(JniMessageApiImpl()) + jniMessageApiNamed = JniMessageApiRegistrar().register(JniMessageApiImpl2(), "name") + jniMessageApiNullable = JniMessageApiNullableRegistrar().register(JniMessageApiNullableImpl()) + jniMessageApiAsync = JniMessageApiAsyncRegistrar().register(JniMessageApiAsyncImpl()) + jniMessageApiAsyncNamed = + JniMessageApiAsyncRegistrar().register(JniMessageApiAsyncImpl2(), "name") + jniMessageApiNullableAsync = + JniMessageApiNullableAsyncRegistrar().register(JniMessageApiNullableAsyncImpl()) + flutterApi = FlutterIntegrationCoreApi(binding.binaryMessenger) flutterSmallApiOne = FlutterSmallApi(binding.binaryMessenger, "suffixOne") flutterSmallApiTwo = FlutterSmallApi(binding.binaryMessenger, "suffixTwo") @@ -37,7 +64,7 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { binding.binaryMessenger, SendConsistentNumbers(2), "2") } - override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { + override fun onDetachedFromEngine(binding: FlutterPluginBinding) { proxyApiRegistrar?.tearDown() } @@ -527,11 +554,11 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { } override fun defaultIsMainThread(): Boolean { - return Thread.currentThread() == Looper.getMainLooper().getThread() + return Thread.currentThread() == Looper.getMainLooper().thread } override fun taskQueueIsBackgroundThread(): Boolean { - return Thread.currentThread() != Looper.getMainLooper().getThread() + return Thread.currentThread() != Looper.getMainLooper().thread } override fun callFlutterNoop(callback: (Result) -> Unit) { @@ -870,6 +897,210 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { } } +class JniMessageApiImpl : JniMessageApi() { + override fun doNothing() { + return + } + + override fun echoString(request: String): String { + return request + } + + override fun echoInt(request: Long): Long { + return request + } + + override fun echoDouble(request: Double): Double { + return request + } + + override fun echoBool(request: Boolean): Boolean { + return request + } + + override fun echoObj(request: Any): Any { + return request + } + + override fun sendSomeTypes(someTypes: SomeTypes): SomeTypes { + return someTypes + } + + override fun sendSomeEnum(anEnum: SomeEnum): SomeEnum { + return anEnum + } +} + +class JniMessageApiImpl2 : JniMessageApi() { + override fun doNothing() { + return + } + + override fun echoString(request: String): String { + return request + "1" + } + + override fun echoInt(request: Long): Long { + return request + 1 + } + + override fun echoDouble(request: Double): Double { + return request + 1 + } + + override fun echoBool(request: Boolean): Boolean { + return !request + } + + override fun echoObj(request: Any): Any { + return request + } + + override fun sendSomeTypes(someTypes: SomeTypes): SomeTypes { + val newSomeTypes = someTypes.copy(anInt = someTypes.anInt + 1) + return newSomeTypes + } + + override fun sendSomeEnum(anEnum: SomeEnum): SomeEnum { + return anEnum + } +} + +class JniMessageApiNullableImpl : JniMessageApiNullable() { + override fun echoString(request: String?): String? { + return request + } + + override fun echoInt(request: Long?): Long? { + return request + } + + override fun echoDouble(request: Double?): Double? { + return request + } + + override fun echoBool(request: Boolean?): Boolean? { + return request + } + + override fun echoObj(request: Any?): Any? { + return request + } + + override fun sendSomeNullableTypes(someTypes: SomeNullableTypes?): SomeNullableTypes? { + return someTypes + } + + override fun sendSomeEnum(anEnum: SomeEnum?): SomeEnum? { + return anEnum + } +} + +class JniMessageApiAsyncImpl : JniMessageApiAsync() { + override suspend fun doNothing() { + return + } + + override suspend fun echoString(request: String): String { + return request + } + + override suspend fun echoInt(request: Long): Long { + return request + } + + override suspend fun echoDouble(request: Double): Double { + return request + } + + override suspend fun echoBool(request: Boolean): Boolean { + return request + } + + override suspend fun echoObj(request: Any): Any { + return request + } + + override suspend fun sendSomeTypes(someTypes: SomeTypes): SomeTypes { + return someTypes + } + + override suspend fun sendSomeEnum(anEnum: SomeEnum): SomeEnum { + return anEnum + } +} + +class JniMessageApiAsyncImpl2 : JniMessageApiAsync() { + override suspend fun doNothing() { + return + } + + override suspend fun echoString(request: String): String { + return request + "1" + } + + override suspend fun echoInt(request: Long): Long { + return request + 1 + } + + override suspend fun echoDouble(request: Double): Double { + return request + 1 + } + + override suspend fun echoBool(request: Boolean): Boolean { + return !request + } + + override suspend fun echoObj(request: Any): Any { + return request + } + + override suspend fun sendSomeTypes(someTypes: SomeTypes): SomeTypes { + val newSomeTypes = someTypes.copy(anInt = someTypes.anInt + 1) + return newSomeTypes + } + + override suspend fun sendSomeEnum(anEnum: SomeEnum): SomeEnum { + return anEnum + } +} + +class JniMessageApiNullableAsyncImpl : JniMessageApiNullableAsync() { + + override suspend fun echoString(request: String?): String? { + return request + } + + override suspend fun echoInt(request: Long?): Long? { + return request + } + + override suspend fun echoDouble(request: Double?): Double? { + return request + } + + override suspend fun echoBool(request: Boolean?): Boolean? { + return request + } + + override suspend fun echoObj(request: Any?): Any? { + return request + } + + override suspend fun sendSomeNullableTypes(someTypes: SomeNullableTypes?): SomeNullableTypes? { + return someTypes + } + + override suspend fun sendSomeEnum(anEnum: SomeEnum?): SomeEnum? { + return anEnum + } +} + +// override suspend fun thinkBeforeAnswering(): String { +// delay(10L) +// return "42" +// } + class TestPluginWithSuffix : HostSmallApi { fun setUp(binding: FlutterPluginBinding, suffix: String) { @@ -921,7 +1152,7 @@ object SendClass : StreamEventsStreamHandler() { ClassEvent(EventAllNullableTypes(aNullableInt = 0))) override fun onListen(p0: Any?, sink: PigeonEventSink) { - var count: Int = 0 + var count = 0 val r: Runnable = object : Runnable { override fun run() { @@ -945,7 +1176,7 @@ class SendConsistentNumbers(private val numberToSend: Long) : private val handler = Handler(Looper.getMainLooper()) override fun onListen(p0: Any?, sink: PigeonEventSink) { - var count: Int = 0 + var count = 0 val r: Runnable = object : Runnable { override fun run() { diff --git a/packages/pigeon/platform_tests/test_plugin/example/jnigen.yaml b/packages/pigeon/platform_tests/test_plugin/example/jnigen.yaml new file mode 100644 index 000000000000..fffedbca1c26 --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/example/jnigen.yaml @@ -0,0 +1,29 @@ +android_sdk_config: + add_gradle_deps: true + android_example: '/Users/tarrinneal/work/packages/packages/pigeon/platform_tests/test_plugin/example' + +# source_path: +# - 'android/src/main/java' + +summarizer: + backend: asm + +output: + dart: + path: /Users/tarrinneal/work/packages/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/jni_tests.gen.jni.dart + structure: single_file + +log_level: all + +classes: + - 'JniMessageApi' + - 'JniMessageApiRegistrar' + - 'JniMessageApiNullable' + - 'JniMessageApiNullableRegistrar' + - 'JniMessageApiAsync' + - 'JniMessageApiAsyncRegistrar' + - 'JniMessageApiNullableAsync' + - 'JniMessageApiNullableAsyncRegistrar' + - 'SomeTypes' + - 'SomeNullableTypes' + - 'SomeEnum' diff --git a/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml b/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml index 9b5f46bcb780..62962765633e 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml +++ b/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml @@ -8,6 +8,11 @@ environment: dependencies: flutter: sdk: flutter + jnigen: + git: + url: https://github.com/dart-lang/native/ + path: pkgs/jnigen + ref: 735250a19b1a429869bfacccba833ecc93db34b6 shared_test_plugin_code: path: ../../shared_test_plugin_code test_plugin: diff --git a/packages/pigeon/platform_tests/test_plugin/pubspec.yaml b/packages/pigeon/platform_tests/test_plugin/pubspec.yaml index 0547092ec50f..601219c7bca7 100644 --- a/packages/pigeon/platform_tests/test_plugin/pubspec.yaml +++ b/packages/pigeon/platform_tests/test_plugin/pubspec.yaml @@ -25,6 +25,11 @@ flutter: dependencies: flutter: sdk: flutter + jni: + git: + url: https://github.com/dart-lang/native/ + path: pkgs/jni + ref: 735250a19b1a429869bfacccba833ecc93db34b6 dev_dependencies: flutter_test: diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 3459232c9843..ca8d9ed0be32 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -14,6 +14,11 @@ dependencies: collection: ^1.15.0 dart_style: ^3.0.0 graphs: ^2.3.1 + jni: + git: + url: https://github.com/dart-lang/native/ + path: pkgs/jni + ref: 735250a19b1a429869bfacccba833ecc93db34b6 meta: ^1.9.0 path: ^1.8.0 pub_semver: ^2.1.4 @@ -21,6 +26,11 @@ dependencies: dev_dependencies: test: ^1.11.1 + jnigen: + git: + url: https://github.com/dart-lang/native/ + path: pkgs/jnigen + ref: 735250a19b1a429869bfacccba833ecc93db34b6 topics: - codegen diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index ec52d0b25c93..b2b9726b5ebd 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -43,6 +43,13 @@ const Map> _unsupportedFiles = GeneratorLanguage.java, GeneratorLanguage.objc, }, + 'jni_tests': { + GeneratorLanguage.cpp, + GeneratorLanguage.gobject, + GeneratorLanguage.java, + GeneratorLanguage.objc, + GeneratorLanguage.swift, + }, }; String _snakeToPascalCase(String snake) { @@ -99,6 +106,7 @@ Future generateTestPigeons( 'nullable_returns', 'primitive', 'proxy_api_tests', + 'jni_tests' }; final String outputBase = p.join(baseDir, 'platform_tests', 'test_plugin'); @@ -140,6 +148,8 @@ Future generateTestPigeons( : '$outputBase/android/src/main/kotlin/com/example/test_plugin/$pascalCaseName.gen.kt', kotlinPackage: 'com.example.test_plugin', kotlinErrorClassName: kotlinErrorName, + kotlinUseJni: input == 'jni_tests', + kotlinExampleAppDirectory: '$outputBase/example', kotlinIncludeErrorClass: input != 'primitive', // iOS swiftOut: skipLanguages.contains(GeneratorLanguage.swift) @@ -252,7 +262,9 @@ Future runPigeon({ String? kotlinOut, String? kotlinPackage, String? kotlinErrorClassName, + bool kotlinUseJni = false, bool kotlinIncludeErrorClass = true, + String kotlinExampleAppDirectory = '', bool swiftIncludeErrorClass = true, String? swiftOut, String? swiftErrorClassName, @@ -310,7 +322,7 @@ Future runPigeon({ copyrightHeader: copyrightHeader, dartOut: dartOut, dartTestOut: dartTestOut, - dartOptions: const DartOptions(), + dartOptions: DartOptions(useJni: kotlinUseJni), cppHeaderOut: cppHeaderOut, cppSourceOut: cppSourceOut, cppOptions: CppOptions(namespace: cppNamespace), @@ -325,6 +337,8 @@ Future runPigeon({ package: kotlinPackage, errorClassName: kotlinErrorClassName, includeErrorClass: kotlinIncludeErrorClass, + useJni: kotlinUseJni, + exampleAppDirectory: kotlinExampleAppDirectory, ), objcHeaderOut: objcHeaderOut, objcSourceOut: objcSourceOut,