[jnigen] Type inference for generics (https://github.com/dart-lang/jnigen/issues/236) Type parameters are now named parameters instead. This allows us to toggle whether or not they're "required". A type parameter is not required if we can find it somewhere in the list of arguments. For example in `<T> f(ArrayList<T> arr)`, `T` can be inferred because it's also the element type in the `ArrayList`. There might be multiple places where a certain type parameter `T` is found within the arguments. In that case we choose the lowest common super type of all the cases.
diff --git a/pkgs/jni/lib/src/jarray.dart b/pkgs/jni/lib/src/jarray.dart index 92f05b4..8b0aead 100644 --- a/pkgs/jni/lib/src/jarray.dart +++ b/pkgs/jni/lib/src/jarray.dart
@@ -16,6 +16,22 @@ @override JArray<T> fromRef(Pointer<Void> ref) => JArray.fromRef(elementType, ref); + + @override + JObjType get superType => const JObjectType(); + + @override + final int superCount = 1; + + @override + int get hashCode => Object.hash(JArrayType, elementType); + + @override + bool operator ==(Object other) { + return other.runtimeType == JArrayType && + other is JArrayType && + elementType == other.elementType; + } } class JArray<E> extends JObject {
diff --git a/pkgs/jni/lib/src/jobject.dart b/pkgs/jni/lib/src/jobject.dart index 7477c55..dff8fda 100644 --- a/pkgs/jni/lib/src/jobject.dart +++ b/pkgs/jni/lib/src/jobject.dart
@@ -12,15 +12,33 @@ @override JObject fromRef(Pointer<Void> ref) => JObject.fromRef(ref); + + @override + JObjType get superType => const JObjectType(); + + // TODO(#70): Once interface implementation lands, other than [superType], + // we should have a list of implemented interfaces. + + @override + final int superCount = 0; + + @override + int get hashCode => (JObjectType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JObjectType && other is JObjectType; + } } Pointer<T> _getID<T extends NativeType>( - JniPointerResult Function( - Pointer<Void> ptr, Pointer<Char> name, Pointer<Char> sig) - f, - Pointer<Void> ptr, - String name, - String sig) { + JniPointerResult Function( + Pointer<Void> ptr, Pointer<Char> name, Pointer<Char> sig) + f, + Pointer<Void> ptr, + String name, + String sig, +) { final result = using( (arena) => f(ptr, name.toNativeChars(arena), sig.toNativeChars(arena))); if (result.exception != nullptr) {
diff --git a/pkgs/jni/lib/src/jstring.dart b/pkgs/jni/lib/src/jstring.dart index 5746e23..9d02df9 100644 --- a/pkgs/jni/lib/src/jstring.dart +++ b/pkgs/jni/lib/src/jstring.dart
@@ -12,6 +12,20 @@ @override JString fromRef(Pointer<Void> ref) => JString.fromRef(ref); + + @override + JObjType get superType => const JObjectType(); + + @override + final int superCount = 1; + + @override + int get hashCode => (JStringType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == JStringType && other is JStringType; + } } class JString extends JObject {
diff --git a/pkgs/jni/lib/src/types.dart b/pkgs/jni/lib/src/types.dart index 07102e8..9c0cb49 100644 --- a/pkgs/jni/lib/src/types.dart +++ b/pkgs/jni/lib/src/types.dart
@@ -34,6 +34,11 @@ } abstract class JObjType<T extends JObject> extends JType<T> { + /// Number of super types. Distance to the root type. + int get superCount; + + JObjType get superType; + const JObjType(); @override @@ -49,3 +54,22 @@ return Jni.findJniClass(signature); } } + +/// Lowest common ancestor of two types in the inheritance tree. +JObjType _lowestCommonAncestor(JObjType a, JObjType b) { + while (a.superCount > b.superCount) { + a = a.superType; + } + while (b.superCount > a.superCount) { + b = b.superType; + } + while (a != b) { + a = a.superType; + b = b.superType; + } + return a; +} + +JObjType lowestCommonSuperType(List<JObjType> types) { + return types.reduce(_lowestCommonAncestor); +}
diff --git a/pkgs/jni/test/type_test.dart b/pkgs/jni/test/type_test.dart new file mode 100644 index 0000000..0f7f5bf --- /dev/null +++ b/pkgs/jni/test/type_test.dart
@@ -0,0 +1,244 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:ffi'; +import 'dart:io'; + +import 'package:jni/jni.dart'; +import 'package:test/test.dart'; + +// Mocking this type tree: +// JObject +// | \ +// A B +// / \ \ +// C D E +// / +// F + +class A extends JObject { + A.fromRef(super.reference) : super.fromRef(); + @override + JObjType<JObject> get $type => $AType(); +} + +class $AType extends JObjType<A> { + @override + A fromRef(Pointer<Void> ref) { + return A.fromRef(ref); + } + + @override + String get signature => 'A'; + + @override + int get superCount => superType.superCount + 1; + + @override + JObjType<JObject> get superType => JObject.type; + + @override + int get hashCode => ($AType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $AType && other is $AType; + } +} + +class B extends JObject { + B.fromRef(super.reference) : super.fromRef(); + @override + JObjType<JObject> get $type => $BType(); +} + +class $BType extends JObjType<B> { + @override + B fromRef(Pointer<Void> ref) { + return B.fromRef(ref); + } + + @override + String get signature => 'B'; + + @override + int get superCount => superType.superCount + 1; + + @override + JObjType<JObject> get superType => JObject.type; + + @override + int get hashCode => ($BType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $BType && other is $BType; + } +} + +class C extends A { + C.fromRef(super.reference) : super.fromRef(); + + @override + JObjType<JObject> get $type => $CType(); +} + +class $CType extends JObjType<C> { + @override + C fromRef(Pointer<Void> ref) { + return C.fromRef(ref); + } + + @override + String get signature => 'C'; + + @override + int get superCount => superType.superCount + 1; + + @override + JObjType<JObject> get superType => $AType(); + + @override + int get hashCode => ($CType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $CType && other is $CType; + } +} + +class D extends A { + D.fromRef(super.reference) : super.fromRef(); + + @override + JObjType<JObject> get $type => $DType(); +} + +class $DType extends JObjType<D> { + @override + D fromRef(Pointer<Void> ref) { + return D.fromRef(ref); + } + + @override + String get signature => 'D'; + + @override + int get superCount => superType.superCount + 1; + + @override + JObjType<JObject> get superType => $AType(); + + @override + int get hashCode => ($DType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $DType && other is $DType; + } +} + +class E extends B { + E.fromRef(super.reference) : super.fromRef(); + + @override + JObjType<JObject> get $type => $EType(); +} + +class $EType extends JObjType<E> { + @override + E fromRef(Pointer<Void> ref) { + return E.fromRef(ref); + } + + @override + String get signature => 'E'; + + @override + int get superCount => superType.superCount + 1; + + @override + JObjType<JObject> get superType => $BType(); + + @override + int get hashCode => ($EType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EType && other is $EType; + } +} + +class F extends C { + F.fromRef(super.reference) : super.fromRef(); + + @override + JObjType<JObject> get $type => $FType(); +} + +class $FType extends JObjType<F> { + @override + F fromRef(Pointer<Void> ref) { + return F.fromRef(ref); + } + + @override + String get signature => 'F'; + + @override + int get superCount => superType.superCount + 1; + + @override + JObjType<JObject> get superType => $CType(); + + @override + int get hashCode => ($FType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $FType && other is $FType; + } +} + +void main() { + if (!Platform.isAndroid) { + try { + Jni.spawn(dylibDir: "build/jni_libs", jvmOptions: ["-Xmx128m"]); + } on JvmExistsException catch (_) { + // TODO(#51): Support destroying and reinstantiating JVM. + } + } + + test('lowestCommonSuperType', () { + expect(lowestCommonSuperType([JObject.type]), JObject.type); + expect(lowestCommonSuperType([JString.type]), JString.type); + expect(lowestCommonSuperType([JObject.type, JObject.type]), JObject.type); + expect(lowestCommonSuperType([JString.type, JString.type]), JString.type); + expect(lowestCommonSuperType([JString.type, JArray.type(JLong.type)]), + JObject.type); + }); + + test('Mocked type tree', () { + // As a reminder, this is how the type tree looks like: + // JObject + // | \ + // A B + // / \ \ + // C D E + // / + // F + expect(lowestCommonSuperType([$AType(), $BType()]), const JObjectType()); + expect(lowestCommonSuperType([$CType(), $BType()]), const JObjectType()); + expect(lowestCommonSuperType([$FType(), $BType()]), const JObjectType()); + expect(lowestCommonSuperType([$EType(), $CType(), $FType()]), + const JObjectType()); + + expect(lowestCommonSuperType([$CType(), $DType()]), $AType()); + expect(lowestCommonSuperType([$FType(), $DType()]), $AType()); + expect(lowestCommonSuperType([$FType(), $CType(), $DType()]), $AType()); + + expect(lowestCommonSuperType([$EType(), $BType()]), $BType()); + expect(lowestCommonSuperType([$BType(), $BType()]), $BType()); + }); +}
diff --git a/pkgs/jnigen/CHANGELOG.md b/pkgs/jnigen/CHANGELOG.md index d47aa13..1516220 100644 --- a/pkgs/jnigen/CHANGELOG.md +++ b/pkgs/jnigen/CHANGELOG.md
@@ -1,3 +1,10 @@ +## 0.4.0-dev +* **Breaking Change** ([#145](https://github.com/dart-lang/jnigen/issues/145)): Type arguments are now named instead of positional. +* Type parameters can now be inferred when possible. +* Fixed a bug where passing a `long` argument truncated it to `int` in pure dart bindings. +* Removed array extensions from the generated code. +* Added the ability to use source dependencies from Gradle. + ## 0.3.0 * Added the option to convert Kotlin `suspend fun` to Dart async methods. Add `suspend_fun_to_async: true` to `jnigen.yaml`.
diff --git a/pkgs/jnigen/example/in_app_java/lib/android_utils.dart b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart index 3faba5b..5925b92 100644 --- a/pkgs/jnigen/example/in_app_java/lib/android_utils.dart +++ b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart
@@ -26,9 +26,8 @@ /// from: com.example.in_app_java.AndroidUtils class AndroidUtils extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; AndroidUtils.fromRef( jni.JObjectPtr ref, @@ -46,8 +45,12 @@ /// from: static public void showToast(android.app.Activity mainActivity, java.lang.CharSequence text, int duration) static void showToast( - jni.JObject mainActivity, jni.JObject text, int duration) => - _showToast(mainActivity.reference, text.reference, duration).check(); + jni.JObject mainActivity, + jni.JObject text, + int duration, + ) { + return _showToast(mainActivity.reference, text.reference, duration).check(); + } } class $AndroidUtilsType extends jni.JObjType<AndroidUtils> { @@ -58,6 +61,20 @@ @override AndroidUtils fromRef(jni.JObjectPtr ref) => AndroidUtils.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($AndroidUtilsType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $AndroidUtilsType && other is $AndroidUtilsType; + } } /// from: androidx.emoji2.text.EmojiCompat @@ -110,9 +127,8 @@ /// loading completes use InitCallback. /// <p/> class EmojiCompat extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat.fromRef( jni.JObjectPtr ref, @@ -328,8 +344,11 @@ /// afterwords. /// ///@return Default EmojiCompat for this device, or null if there is no provider on the system. - static EmojiCompat init(jni.JObject context) => - const $EmojiCompatType().fromRef(_init(context.reference).object); + static EmojiCompat init( + jni.JObject context, + ) { + return const $EmojiCompatType().fromRef(_init(context.reference).object); + } static final _init1 = jniLookup< ffi.NativeFunction< @@ -344,11 +363,12 @@ /// /// @hide static EmojiCompat init1( - jni.JObject context, - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory - defaultFactory) => - const $EmojiCompatType() - .fromRef(_init1(context.reference, defaultFactory.reference).object); + jni.JObject context, + DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory defaultFactory, + ) { + return const $EmojiCompatType() + .fromRef(_init1(context.reference, defaultFactory.reference).object); + } static final _init2 = jniLookup< ffi.NativeFunction< @@ -365,8 +385,11 @@ /// the singleton instance and any call after that will not create a new instance and return /// immediately. ///@see EmojiCompat.Config - static EmojiCompat init2(EmojiCompat_Config config) => - const $EmojiCompatType().fromRef(_init2(config.reference).object); + static EmojiCompat init2( + EmojiCompat_Config config, + ) { + return const $EmojiCompatType().fromRef(_init2(config.reference).object); + } static final _isConfigured = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( @@ -384,7 +407,9 @@ /// This function does not check the \#getLoadState() and will return true even if the /// font is still loading, or has failed to load. ///@return true if EmojiCompat has been successfully initialized. - static bool isConfigured() => _isConfigured().boolean; + static bool isConfigured() { + return _isConfigured().boolean; + } static final _reset = jniLookup< ffi.NativeFunction< @@ -398,8 +423,11 @@ /// Used by the tests to reset EmojiCompat with a new configuration. Every time it is called a /// new instance is created with the new configuration. ///@hide - static EmojiCompat reset(EmojiCompat_Config config) => - const $EmojiCompatType().fromRef(_reset(config.reference).object); + static EmojiCompat reset( + EmojiCompat_Config config, + ) { + return const $EmojiCompatType().fromRef(_reset(config.reference).object); + } static final _reset1 = jniLookup< ffi.NativeFunction< @@ -412,8 +440,12 @@ /// /// Used by the tests to reset EmojiCompat with a new singleton instance. ///@hide - static EmojiCompat reset1(EmojiCompat emojiCompat) => - const $EmojiCompatType().fromRef(_reset1(emojiCompat.reference).object); + static EmojiCompat reset1( + EmojiCompat emojiCompat, + ) { + return const $EmojiCompatType() + .fromRef(_reset1(emojiCompat.reference).object); + } static final _skipDefaultConfigurationLookup = jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint8)>>( @@ -424,8 +456,11 @@ /// /// Reset default configuration lookup flag, for tests. ///@hide - static void skipDefaultConfigurationLookup(bool shouldSkip) => - _skipDefaultConfigurationLookup(shouldSkip ? 1 : 0).check(); + static void skipDefaultConfigurationLookup( + bool shouldSkip, + ) { + return _skipDefaultConfigurationLookup(shouldSkip ? 1 : 0).check(); + } static final _get0 = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( "EmojiCompat__get0") @@ -438,7 +473,9 @@ /// \#init(EmojiCompat.Config) is called to initialize the singleton instance. ///@return EmojiCompat instance ///@throws IllegalStateException if called before \#init(EmojiCompat.Config) - static EmojiCompat get0() => const $EmojiCompatType().fromRef(_get0().object); + static EmojiCompat get0() { + return const $EmojiCompatType().fromRef(_get0().object); + } static final _load = jniLookup< ffi.NativeFunction< @@ -461,7 +498,9 @@ /// </ul> ///@throws IllegalStateException when Config\#setMetadataLoadStrategy(int) is not set /// to \#LOAD_STRATEGY_MANUAL - void load() => _load(reference).check(); + void load() { + return _load(reference).check(); + } static final _registerInitCallback = jniLookup< ffi.NativeFunction< @@ -482,8 +521,11 @@ /// called. ///@param initCallback the initialization callback to register, cannot be {@code null} ///@see \#unregisterInitCallback(InitCallback) - void registerInitCallback(EmojiCompat_InitCallback initCallback) => - _registerInitCallback(reference, initCallback.reference).check(); + void registerInitCallback( + EmojiCompat_InitCallback initCallback, + ) { + return _registerInitCallback(reference, initCallback.reference).check(); + } static final _unregisterInitCallback = jniLookup< ffi.NativeFunction< @@ -498,8 +540,11 @@ /// /// Unregisters a callback that was added before. ///@param initCallback the callback to be removed, cannot be {@code null} - void unregisterInitCallback(EmojiCompat_InitCallback initCallback) => - _unregisterInitCallback(reference, initCallback.reference).check(); + void unregisterInitCallback( + EmojiCompat_InitCallback initCallback, + ) { + return _unregisterInitCallback(reference, initCallback.reference).check(); + } static final _getLoadState = jniLookup< ffi.NativeFunction< @@ -513,7 +558,9 @@ /// below always returns \#LOAD_STATE_SUCCEEDED. ///@return one of \#LOAD_STATE_DEFAULT, \#LOAD_STATE_LOADING, /// \#LOAD_STATE_SUCCEEDED, \#LOAD_STATE_FAILED - int getLoadState() => _getLoadState(reference).integer; + int getLoadState() { + return _getLoadState(reference).integer; + } static final _isEmojiSpanIndicatorEnabled = jniLookup< ffi.NativeFunction< @@ -525,8 +572,9 @@ /// /// @return whether a background should be drawn for the emoji for debugging ///@hide - bool isEmojiSpanIndicatorEnabled() => - _isEmojiSpanIndicatorEnabled(reference).boolean; + bool isEmojiSpanIndicatorEnabled() { + return _isEmojiSpanIndicatorEnabled(reference).boolean; + } static final _getEmojiSpanIndicatorColor = jniLookup< ffi.NativeFunction< @@ -538,8 +586,9 @@ /// /// @return color of background drawn if EmojiCompat\#isEmojiSpanIndicatorEnabled is true ///@hide - int getEmojiSpanIndicatorColor() => - _getEmojiSpanIndicatorColor(reference).integer; + int getEmojiSpanIndicatorColor() { + return _getEmojiSpanIndicatorColor(reference).integer; + } static final _getEmojiStart = jniLookup< ffi.NativeFunction< @@ -562,8 +611,12 @@ ///@param charSequence the whole sequence ///@param offset index of the emoji to look up ///@return the start index inclusively/end index exclusively - int getEmojiStart(jni.JObject charSequence, int offset) => - _getEmojiStart(reference, charSequence.reference, offset).integer; + int getEmojiStart( + jni.JObject charSequence, + int offset, + ) { + return _getEmojiStart(reference, charSequence.reference, offset).integer; + } static final _getEmojiEnd = jniLookup< ffi.NativeFunction< @@ -578,8 +631,12 @@ /// from: public int getEmojiEnd(java.lang.CharSequence charSequence, int offset) /// /// see \#getEmojiStart(CharSequence, int). - int getEmojiEnd(jni.JObject charSequence, int offset) => - _getEmojiEnd(reference, charSequence.reference, offset).integer; + int getEmojiEnd( + jni.JObject charSequence, + int offset, + ) { + return _getEmojiEnd(reference, charSequence.reference, offset).integer; + } static final _handleOnKeyDown = jniLookup< ffi.NativeFunction< @@ -608,8 +665,13 @@ /// int, KeyEvent) ///@return {@code true} if an EmojiSpan is deleted static bool handleOnKeyDown( - jni.JObject editable, int keyCode, jni.JObject event) => - _handleOnKeyDown(editable.reference, keyCode, event.reference).boolean; + jni.JObject editable, + int keyCode, + jni.JObject event, + ) { + return _handleOnKeyDown(editable.reference, keyCode, event.reference) + .boolean; + } static final _handleDeleteSurroundingText = jniLookup< ffi.NativeFunction< @@ -640,18 +702,16 @@ ///@param inCodePoints {@code true} if length parameters are in codepoints ///@return {@code true} if an EmojiSpan is deleted static bool handleDeleteSurroundingText( - jni.JObject inputConnection, - jni.JObject editable, - int beforeLength, - int afterLength, - bool inCodePoints) => - _handleDeleteSurroundingText( - inputConnection.reference, - editable.reference, - beforeLength, - afterLength, - inCodePoints ? 1 : 0) - .boolean; + jni.JObject inputConnection, + jni.JObject editable, + int beforeLength, + int afterLength, + bool inCodePoints, + ) { + return _handleDeleteSurroundingText(inputConnection.reference, + editable.reference, beforeLength, afterLength, inCodePoints ? 1 : 0) + .boolean; + } static final _hasEmojiGlyph = jniLookup< ffi.NativeFunction< @@ -669,8 +729,11 @@ ///@param sequence CharSequence representing the emoji ///@return {@code true} if EmojiCompat can render given emoji, cannot be {@code null} ///@throws IllegalStateException if not initialized yet - bool hasEmojiGlyph(jni.JObject sequence) => - _hasEmojiGlyph(reference, sequence.reference).boolean; + bool hasEmojiGlyph( + jni.JObject sequence, + ) { + return _hasEmojiGlyph(reference, sequence.reference).boolean; + } static final _hasEmojiGlyph1 = jniLookup< ffi.NativeFunction< @@ -692,8 +755,13 @@ /// equal to {@code 0}, ///@return {@code true} if EmojiCompat can render given emoji, cannot be {@code null} ///@throws IllegalStateException if not initialized yet - bool hasEmojiGlyph1(jni.JObject sequence, int metadataVersion) => - _hasEmojiGlyph1(reference, sequence.reference, metadataVersion).boolean; + bool hasEmojiGlyph1( + jni.JObject sequence, + int metadataVersion, + ) { + return _hasEmojiGlyph1(reference, sequence.reference, metadataVersion) + .boolean; + } static final _getEmojiMatch = jniLookup< ffi.NativeFunction< @@ -718,8 +786,13 @@ ///@param metadataVersion the metada version to check against, should be greater than or /// equal to {@code 0}, ///@return A match result, or decomposes if replaceAll would cause partial subsequence matches. - int getEmojiMatch(jni.JObject sequence, int metadataVersion) => - _getEmojiMatch(reference, sequence.reference, metadataVersion).integer; + int getEmojiMatch( + jni.JObject sequence, + int metadataVersion, + ) { + return _getEmojiMatch(reference, sequence.reference, metadataVersion) + .integer; + } static final _process = jniLookup< ffi.NativeFunction< @@ -738,8 +811,12 @@ ///@param charSequence CharSequence to add the EmojiSpans ///@throws IllegalStateException if not initialized yet ///@see \#process(CharSequence, int, int) - jni.JObject process(jni.JObject charSequence) => const jni.JObjectType() - .fromRef(_process(reference, charSequence.reference).object); + jni.JObject process( + jni.JObject charSequence, + ) { + return const jni.JObjectType() + .fromRef(_process(reference, charSequence.reference).object); + } static final _process1 = jniLookup< ffi.NativeFunction< @@ -778,9 +855,14 @@ /// {@code start < 0}, {@code end < 0}, {@code end < start}, /// {@code start > charSequence.length()}, /// {@code end > charSequence.length()} - jni.JObject process1(jni.JObject charSequence, int start, int end) => - const jni.JObjectType().fromRef( - _process1(reference, charSequence.reference, start, end).object); + jni.JObject process1( + jni.JObject charSequence, + int start, + int end, + ) { + return const jni.JObjectType().fromRef( + _process1(reference, charSequence.reference, start, end).object); + } static final _process2 = jniLookup< ffi.NativeFunction< @@ -824,10 +906,15 @@ /// {@code end > charSequence.length()} /// {@code maxEmojiCount < 0} jni.JObject process2( - jni.JObject charSequence, int start, int end, int maxEmojiCount) => - const jni.JObjectType().fromRef(_process2( - reference, charSequence.reference, start, end, maxEmojiCount) - .object); + jni.JObject charSequence, + int start, + int end, + int maxEmojiCount, + ) { + return const jni.JObjectType().fromRef( + _process2(reference, charSequence.reference, start, end, maxEmojiCount) + .object); + } static final _process3 = jniLookup< ffi.NativeFunction< @@ -875,16 +962,17 @@ /// {@code start > charSequence.length()}, /// {@code end > charSequence.length()} /// {@code maxEmojiCount < 0} - jni.JObject process3(jni.JObject charSequence, int start, int end, - int maxEmojiCount, int replaceStrategy) => - const jni.JObjectType().fromRef(_process3( - reference, - charSequence.reference, - start, - end, - maxEmojiCount, - replaceStrategy) - .object); + jni.JObject process3( + jni.JObject charSequence, + int start, + int end, + int maxEmojiCount, + int replaceStrategy, + ) { + return const jni.JObjectType().fromRef(_process3(reference, + charSequence.reference, start, end, maxEmojiCount, replaceStrategy) + .object); + } static final _getAssetSignature = jniLookup< ffi.NativeFunction< @@ -899,8 +987,10 @@ /// constructed using emoji assets. Can be used to detect if currently loaded asset is different /// then previous executions. When used on devices running API 18 or below, returns empty string. ///@throws IllegalStateException if not initialized yet - jni.JString getAssetSignature() => - const jni.JStringType().fromRef(_getAssetSignature(reference).object); + jni.JString getAssetSignature() { + return const jni.JStringType() + .fromRef(_getAssetSignature(reference).object); + } static final _updateEditorInfo = jniLookup< ffi.NativeFunction< @@ -927,8 +1017,11 @@ /// android.widget.TextView\#onCreateInputConnection(EditorInfo) ///@see \#EDITOR_INFO_METAVERSION_KEY ///@see \#EDITOR_INFO_REPLACE_ALL_KEY - void updateEditorInfo(jni.JObject outAttrs) => - _updateEditorInfo(reference, outAttrs.reference).check(); + void updateEditorInfo( + jni.JObject outAttrs, + ) { + return _updateEditorInfo(reference, outAttrs.reference).check(); + } } class $EmojiCompatType extends jni.JObjType<EmojiCompat> { @@ -939,6 +1032,20 @@ @override EmojiCompat fromRef(jni.JObjectPtr ref) => EmojiCompat.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompatType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompatType && other is $EmojiCompatType; + } } /// from: androidx.emoji2.text.EmojiCompat$Config @@ -947,9 +1054,8 @@ /// \#init(Config) is called. ///@see \#init(EmojiCompat.Config) class EmojiCompat_Config extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_Config.fromRef( jni.JObjectPtr ref, @@ -968,8 +1074,11 @@ /// /// Default constructor. ///@param metadataLoader MetadataRepoLoader instance, cannot be {@code null} - EmojiCompat_Config(EmojiCompat_MetadataRepoLoader metadataLoader) - : super.fromRef(_ctor(metadataLoader.reference).object); + factory EmojiCompat_Config( + EmojiCompat_MetadataRepoLoader metadataLoader, + ) { + return EmojiCompat_Config.fromRef(_ctor(metadataLoader.reference).object); + } static final _registerInitCallback = jniLookup< ffi.NativeFunction< @@ -987,9 +1096,11 @@ ///@param initCallback the initialization callback to register, cannot be {@code null} ///@return EmojiCompat.Config instance EmojiCompat_Config registerInitCallback( - EmojiCompat_InitCallback initCallback) => - const $EmojiCompat_ConfigType().fromRef( - _registerInitCallback(reference, initCallback.reference).object); + EmojiCompat_InitCallback initCallback, + ) { + return const $EmojiCompat_ConfigType().fromRef( + _registerInitCallback(reference, initCallback.reference).object); + } static final _unregisterInitCallback = jniLookup< ffi.NativeFunction< @@ -1007,9 +1118,11 @@ ///@param initCallback the initialization callback to be removed, cannot be {@code null} ///@return EmojiCompat.Config instance EmojiCompat_Config unregisterInitCallback( - EmojiCompat_InitCallback initCallback) => - const $EmojiCompat_ConfigType().fromRef( - _unregisterInitCallback(reference, initCallback.reference).object); + EmojiCompat_InitCallback initCallback, + ) { + return const $EmojiCompat_ConfigType().fromRef( + _unregisterInitCallback(reference, initCallback.reference).object); + } static final _setReplaceAll = jniLookup< ffi.NativeFunction< @@ -1025,9 +1138,12 @@ /// can render an emoji and do not replace those emojis. ///@param replaceAll replace all emojis found with EmojiSpans ///@return EmojiCompat.Config instance - EmojiCompat_Config setReplaceAll(bool replaceAll) => - const $EmojiCompat_ConfigType() - .fromRef(_setReplaceAll(reference, replaceAll ? 1 : 0).object); + EmojiCompat_Config setReplaceAll( + bool replaceAll, + ) { + return const $EmojiCompat_ConfigType() + .fromRef(_setReplaceAll(reference, replaceAll ? 1 : 0).object); + } static final _setUseEmojiAsDefaultStyle = jniLookup< ffi.NativeFunction< @@ -1050,10 +1166,13 @@ /// exception emojis that should be still presented as text style. ///@param useEmojiAsDefaultStyle whether to use the emoji style presentation for all emojis /// that would be presented as text style by default - EmojiCompat_Config setUseEmojiAsDefaultStyle(bool useEmojiAsDefaultStyle) => - const $EmojiCompat_ConfigType().fromRef( - _setUseEmojiAsDefaultStyle(reference, useEmojiAsDefaultStyle ? 1 : 0) - .object); + EmojiCompat_Config setUseEmojiAsDefaultStyle( + bool useEmojiAsDefaultStyle, + ) { + return const $EmojiCompat_ConfigType().fromRef( + _setUseEmojiAsDefaultStyle(reference, useEmojiAsDefaultStyle ? 1 : 0) + .object); + } static final _setUseEmojiAsDefaultStyle1 = jniLookup< ffi.NativeFunction< @@ -1079,13 +1198,16 @@ /// not. When no exception is wanted, the method /// \#setUseEmojiAsDefaultStyle(boolean) should /// be used instead. - EmojiCompat_Config setUseEmojiAsDefaultStyle1(bool useEmojiAsDefaultStyle, - jni.JObject emojiAsDefaultStyleExceptions) => - const $EmojiCompat_ConfigType().fromRef(_setUseEmojiAsDefaultStyle1( - reference, - useEmojiAsDefaultStyle ? 1 : 0, - emojiAsDefaultStyleExceptions.reference) - .object); + EmojiCompat_Config setUseEmojiAsDefaultStyle1( + bool useEmojiAsDefaultStyle, + jni.JObject emojiAsDefaultStyleExceptions, + ) { + return const $EmojiCompat_ConfigType().fromRef(_setUseEmojiAsDefaultStyle1( + reference, + useEmojiAsDefaultStyle ? 1 : 0, + emojiAsDefaultStyleExceptions.reference) + .object); + } static final _setEmojiSpanIndicatorEnabled = jniLookup< ffi.NativeFunction< @@ -1102,10 +1224,13 @@ ///@param emojiSpanIndicatorEnabled when {@code true} a background is drawn for each emoji /// that is replaced EmojiCompat_Config setEmojiSpanIndicatorEnabled( - bool emojiSpanIndicatorEnabled) => - const $EmojiCompat_ConfigType().fromRef(_setEmojiSpanIndicatorEnabled( - reference, emojiSpanIndicatorEnabled ? 1 : 0) - .object); + bool emojiSpanIndicatorEnabled, + ) { + return const $EmojiCompat_ConfigType().fromRef( + _setEmojiSpanIndicatorEnabled( + reference, emojiSpanIndicatorEnabled ? 1 : 0) + .object); + } static final _setEmojiSpanIndicatorColor = jniLookup< ffi.NativeFunction< @@ -1119,9 +1244,12 @@ /// Sets the color used as emoji span indicator. The default value is /// Color\#GREEN Color.GREEN. ///@see \#setEmojiSpanIndicatorEnabled(boolean) - EmojiCompat_Config setEmojiSpanIndicatorColor(int color) => - const $EmojiCompat_ConfigType() - .fromRef(_setEmojiSpanIndicatorColor(reference, color).object); + EmojiCompat_Config setEmojiSpanIndicatorColor( + int color, + ) { + return const $EmojiCompat_ConfigType() + .fromRef(_setEmojiSpanIndicatorColor(reference, color).object); + } static final _setMetadataLoadStrategy = jniLookup< ffi.NativeFunction< @@ -1164,9 +1292,12 @@ /// </pre> ///@param strategy one of EmojiCompat\#LOAD_STRATEGY_DEFAULT, /// EmojiCompat\#LOAD_STRATEGY_MANUAL - EmojiCompat_Config setMetadataLoadStrategy(int strategy) => - const $EmojiCompat_ConfigType() - .fromRef(_setMetadataLoadStrategy(reference, strategy).object); + EmojiCompat_Config setMetadataLoadStrategy( + int strategy, + ) { + return const $EmojiCompat_ConfigType() + .fromRef(_setMetadataLoadStrategy(reference, strategy).object); + } static final _setSpanFactory = jniLookup< ffi.NativeFunction< @@ -1182,9 +1313,12 @@ /// Set the span factory used to actually draw emoji replacements. ///@param factory custum span factory that can draw the emoji replacements ///@return this - EmojiCompat_Config setSpanFactory(EmojiCompat_SpanFactory factory0) => - const $EmojiCompat_ConfigType() - .fromRef(_setSpanFactory(reference, factory0.reference).object); + EmojiCompat_Config setSpanFactory( + EmojiCompat_SpanFactory factory0, + ) { + return const $EmojiCompat_ConfigType() + .fromRef(_setSpanFactory(reference, factory0.reference).object); + } static final _setGlyphChecker = jniLookup< ffi.NativeFunction< @@ -1201,9 +1335,12 @@ /// The interface that is used by EmojiCompat in order to check if a given emoji can be /// rendered by the system. ///@param glyphChecker GlyphChecker instance to be used. - EmojiCompat_Config setGlyphChecker(EmojiCompat_GlyphChecker glyphChecker) => - const $EmojiCompat_ConfigType() - .fromRef(_setGlyphChecker(reference, glyphChecker.reference).object); + EmojiCompat_Config setGlyphChecker( + EmojiCompat_GlyphChecker glyphChecker, + ) { + return const $EmojiCompat_ConfigType() + .fromRef(_setGlyphChecker(reference, glyphChecker.reference).object); + } static final _getMetadataRepoLoader = jniLookup< ffi.NativeFunction< @@ -1215,9 +1352,10 @@ /// The returned object must be deleted after use, by calling the `delete` method. /// /// Returns the MetadataRepoLoader. - EmojiCompat_MetadataRepoLoader getMetadataRepoLoader() => - const $EmojiCompat_MetadataRepoLoaderType() - .fromRef(_getMetadataRepoLoader(reference).object); + EmojiCompat_MetadataRepoLoader getMetadataRepoLoader() { + return const $EmojiCompat_MetadataRepoLoaderType() + .fromRef(_getMetadataRepoLoader(reference).object); + } } class $EmojiCompat_ConfigType extends jni.JObjType<EmojiCompat_Config> { @@ -1229,6 +1367,21 @@ @override EmojiCompat_Config fromRef(jni.JObjectPtr ref) => EmojiCompat_Config.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_ConfigType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_ConfigType && + other is $EmojiCompat_ConfigType; + } } /// from: androidx.emoji2.text.EmojiCompat$MetadataRepoLoaderCallback @@ -1236,9 +1389,8 @@ /// Callback to inform EmojiCompat about the state of the metadata load. Passed to /// MetadataRepoLoader during MetadataRepoLoader\#load(MetadataRepoLoaderCallback) call. class EmojiCompat_MetadataRepoLoaderCallback extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_MetadataRepoLoaderCallback.fromRef( jni.JObjectPtr ref, @@ -1252,7 +1404,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - EmojiCompat_MetadataRepoLoaderCallback() : super.fromRef(_ctor().object); + factory EmojiCompat_MetadataRepoLoaderCallback() { + return EmojiCompat_MetadataRepoLoaderCallback.fromRef(_ctor().object); + } static final _onLoaded = jniLookup< ffi.NativeFunction< @@ -1267,8 +1421,11 @@ /// /// Called by MetadataRepoLoader when metadata is loaded successfully. ///@param metadataRepo MetadataRepo instance, cannot be {@code null} - void onLoaded(jni.JObject metadataRepo) => - _onLoaded(reference, metadataRepo.reference).check(); + void onLoaded( + jni.JObject metadataRepo, + ) { + return _onLoaded(reference, metadataRepo.reference).check(); + } static final _onFailed = jniLookup< ffi.NativeFunction< @@ -1283,8 +1440,11 @@ /// /// Called by MetadataRepoLoader if an error occurs while loading the metadata. ///@param throwable the exception that caused the failure, {@code nullable} - void onFailed(jni.JObject throwable) => - _onFailed(reference, throwable.reference).check(); + void onFailed( + jni.JObject throwable, + ) { + return _onFailed(reference, throwable.reference).check(); + } } class $EmojiCompat_MetadataRepoLoaderCallbackType @@ -1298,15 +1458,29 @@ @override EmojiCompat_MetadataRepoLoaderCallback fromRef(jni.JObjectPtr ref) => EmojiCompat_MetadataRepoLoaderCallback.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_MetadataRepoLoaderCallbackType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_MetadataRepoLoaderCallbackType && + other is $EmojiCompat_MetadataRepoLoaderCallbackType; + } } /// from: androidx.emoji2.text.EmojiCompat$GlyphChecker /// /// Interface to check if a given emoji exists on the system. class EmojiCompat_GlyphChecker extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_GlyphChecker.fromRef( jni.JObjectPtr ref, @@ -1363,9 +1537,15 @@ ///@param end the exclusive end offset for the emoji in the {@code charSequence} ///@param sdkAdded the API version that the emoji was added in AOSP ///@return true if the given sequence can be rendered as a single glyph, otherwise false. - bool hasGlyph(jni.JObject charSequence, int start, int end, int sdkAdded) => - _hasGlyph(reference, charSequence.reference, start, end, sdkAdded) - .boolean; + bool hasGlyph( + jni.JObject charSequence, + int start, + int end, + int sdkAdded, + ) { + return _hasGlyph(reference, charSequence.reference, start, end, sdkAdded) + .boolean; + } } class $EmojiCompat_GlyphCheckerType @@ -1378,15 +1558,29 @@ @override EmojiCompat_GlyphChecker fromRef(jni.JObjectPtr ref) => EmojiCompat_GlyphChecker.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_GlyphCheckerType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_GlyphCheckerType && + other is $EmojiCompat_GlyphCheckerType; + } } /// from: androidx.emoji2.text.EmojiCompat$MetadataRepoLoader /// /// Interface to load emoji metadata. class EmojiCompat_MetadataRepoLoader extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_MetadataRepoLoader.fromRef( jni.JObjectPtr ref, @@ -1409,8 +1603,11 @@ /// MetadataRepoLoaderCallback\#onFailed(Throwable) should be called. When used on /// devices running API 18 or below, this function is never called. ///@param loaderCallback callback to signal the loading state - void load(EmojiCompat_MetadataRepoLoaderCallback loaderCallback) => - _load(reference, loaderCallback.reference).check(); + void load( + EmojiCompat_MetadataRepoLoaderCallback loaderCallback, + ) { + return _load(reference, loaderCallback.reference).check(); + } } class $EmojiCompat_MetadataRepoLoaderType @@ -1424,15 +1621,29 @@ @override EmojiCompat_MetadataRepoLoader fromRef(jni.JObjectPtr ref) => EmojiCompat_MetadataRepoLoader.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_MetadataRepoLoaderType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_MetadataRepoLoaderType && + other is $EmojiCompat_MetadataRepoLoaderType; + } } /// from: androidx.emoji2.text.EmojiCompat$InitCallback /// /// Listener class for the initialization of the EmojiCompat. class EmojiCompat_InitCallback extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_InitCallback.fromRef( jni.JObjectPtr ref, @@ -1446,7 +1657,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - EmojiCompat_InitCallback() : super.fromRef(_ctor().object); + factory EmojiCompat_InitCallback() { + return EmojiCompat_InitCallback.fromRef(_ctor().object); + } static final _onInitialized = jniLookup< ffi.NativeFunction< @@ -1458,7 +1671,9 @@ /// /// Called when EmojiCompat is initialized and the emoji data is loaded. When used on devices /// running API 18 or below, this function is always called. - void onInitialized() => _onInitialized(reference).check(); + void onInitialized() { + return _onInitialized(reference).check(); + } static final _onFailed = jniLookup< ffi.NativeFunction< @@ -1472,8 +1687,11 @@ /// /// Called when an unrecoverable error occurs during EmojiCompat initialization. When used on /// devices running API 18 or below, this function is never called. - void onFailed(jni.JObject throwable) => - _onFailed(reference, throwable.reference).check(); + void onFailed( + jni.JObject throwable, + ) { + return _onFailed(reference, throwable.reference).check(); + } } class $EmojiCompat_InitCallbackType @@ -1486,15 +1704,29 @@ @override EmojiCompat_InitCallback fromRef(jni.JObjectPtr ref) => EmojiCompat_InitCallback.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_InitCallbackType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_InitCallbackType && + other is $EmojiCompat_InitCallbackType; + } } /// from: androidx.emoji2.text.EmojiCompat$DefaultSpanFactory /// /// @hide class EmojiCompat_DefaultSpanFactory extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_DefaultSpanFactory.fromRef( jni.JObjectPtr ref, @@ -1508,7 +1740,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - EmojiCompat_DefaultSpanFactory() : super.fromRef(_ctor().object); + factory EmojiCompat_DefaultSpanFactory() { + return EmojiCompat_DefaultSpanFactory.fromRef(_ctor().object); + } static final _createSpan = jniLookup< ffi.NativeFunction< @@ -1526,8 +1760,12 @@ ///@param rasterizer TypefaceEmojiRasterizer instance, which can draw the emoji onto a /// Canvas. ///@return TypefaceEmojiSpan - jni.JObject createSpan(jni.JObject rasterizer) => const jni.JObjectType() - .fromRef(_createSpan(reference, rasterizer.reference).object); + jni.JObject createSpan( + jni.JObject rasterizer, + ) { + return const jni.JObjectType() + .fromRef(_createSpan(reference, rasterizer.reference).object); + } } class $EmojiCompat_DefaultSpanFactoryType @@ -1541,6 +1779,21 @@ @override EmojiCompat_DefaultSpanFactory fromRef(jni.JObjectPtr ref) => EmojiCompat_DefaultSpanFactory.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_DefaultSpanFactoryType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_DefaultSpanFactoryType && + other is $EmojiCompat_DefaultSpanFactoryType; + } } /// from: androidx.emoji2.text.EmojiCompat$SpanFactory @@ -1552,9 +1805,8 @@ /// Apps should use this only if they want to control the drawing of EmojiSpans for non-standard /// emoji display (for example, resizing or repositioning emoji). class EmojiCompat_SpanFactory extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; EmojiCompat_SpanFactory.fromRef( jni.JObjectPtr ref, @@ -1578,8 +1830,12 @@ ///@param rasterizer TypefaceEmojiRasterizer instance, which can draw the emoji onto a /// Canvas. ///@return EmojiSpan instance that can use TypefaceEmojiRasterizer to draw emoji. - jni.JObject createSpan(jni.JObject rasterizer) => const jni.JObjectType() - .fromRef(_createSpan(reference, rasterizer.reference).object); + jni.JObject createSpan( + jni.JObject rasterizer, + ) { + return const jni.JObjectType() + .fromRef(_createSpan(reference, rasterizer.reference).object); + } } class $EmojiCompat_SpanFactoryType @@ -1592,6 +1848,21 @@ @override EmojiCompat_SpanFactory fromRef(jni.JObjectPtr ref) => EmojiCompat_SpanFactory.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($EmojiCompat_SpanFactoryType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $EmojiCompat_SpanFactoryType && + other is $EmojiCompat_SpanFactoryType; + } } /// from: androidx.emoji2.text.DefaultEmojiCompatConfig @@ -1631,9 +1902,8 @@ /// <li>It <i>MUST</i> be installed in the system image.</li> /// </ol> class DefaultEmojiCompatConfig extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; DefaultEmojiCompatConfig.fromRef( jni.JObjectPtr ref, @@ -1659,8 +1929,11 @@ ///@param context context for lookup ///@return A valid config for downloading the emoji compat font, or null if no font provider /// could be found. - static jni.JObject create(jni.JObject context) => - const jni.JObjectType().fromRef(_create(context.reference).object); + static jni.JObject create( + jni.JObject context, + ) { + return const jni.JObjectType().fromRef(_create(context.reference).object); + } } class $DefaultEmojiCompatConfigType @@ -1673,6 +1946,21 @@ @override DefaultEmojiCompatConfig fromRef(jni.JObjectPtr ref) => DefaultEmojiCompatConfig.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($DefaultEmojiCompatConfigType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $DefaultEmojiCompatConfigType && + other is $DefaultEmojiCompatConfigType; + } } /// from: androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 @@ -1681,9 +1969,8 @@ ///@hide class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 extends DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28.fromRef( jni.JObjectPtr ref, @@ -1698,8 +1985,10 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28() - : super.fromRef(_ctor().object); + factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28() { + return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28 + .fromRef(_ctor().object); + } static final _getSigningSignatures1 = jniLookup< ffi.NativeFunction< @@ -1713,10 +2002,14 @@ /// from: public android.content.pm.Signature[] getSigningSignatures(android.content.pm.PackageManager packageManager, java.lang.String providerPackage) /// The returned object must be deleted after use, by calling the `delete` method. jni.JArray<jni.JObject> getSigningSignatures1( - jni.JObject packageManager, jni.JString providerPackage) => - const jni.JArrayType(jni.JObjectType()).fromRef(_getSigningSignatures1( - reference, packageManager.reference, providerPackage.reference) - .object); + jni.JObject packageManager, + jni.JString providerPackage, + ) { + return const jni.JArrayType(jni.JObjectType()).fromRef( + _getSigningSignatures1( + reference, packageManager.reference, providerPackage.reference) + .object); + } } class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28Type @@ -1733,6 +2026,26 @@ jni.JObjectPtr ref) => DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28.fromRef( ref); + + @override + jni.JObjType get superType => + const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19Type(); + + @override + final superCount = 3; + + @override + int get hashCode => + ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28Type) + .hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == + $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28Type && + other + is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28Type; + } } /// from: androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 @@ -1741,9 +2054,8 @@ ///@hide class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 extends DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19.fromRef( jni.JObjectPtr ref, @@ -1758,8 +2070,10 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19() - : super.fromRef(_ctor().object); + factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19() { + return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19 + .fromRef(_ctor().object); + } static final _queryIntentContentProviders = jniLookup< ffi.NativeFunction< @@ -1776,10 +2090,14 @@ /// from: public java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(android.content.pm.PackageManager packageManager, android.content.Intent intent, int flags) /// The returned object must be deleted after use, by calling the `delete` method. jni.JObject queryIntentContentProviders( - jni.JObject packageManager, jni.JObject intent, int flags) => - const jni.JObjectType().fromRef(_queryIntentContentProviders( - reference, packageManager.reference, intent.reference, flags) - .object); + jni.JObject packageManager, + jni.JObject intent, + int flags, + ) { + return const jni.JObjectType().fromRef(_queryIntentContentProviders( + reference, packageManager.reference, intent.reference, flags) + .object); + } static final _getProviderInfo = jniLookup< ffi.NativeFunction< @@ -1792,9 +2110,12 @@ /// from: public android.content.pm.ProviderInfo getProviderInfo(android.content.pm.ResolveInfo resolveInfo) /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject getProviderInfo(jni.JObject resolveInfo) => - const jni.JObjectType() - .fromRef(_getProviderInfo(reference, resolveInfo.reference).object); + jni.JObject getProviderInfo( + jni.JObject resolveInfo, + ) { + return const jni.JObjectType() + .fromRef(_getProviderInfo(reference, resolveInfo.reference).object); + } } class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19Type @@ -1811,6 +2132,26 @@ jni.JObjectPtr ref) => DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19.fromRef( ref); + + @override + jni.JObjType get superType => + const $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelperType(); + + @override + final superCount = 2; + + @override + int get hashCode => + ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19Type) + .hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == + $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19Type && + other + is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19Type; + } } /// from: androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper @@ -1819,9 +2160,8 @@ ///@hide class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper.fromRef( jni.JObjectPtr ref, @@ -1836,8 +2176,10 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper() - : super.fromRef(_ctor().object); + factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper() { + return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper.fromRef( + _ctor().object); + } static final _getSigningSignatures = jniLookup< ffi.NativeFunction< @@ -1853,10 +2195,14 @@ /// /// Get the signing signatures for a package in package manager. jni.JArray<jni.JObject> getSigningSignatures( - jni.JObject packageManager, jni.JString providerPackage) => - const jni.JArrayType(jni.JObjectType()).fromRef(_getSigningSignatures( - reference, packageManager.reference, providerPackage.reference) - .object); + jni.JObject packageManager, + jni.JString providerPackage, + ) { + return const jni.JArrayType(jni.JObjectType()).fromRef( + _getSigningSignatures( + reference, packageManager.reference, providerPackage.reference) + .object); + } static final _queryIntentContentProviders = jniLookup< ffi.NativeFunction< @@ -1875,10 +2221,14 @@ /// /// Get the content provider by intent. jni.JObject queryIntentContentProviders( - jni.JObject packageManager, jni.JObject intent, int flags) => - const jni.JObjectType().fromRef(_queryIntentContentProviders( - reference, packageManager.reference, intent.reference, flags) - .object); + jni.JObject packageManager, + jni.JObject intent, + int flags, + ) { + return const jni.JObjectType().fromRef(_queryIntentContentProviders( + reference, packageManager.reference, intent.reference, flags) + .object); + } static final _getProviderInfo = jniLookup< ffi.NativeFunction< @@ -1895,9 +2245,12 @@ /// Get a ProviderInfo, if present, from a ResolveInfo ///@param resolveInfo the subject ///@return resolveInfo.providerInfo above API 19 - jni.JObject getProviderInfo(jni.JObject resolveInfo) => - const jni.JObjectType() - .fromRef(_getProviderInfo(reference, resolveInfo.reference).object); + jni.JObject getProviderInfo( + jni.JObject resolveInfo, + ) { + return const jni.JObjectType() + .fromRef(_getProviderInfo(reference, resolveInfo.reference).object); + } } class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelperType extends jni @@ -1912,6 +2265,23 @@ DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper fromRef( jni.JObjectPtr ref) => DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => + ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelperType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == + $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelperType && + other is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelperType; + } } /// from: androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory @@ -1921,9 +2291,8 @@ ///@hide class DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory.fromRef( jni.JObjectPtr ref, @@ -1942,9 +2311,12 @@ /// The returned object must be deleted after use, by calling the `delete` method. /// /// @hide - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory( - DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper helper) - : super.fromRef(_ctor(helper.reference).object); + factory DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory( + DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper helper, + ) { + return DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory.fromRef( + _ctor(helper.reference).object); + } static final _create = jniLookup< ffi.NativeFunction< @@ -1960,9 +2332,12 @@ /// /// @see DefaultEmojiCompatConfig\#create ///@hide - EmojiCompat_Config create(jni.JObject context) => - const $EmojiCompat_ConfigType() - .fromRef(_create(reference, context.reference).object); + EmojiCompat_Config create( + jni.JObject context, + ) { + return const $EmojiCompat_ConfigType() + .fromRef(_create(reference, context.reference).object); + } } class $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactoryType extends jni @@ -1977,13 +2352,29 @@ DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory fromRef( jni.JObjectPtr ref) => DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => + ($DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactoryType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == + $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactoryType && + other is $DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactoryType; + } } /// from: android.os.Build class Build extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; Build.fromRef( jni.JObjectPtr ref, @@ -2264,7 +2655,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - Build() : super.fromRef(_ctor().object); + factory Build() { + return Build.fromRef(_ctor().object); + } static final _getSerial = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( @@ -2273,8 +2666,9 @@ /// from: static public java.lang.String getSerial() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JString getSerial() => - const jni.JStringType().fromRef(_getSerial().object); + static jni.JString getSerial() { + return const jni.JStringType().fromRef(_getSerial().object); + } static final _getFingerprintedPartitions = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( @@ -2283,8 +2677,10 @@ /// from: static public java.util.List getFingerprintedPartitions() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JObject getFingerprintedPartitions() => - const jni.JObjectType().fromRef(_getFingerprintedPartitions().object); + static jni.JObject getFingerprintedPartitions() { + return const jni.JObjectType() + .fromRef(_getFingerprintedPartitions().object); + } static final _getRadioVersion = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( @@ -2293,8 +2689,9 @@ /// from: static public java.lang.String getRadioVersion() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JString getRadioVersion() => - const jni.JStringType().fromRef(_getRadioVersion().object); + static jni.JString getRadioVersion() { + return const jni.JStringType().fromRef(_getRadioVersion().object); + } } class $BuildType extends jni.JObjType<Build> { @@ -2305,32 +2702,46 @@ @override Build fromRef(jni.JObjectPtr ref) => Build.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($BuildType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $BuildType && other is $BuildType; + } } /// from: java.util.HashMap -class HashMap<K extends jni.JObject, V extends jni.JObject> +class HashMap<$K extends jni.JObject, $V extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type($K, $V); + late final jni.JObjType $type = type(K, V); - final jni.JObjType<K> $K; - final jni.JObjType<V> $V; + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; HashMap.fromRef( - this.$K, - this.$V, + this.K, + this.V, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $HashMapType<K, V> type<K extends jni.JObject, V extends jni.JObject>( - jni.JObjType<K> $K, - jni.JObjType<V> $V, + static $HashMapType<$K, $V> + type<$K extends jni.JObject, $V extends jni.JObject>( + jni.JObjType<$K> K, + jni.JObjType<$V> V, ) { return $HashMapType( - $K, - $V, + K, + V, ); } @@ -2341,8 +2752,14 @@ /// from: public void <init>(int i, float f) /// The returned object must be deleted after use, by calling the `delete` method. - HashMap(this.$K, this.$V, int i, double f) - : super.fromRef(_ctor(i, f).object); + factory HashMap( + int i, + double f, { + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return HashMap.fromRef(K, V, _ctor(i, f).object); + } static final _ctor1 = jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( @@ -2351,7 +2768,13 @@ /// from: public void <init>(int i) /// The returned object must be deleted after use, by calling the `delete` method. - HashMap.ctor1(this.$K, this.$V, int i) : super.fromRef(_ctor1(i).object); + factory HashMap.ctor1( + int i, { + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return HashMap.fromRef(K, V, _ctor1(i).object); + } static final _ctor2 = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("HashMap__ctor2") @@ -2359,7 +2782,12 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - HashMap.ctor2(this.$K, this.$V) : super.fromRef(_ctor2().object); + factory HashMap.ctor2({ + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return HashMap.fromRef(K, V, _ctor2().object); + } static final _ctor3 = jniLookup< ffi.NativeFunction< @@ -2368,8 +2796,13 @@ /// from: public void <init>(java.util.Map map) /// The returned object must be deleted after use, by calling the `delete` method. - HashMap.ctor3(this.$K, this.$V, jni.JObject map) - : super.fromRef(_ctor3(map.reference).object); + factory HashMap.ctor3( + jni.JObject map, { + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return HashMap.fromRef(K, V, _ctor3(map.reference).object); + } static final _size = jniLookup< ffi.NativeFunction< @@ -2377,7 +2810,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public int size() - int size() => _size(reference).integer; + int size() { + return _size(reference).integer; + } static final _isEmpty = jniLookup< ffi.NativeFunction< @@ -2386,7 +2821,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public boolean isEmpty() - bool isEmpty() => _isEmpty(reference).boolean; + bool isEmpty() { + return _isEmpty(reference).boolean; + } static final _get0 = jniLookup< ffi.NativeFunction< @@ -2398,8 +2835,11 @@ /// from: public V get(java.lang.Object object) /// The returned object must be deleted after use, by calling the `delete` method. - V get0(jni.JObject object) => - $V.fromRef(_get0(reference, object.reference).object); + $V get0( + jni.JObject object, + ) { + return V.fromRef(_get0(reference, object.reference).object); + } static final _containsKey = jniLookup< ffi.NativeFunction< @@ -2410,8 +2850,11 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public boolean containsKey(java.lang.Object object) - bool containsKey(jni.JObject object) => - _containsKey(reference, object.reference).boolean; + bool containsKey( + jni.JObject object, + ) { + return _containsKey(reference, object.reference).boolean; + } static final _put = jniLookup< ffi.NativeFunction< @@ -2425,8 +2868,13 @@ /// from: public V put(K object, V object1) /// The returned object must be deleted after use, by calling the `delete` method. - V put(K object, V object1) => - $V.fromRef(_put(reference, object.reference, object1.reference).object); + $V put( + $K object, + $V object1, + ) { + return V + .fromRef(_put(reference, object.reference, object1.reference).object); + } static final _putAll = jniLookup< ffi.NativeFunction< @@ -2437,7 +2885,11 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public void putAll(java.util.Map map) - void putAll(jni.JObject map) => _putAll(reference, map.reference).check(); + void putAll( + jni.JObject map, + ) { + return _putAll(reference, map.reference).check(); + } static final _remove = jniLookup< ffi.NativeFunction< @@ -2449,8 +2901,11 @@ /// from: public V remove(java.lang.Object object) /// The returned object must be deleted after use, by calling the `delete` method. - V remove(jni.JObject object) => - $V.fromRef(_remove(reference, object.reference).object); + $V remove( + jni.JObject object, + ) { + return V.fromRef(_remove(reference, object.reference).object); + } static final _clear = jniLookup< ffi.NativeFunction< @@ -2458,7 +2913,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public void clear() - void clear() => _clear(reference).check(); + void clear() { + return _clear(reference).check(); + } static final _containsValue = jniLookup< ffi.NativeFunction< @@ -2469,8 +2926,11 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public boolean containsValue(java.lang.Object object) - bool containsValue(jni.JObject object) => - _containsValue(reference, object.reference).boolean; + bool containsValue( + jni.JObject object, + ) { + return _containsValue(reference, object.reference).boolean; + } static final _keySet = jniLookup< ffi.NativeFunction< @@ -2479,8 +2939,9 @@ /// from: public java.util.Set keySet() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject keySet() => - const jni.JObjectType().fromRef(_keySet(reference).object); + jni.JObject keySet() { + return const jni.JObjectType().fromRef(_keySet(reference).object); + } static final _values = jniLookup< ffi.NativeFunction< @@ -2489,8 +2950,9 @@ /// from: public java.util.Collection values() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject values() => - const jni.JObjectType().fromRef(_values(reference).object); + jni.JObject values() { + return const jni.JObjectType().fromRef(_values(reference).object); + } static final _entrySet = jniLookup< ffi.NativeFunction< @@ -2500,8 +2962,9 @@ /// from: public java.util.Set entrySet() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject entrySet() => - const jni.JObjectType().fromRef(_entrySet(reference).object); + jni.JObject entrySet() { + return const jni.JObjectType().fromRef(_entrySet(reference).object); + } static final _getOrDefault = jniLookup< ffi.NativeFunction< @@ -2515,8 +2978,13 @@ /// from: public V getOrDefault(java.lang.Object object, V object1) /// The returned object must be deleted after use, by calling the `delete` method. - V getOrDefault(jni.JObject object, V object1) => $V.fromRef( - _getOrDefault(reference, object.reference, object1.reference).object); + $V getOrDefault( + jni.JObject object, + $V object1, + ) { + return V.fromRef( + _getOrDefault(reference, object.reference, object1.reference).object); + } static final _putIfAbsent = jniLookup< ffi.NativeFunction< @@ -2530,8 +2998,13 @@ /// from: public V putIfAbsent(K object, V object1) /// The returned object must be deleted after use, by calling the `delete` method. - V putIfAbsent(K object, V object1) => $V.fromRef( - _putIfAbsent(reference, object.reference, object1.reference).object); + $V putIfAbsent( + $K object, + $V object1, + ) { + return V.fromRef( + _putIfAbsent(reference, object.reference, object1.reference).object); + } static final _remove1 = jniLookup< ffi.NativeFunction< @@ -2544,8 +3017,12 @@ ffi.Pointer<ffi.Void>)>(); /// from: public boolean remove(java.lang.Object object, java.lang.Object object1) - bool remove1(jni.JObject object, jni.JObject object1) => - _remove1(reference, object.reference, object1.reference).boolean; + bool remove1( + jni.JObject object, + jni.JObject object1, + ) { + return _remove1(reference, object.reference, object1.reference).boolean; + } static final _replace = jniLookup< ffi.NativeFunction< @@ -2559,9 +3036,15 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public boolean replace(K object, V object1, V object2) - bool replace(K object, V object1, V object2) => _replace( - reference, object.reference, object1.reference, object2.reference) - .boolean; + bool replace( + $K object, + $V object1, + $V object2, + ) { + return _replace( + reference, object.reference, object1.reference, object2.reference) + .boolean; + } static final _replace1 = jniLookup< ffi.NativeFunction< @@ -2575,8 +3058,13 @@ /// from: public V replace(K object, V object1) /// The returned object must be deleted after use, by calling the `delete` method. - V replace1(K object, V object1) => $V.fromRef( - _replace1(reference, object.reference, object1.reference).object); + $V replace1( + $K object, + $V object1, + ) { + return V.fromRef( + _replace1(reference, object.reference, object1.reference).object); + } static final _computeIfAbsent = jniLookup< ffi.NativeFunction< @@ -2590,8 +3078,14 @@ /// from: public V computeIfAbsent(K object, java.util.function.Function function) /// The returned object must be deleted after use, by calling the `delete` method. - V computeIfAbsent(K object, jni.JObject function) => $V.fromRef( - _computeIfAbsent(reference, object.reference, function.reference).object); + $V computeIfAbsent( + $K object, + jni.JObject function, + ) { + return V.fromRef( + _computeIfAbsent(reference, object.reference, function.reference) + .object); + } static final _computeIfPresent = jniLookup< ffi.NativeFunction< @@ -2605,9 +3099,14 @@ /// from: public V computeIfPresent(K object, java.util.function.BiFunction biFunction) /// The returned object must be deleted after use, by calling the `delete` method. - V computeIfPresent(K object, jni.JObject biFunction) => $V.fromRef( - _computeIfPresent(reference, object.reference, biFunction.reference) - .object); + $V computeIfPresent( + $K object, + jni.JObject biFunction, + ) { + return V.fromRef( + _computeIfPresent(reference, object.reference, biFunction.reference) + .object); + } static final _compute = jniLookup< ffi.NativeFunction< @@ -2621,8 +3120,13 @@ /// from: public V compute(K object, java.util.function.BiFunction biFunction) /// The returned object must be deleted after use, by calling the `delete` method. - V compute(K object, jni.JObject biFunction) => $V.fromRef( - _compute(reference, object.reference, biFunction.reference).object); + $V compute( + $K object, + jni.JObject biFunction, + ) { + return V.fromRef( + _compute(reference, object.reference, biFunction.reference).object); + } static final _merge = jniLookup< ffi.NativeFunction< @@ -2637,9 +3141,15 @@ /// from: public V merge(K object, V object1, java.util.function.BiFunction biFunction) /// The returned object must be deleted after use, by calling the `delete` method. - V merge(K object, V object1, jni.JObject biFunction) => $V.fromRef(_merge( - reference, object.reference, object1.reference, biFunction.reference) - .object); + $V merge( + $K object, + $V object1, + jni.JObject biFunction, + ) { + return V.fromRef(_merge(reference, object.reference, object1.reference, + biFunction.reference) + .object); + } static final _forEach = jniLookup< ffi.NativeFunction< @@ -2650,8 +3160,11 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public void forEach(java.util.function.BiConsumer biConsumer) - void forEach(jni.JObject biConsumer) => - _forEach(reference, biConsumer.reference).check(); + void forEach( + jni.JObject biConsumer, + ) { + return _forEach(reference, biConsumer.reference).check(); + } static final _replaceAll = jniLookup< ffi.NativeFunction< @@ -2662,8 +3175,11 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public void replaceAll(java.util.function.BiFunction biFunction) - void replaceAll(jni.JObject biFunction) => - _replaceAll(reference, biFunction.reference).check(); + void replaceAll( + jni.JObject biFunction, + ) { + return _replaceAll(reference, biFunction.reference).check(); + } static final _clone = jniLookup< ffi.NativeFunction< @@ -2672,23 +3188,41 @@ /// from: public java.lang.Object clone() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject clone() => - const jni.JObjectType().fromRef(_clone(reference).object); + jni.JObject clone() { + return const jni.JObjectType().fromRef(_clone(reference).object); + } } -class $HashMapType<K extends jni.JObject, V extends jni.JObject> - extends jni.JObjType<HashMap<K, V>> { - final jni.JObjType<K> $K; - final jni.JObjType<V> $V; +class $HashMapType<$K extends jni.JObject, $V extends jni.JObject> + extends jni.JObjType<HashMap<$K, $V>> { + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; const $HashMapType( - this.$K, - this.$V, + this.K, + this.V, ); @override String get signature => r"Ljava/util/HashMap;"; @override - HashMap<K, V> fromRef(jni.JObjectPtr ref) => HashMap.fromRef($K, $V, ref); + HashMap<$K, $V> fromRef(jni.JObjectPtr ref) => HashMap.fromRef(K, V, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($HashMapType, K, V); + + @override + bool operator ==(Object other) { + return other.runtimeType == $HashMapType && + other is $HashMapType && + K == other.K && + V == other.V; + } }
diff --git a/pkgs/jnigen/example/in_app_java/lib/main.dart b/pkgs/jnigen/example/in_app_java/lib/main.dart index f435428..7765b9c 100644 --- a/pkgs/jnigen/example/in_app_java/lib/main.dart +++ b/pkgs/jnigen/example/in_app_java/lib/main.dart
@@ -12,7 +12,7 @@ JObject activity = JObject.fromRef(Jni.getCurrentActivity()); JObject context = JObject.fromRef(Jni.getCachedApplicationContext()); -final hashmap = HashMap.ctor2(JString.type, JString.type); +final hashmap = HashMap.ctor2(K: JString.type, V: JString.type); final emojiCompat = EmojiCompat.get0();
diff --git a/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart b/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart index b6a9bca..3485f93 100644 --- a/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart +++ b/pkgs/jnigen/example/kotlin_plugin/lib/kotlin_bindings.dart
@@ -26,9 +26,8 @@ /// from: Example class Example extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; Example.fromRef( jni.JObjectPtr ref, @@ -42,7 +41,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - Example() : super.fromRef(_ctor().object); + factory Example() { + return Example.fromRef(_ctor().object); + } static final _thinkBeforeAnswering = jniLookup< ffi.NativeFunction< @@ -75,4 +76,18 @@ @override Example fromRef(jni.JObjectPtr ref) => Example.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ExampleType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $ExampleType && other is $ExampleType; + } }
diff --git a/pkgs/jnigen/example/notification_plugin/lib/notifications.dart b/pkgs/jnigen/example/notification_plugin/lib/notifications.dart index 7d93c7c..5a4d559 100644 --- a/pkgs/jnigen/example/notification_plugin/lib/notifications.dart +++ b/pkgs/jnigen/example/notification_plugin/lib/notifications.dart
@@ -30,9 +30,8 @@ /// from: com.example.notification_plugin.Notifications class Notifications extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; Notifications.fromRef( jni.JObjectPtr ref, @@ -46,7 +45,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - Notifications() : super.fromRef(_ctor().object); + factory Notifications() { + return Notifications.fromRef(_ctor().object); + } static final _showNotification = jniLookup< ffi.NativeFunction< @@ -60,11 +61,16 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: static public void showNotification(android.content.Context context, int notificationID, java.lang.String title, java.lang.String text) - static void showNotification(jni.JObject context, int notificationID, - jni.JString title, jni.JString text) => - _showNotification(context.reference, notificationID, title.reference, - text.reference) - .check(); + static void showNotification( + jni.JObject context, + int notificationID, + jni.JString title, + jni.JString text, + ) { + return _showNotification( + context.reference, notificationID, title.reference, text.reference) + .check(); + } } class $NotificationsType extends jni.JObjType<Notifications> { @@ -75,4 +81,19 @@ @override Notifications fromRef(jni.JObjectPtr ref) => Notifications.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($NotificationsType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $NotificationsType && + other is $NotificationsType; + } }
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart index ebafa96..ec0d860 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart
@@ -46,9 +46,8 @@ /// The \#close() method must be called once the document is no longer needed. ///@author Ben Litchfield class PDDocument extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; PDDocument.fromRef( jni.JObjectPtr ref, @@ -65,7 +64,9 @@ /// /// Creates an empty PDF document. /// You need to add at least one page for the document to be valid. - PDDocument() : super.fromRef(_ctor().object); + factory PDDocument() { + return PDDocument.fromRef(_ctor().object); + } static final _ctor1 = jniLookup< ffi.NativeFunction< @@ -79,8 +80,11 @@ /// Creates an empty PDF document. /// You need to add at least one page for the document to be valid. ///@param memUsageSetting defines how memory is used for buffering PDF streams - PDDocument.ctor1(jni.JObject memUsageSetting) - : super.fromRef(_ctor1(memUsageSetting.reference).object); + factory PDDocument.ctor1( + jni.JObject memUsageSetting, + ) { + return PDDocument.fromRef(_ctor1(memUsageSetting.reference).object); + } static final _ctor2 = jniLookup< ffi.NativeFunction< @@ -93,8 +97,11 @@ /// /// Constructor that uses an existing document. The COSDocument that is passed in must be valid. ///@param doc The COSDocument that this document wraps. - PDDocument.ctor2(jni.JObject doc) - : super.fromRef(_ctor2(doc.reference).object); + factory PDDocument.ctor2( + jni.JObject doc, + ) { + return PDDocument.fromRef(_ctor2(doc.reference).object); + } static final _ctor3 = jniLookup< ffi.NativeFunction< @@ -110,8 +117,12 @@ /// Constructor that uses an existing document. The COSDocument that is passed in must be valid. ///@param doc The COSDocument that this document wraps. ///@param source the parser which is used to read the pdf - PDDocument.ctor3(jni.JObject doc, jni.JObject source) - : super.fromRef(_ctor3(doc.reference, source.reference).object); + factory PDDocument.ctor3( + jni.JObject doc, + jni.JObject source, + ) { + return PDDocument.fromRef(_ctor3(doc.reference, source.reference).object); + } static final _ctor4 = jniLookup< ffi.NativeFunction< @@ -130,10 +141,14 @@ ///@param doc The COSDocument that this document wraps. ///@param source the parser which is used to read the pdf ///@param permission he access permissions of the pdf - PDDocument.ctor4(jni.JObject doc, jni.JObject source, jni.JObject permission) - : super.fromRef( - _ctor4(doc.reference, source.reference, permission.reference) - .object); + factory PDDocument.ctor4( + jni.JObject doc, + jni.JObject source, + jni.JObject permission, + ) { + return PDDocument.fromRef( + _ctor4(doc.reference, source.reference, permission.reference).object); + } static final _addPage = jniLookup< ffi.NativeFunction< @@ -148,7 +163,11 @@ /// This will add a page to the document. This is a convenience method, that will add the page to the root of the /// hierarchy and set the parent of the page to the root. ///@param page The page to add to the document. - void addPage(jni.JObject page) => _addPage(reference, page.reference).check(); + void addPage( + jni.JObject page, + ) { + return _addPage(reference, page.reference).check(); + } static final _addSignature = jniLookup< ffi.NativeFunction< @@ -170,8 +189,11 @@ ///@throws IOException if there is an error creating required fields ///@throws IllegalStateException if one attempts to add several signature /// fields. - void addSignature(jni.JObject sigObject) => - _addSignature(reference, sigObject.reference).check(); + void addSignature( + jni.JObject sigObject, + ) { + return _addSignature(reference, sigObject.reference).check(); + } static final _addSignature1 = jniLookup< ffi.NativeFunction< @@ -196,8 +218,13 @@ ///@throws IOException if there is an error creating required fields ///@throws IllegalStateException if one attempts to add several signature /// fields. - void addSignature1(jni.JObject sigObject, jni.JObject options) => - _addSignature1(reference, sigObject.reference, options.reference).check(); + void addSignature1( + jni.JObject sigObject, + jni.JObject options, + ) { + return _addSignature1(reference, sigObject.reference, options.reference) + .check(); + } static final _addSignature2 = jniLookup< ffi.NativeFunction< @@ -221,10 +248,14 @@ ///@throws IOException if there is an error creating required fields ///@throws IllegalStateException if one attempts to add several signature /// fields. - void addSignature2(jni.JObject sigObject, jni.JObject signatureInterface) => - _addSignature2( - reference, sigObject.reference, signatureInterface.reference) - .check(); + void addSignature2( + jni.JObject sigObject, + jni.JObject signatureInterface, + ) { + return _addSignature2( + reference, sigObject.reference, signatureInterface.reference) + .check(); + } static final _addSignature3 = jniLookup< ffi.NativeFunction< @@ -252,11 +283,15 @@ ///@throws IOException if there is an error creating required fields ///@throws IllegalStateException if one attempts to add several signature /// fields. - void addSignature3(jni.JObject sigObject, jni.JObject signatureInterface, - jni.JObject options) => - _addSignature3(reference, sigObject.reference, - signatureInterface.reference, options.reference) - .check(); + void addSignature3( + jni.JObject sigObject, + jni.JObject signatureInterface, + jni.JObject options, + ) { + return _addSignature3(reference, sigObject.reference, + signatureInterface.reference, options.reference) + .check(); + } static final _addSignatureField = jniLookup< ffi.NativeFunction< @@ -279,11 +314,15 @@ ///@throws IOException if there is an error creating required fields ///@deprecated The method is misleading, because only one signature may be /// added in a document. The method will be removed in the future. - void addSignatureField(jni.JObject sigFields, jni.JObject signatureInterface, - jni.JObject options) => - _addSignatureField(reference, sigFields.reference, - signatureInterface.reference, options.reference) - .check(); + void addSignatureField( + jni.JObject sigFields, + jni.JObject signatureInterface, + jni.JObject options, + ) { + return _addSignatureField(reference, sigFields.reference, + signatureInterface.reference, options.reference) + .check(); + } static final _removePage = jniLookup< ffi.NativeFunction< @@ -297,8 +336,11 @@ /// /// Remove the page from the document. ///@param page The page to remove from the document. - void removePage(jni.JObject page) => - _removePage(reference, page.reference).check(); + void removePage( + jni.JObject page, + ) { + return _removePage(reference, page.reference).check(); + } static final _removePage1 = jniLookup< ffi.NativeFunction< @@ -310,8 +352,11 @@ /// /// Remove the page from the document. ///@param pageNumber 0 based index to page number. - void removePage1(int pageNumber) => - _removePage1(reference, pageNumber).check(); + void removePage1( + int pageNumber, + ) { + return _removePage1(reference, pageNumber).check(); + } static final _importPage = jniLookup< ffi.NativeFunction< @@ -345,8 +390,12 @@ ///@param page The page to import. ///@return The page that was imported. ///@throws IOException If there is an error copying the page. - jni.JObject importPage(jni.JObject page) => const jni.JObjectType() - .fromRef(_importPage(reference, page.reference).object); + jni.JObject importPage( + jni.JObject page, + ) { + return const jni.JObjectType() + .fromRef(_importPage(reference, page.reference).object); + } static final _getDocument = jniLookup< ffi.NativeFunction< @@ -359,8 +408,9 @@ /// /// This will get the low level document. ///@return The document that this layer sits on top of. - jni.JObject getDocument() => - const jni.JObjectType().fromRef(_getDocument(reference).object); + jni.JObject getDocument() { + return const jni.JObjectType().fromRef(_getDocument(reference).object); + } static final _getDocumentInformation = jniLookup< ffi.NativeFunction< @@ -378,9 +428,10 @@ /// document level metadata, a metadata stream should be used instead, see /// PDDocumentCatalog\#getMetadata(). ///@return The documents /Info dictionary, never null. - pddocumentinformation_.PDDocumentInformation getDocumentInformation() => - const pddocumentinformation_.$PDDocumentInformationType() - .fromRef(_getDocumentInformation(reference).object); + pddocumentinformation_.PDDocumentInformation getDocumentInformation() { + return const pddocumentinformation_.$PDDocumentInformationType() + .fromRef(_getDocumentInformation(reference).object); + } static final _setDocumentInformation = jniLookup< ffi.NativeFunction< @@ -399,8 +450,10 @@ /// PDDocumentCatalog\#setMetadata(org.apache.pdfbox.pdmodel.common.PDMetadata) PDDocumentCatalog\#setMetadata(PDMetadata). ///@param info The updated document information. void setDocumentInformation( - pddocumentinformation_.PDDocumentInformation info) => - _setDocumentInformation(reference, info.reference).check(); + pddocumentinformation_.PDDocumentInformation info, + ) { + return _setDocumentInformation(reference, info.reference).check(); + } static final _getDocumentCatalog = jniLookup< ffi.NativeFunction< @@ -413,8 +466,10 @@ /// /// This will get the document CATALOG. This is guaranteed to not return null. ///@return The documents /Root dictionary - jni.JObject getDocumentCatalog() => - const jni.JObjectType().fromRef(_getDocumentCatalog(reference).object); + jni.JObject getDocumentCatalog() { + return const jni.JObjectType() + .fromRef(_getDocumentCatalog(reference).object); + } static final _isEncrypted = jniLookup< ffi.NativeFunction< @@ -426,7 +481,9 @@ /// /// This will tell if this document is encrypted or not. ///@return true If this document is encrypted. - bool isEncrypted() => _isEncrypted(reference).boolean; + bool isEncrypted() { + return _isEncrypted(reference).boolean; + } static final _getEncryption = jniLookup< ffi.NativeFunction< @@ -442,8 +499,9 @@ /// but the only supported subclass at this time is a /// PDStandardEncryption object. ///@return The encryption dictionary(most likely a PDStandardEncryption object) - jni.JObject getEncryption() => - const jni.JObjectType().fromRef(_getEncryption(reference).object); + jni.JObject getEncryption() { + return const jni.JObjectType().fromRef(_getEncryption(reference).object); + } static final _setEncryptionDictionary = jniLookup< ffi.NativeFunction< @@ -459,8 +517,11 @@ /// This will set the encryption dictionary for this document. ///@param encryption The encryption dictionary(most likely a PDStandardEncryption object) ///@throws IOException If there is an error determining which security handler to use. - void setEncryptionDictionary(jni.JObject encryption) => - _setEncryptionDictionary(reference, encryption.reference).check(); + void setEncryptionDictionary( + jni.JObject encryption, + ) { + return _setEncryptionDictionary(reference, encryption.reference).check(); + } static final _getLastSignatureDictionary = jniLookup< ffi.NativeFunction< @@ -475,8 +536,10 @@ /// last in time when empty signature fields are created first but signed after other fields. ///@return the last signature as <code>PDSignatureField</code>. ///@throws IOException if no document catalog can be found. - jni.JObject getLastSignatureDictionary() => const jni.JObjectType() - .fromRef(_getLastSignatureDictionary(reference).object); + jni.JObject getLastSignatureDictionary() { + return const jni.JObjectType() + .fromRef(_getLastSignatureDictionary(reference).object); + } static final _getSignatureFields = jniLookup< ffi.NativeFunction< @@ -490,8 +553,10 @@ /// Retrieve all signature fields from the document. ///@return a <code>List</code> of <code>PDSignatureField</code>s ///@throws IOException if no document catalog can be found. - jni.JObject getSignatureFields() => - const jni.JObjectType().fromRef(_getSignatureFields(reference).object); + jni.JObject getSignatureFields() { + return const jni.JObjectType() + .fromRef(_getSignatureFields(reference).object); + } static final _getSignatureDictionaries = jniLookup< ffi.NativeFunction< @@ -505,8 +570,10 @@ /// Retrieve all signature dictionaries from the document. ///@return a <code>List</code> of <code>PDSignatureField</code>s ///@throws IOException if no document catalog can be found. - jni.JObject getSignatureDictionaries() => const jni.JObjectType() - .fromRef(_getSignatureDictionaries(reference).object); + jni.JObject getSignatureDictionaries() { + return const jni.JObjectType() + .fromRef(_getSignatureDictionaries(reference).object); + } static final _registerTrueTypeFontForClosing = jniLookup< ffi.NativeFunction< @@ -523,8 +590,11 @@ /// is closed when the PDDocument is closed to avoid memory leaks. Users don't have to call this /// method, it is done by the appropriate PDFont classes. ///@param ttf - void registerTrueTypeFontForClosing(jni.JObject ttf) => - _registerTrueTypeFontForClosing(reference, ttf.reference).check(); + void registerTrueTypeFontForClosing( + jni.JObject ttf, + ) { + return _registerTrueTypeFontForClosing(reference, ttf.reference).check(); + } static final _load = jniLookup< ffi.NativeFunction< @@ -540,8 +610,11 @@ ///@return loaded document ///@throws InvalidPasswordException If the file required a non-empty password. ///@throws IOException in case of a file reading or parsing error - static PDDocument load(jni.JObject file) => - const $PDDocumentType().fromRef(_load(file.reference).object); + static PDDocument load( + jni.JObject file, + ) { + return const $PDDocumentType().fromRef(_load(file.reference).object); + } static final _load1 = jniLookup< ffi.NativeFunction< @@ -560,9 +633,13 @@ ///@return loaded document ///@throws InvalidPasswordException If the file required a non-empty password. ///@throws IOException in case of a file reading or parsing error - static PDDocument load1(jni.JObject file, jni.JObject memUsageSetting) => - const $PDDocumentType() - .fromRef(_load1(file.reference, memUsageSetting.reference).object); + static PDDocument load1( + jni.JObject file, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType() + .fromRef(_load1(file.reference, memUsageSetting.reference).object); + } static final _load2 = jniLookup< ffi.NativeFunction< @@ -581,9 +658,13 @@ ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException in case of a file reading or parsing error - static PDDocument load2(jni.JObject file, jni.JString password) => - const $PDDocumentType() - .fromRef(_load2(file.reference, password.reference).object); + static PDDocument load2( + jni.JObject file, + jni.JString password, + ) { + return const $PDDocumentType() + .fromRef(_load2(file.reference, password.reference).object); + } static final _load3 = jniLookup< ffi.NativeFunction< @@ -605,11 +686,15 @@ ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException in case of a file reading or parsing error - static PDDocument load3(jni.JObject file, jni.JString password, - jni.JObject memUsageSetting) => - const $PDDocumentType().fromRef( - _load3(file.reference, password.reference, memUsageSetting.reference) - .object); + static PDDocument load3( + jni.JObject file, + jni.JString password, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType().fromRef( + _load3(file.reference, password.reference, memUsageSetting.reference) + .object); + } static final _load4 = jniLookup< ffi.NativeFunction< @@ -632,11 +717,16 @@ ///@param alias alias to be used for decryption when using public key security ///@return loaded document ///@throws IOException in case of a file reading or parsing error - static PDDocument load4(jni.JObject file, jni.JString password, - jni.JObject keyStore, jni.JString alias) => - const $PDDocumentType().fromRef(_load4(file.reference, password.reference, - keyStore.reference, alias.reference) - .object); + static PDDocument load4( + jni.JObject file, + jni.JString password, + jni.JObject keyStore, + jni.JString alias, + ) { + return const $PDDocumentType().fromRef(_load4(file.reference, + password.reference, keyStore.reference, alias.reference) + .object); + } static final _load5 = jniLookup< ffi.NativeFunction< @@ -666,14 +756,20 @@ ///@return loaded document ///@throws IOException in case of a file reading or parsing error static PDDocument load5( - jni.JObject file, - jni.JString password, - jni.JObject keyStore, - jni.JString alias, - jni.JObject memUsageSetting) => - const $PDDocumentType().fromRef(_load5(file.reference, password.reference, - keyStore.reference, alias.reference, memUsageSetting.reference) - .object); + jni.JObject file, + jni.JString password, + jni.JObject keyStore, + jni.JString alias, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType().fromRef(_load5( + file.reference, + password.reference, + keyStore.reference, + alias.reference, + memUsageSetting.reference) + .object); + } static final _load6 = jniLookup< ffi.NativeFunction< @@ -690,8 +786,11 @@ ///@return loaded document ///@throws InvalidPasswordException If the PDF required a non-empty password. ///@throws IOException In case of a reading or parsing error. - static PDDocument load6(jni.JObject input) => - const $PDDocumentType().fromRef(_load6(input.reference).object); + static PDDocument load6( + jni.JObject input, + ) { + return const $PDDocumentType().fromRef(_load6(input.reference).object); + } static final _load7 = jniLookup< ffi.NativeFunction< @@ -711,9 +810,13 @@ ///@return loaded document ///@throws InvalidPasswordException If the PDF required a non-empty password. ///@throws IOException In case of a reading or parsing error. - static PDDocument load7(jni.JObject input, jni.JObject memUsageSetting) => - const $PDDocumentType() - .fromRef(_load7(input.reference, memUsageSetting.reference).object); + static PDDocument load7( + jni.JObject input, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType() + .fromRef(_load7(input.reference, memUsageSetting.reference).object); + } static final _load8 = jniLookup< ffi.NativeFunction< @@ -733,9 +836,13 @@ ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load8(jni.JObject input, jni.JString password) => - const $PDDocumentType() - .fromRef(_load8(input.reference, password.reference).object); + static PDDocument load8( + jni.JObject input, + jni.JString password, + ) { + return const $PDDocumentType() + .fromRef(_load8(input.reference, password.reference).object); + } static final _load9 = jniLookup< ffi.NativeFunction< @@ -759,11 +866,16 @@ ///@param alias alias to be used for decryption when using public key security ///@return loaded document ///@throws IOException In case of a reading or parsing error. - static PDDocument load9(jni.JObject input, jni.JString password, - jni.JObject keyStore, jni.JString alias) => - const $PDDocumentType().fromRef(_load9(input.reference, - password.reference, keyStore.reference, alias.reference) - .object); + static PDDocument load9( + jni.JObject input, + jni.JString password, + jni.JObject keyStore, + jni.JString alias, + ) { + return const $PDDocumentType().fromRef(_load9(input.reference, + password.reference, keyStore.reference, alias.reference) + .object); + } static final _load10 = jniLookup< ffi.NativeFunction< @@ -786,11 +898,15 @@ ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load10(jni.JObject input, jni.JString password, - jni.JObject memUsageSetting) => - const $PDDocumentType().fromRef(_load10( - input.reference, password.reference, memUsageSetting.reference) - .object); + static PDDocument load10( + jni.JObject input, + jni.JString password, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType().fromRef( + _load10(input.reference, password.reference, memUsageSetting.reference) + .object); + } static final _load11 = jniLookup< ffi.NativeFunction< @@ -822,18 +938,20 @@ ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. static PDDocument load11( - jni.JObject input, - jni.JString password, - jni.JObject keyStore, - jni.JString alias, - jni.JObject memUsageSetting) => - const $PDDocumentType().fromRef(_load11( - input.reference, - password.reference, - keyStore.reference, - alias.reference, - memUsageSetting.reference) - .object); + jni.JObject input, + jni.JString password, + jni.JObject keyStore, + jni.JString alias, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType().fromRef(_load11( + input.reference, + password.reference, + keyStore.reference, + alias.reference, + memUsageSetting.reference) + .object); + } static final _load12 = jniLookup< ffi.NativeFunction< @@ -849,8 +967,11 @@ ///@return loaded document ///@throws InvalidPasswordException If the PDF required a non-empty password. ///@throws IOException In case of a reading or parsing error. - static PDDocument load12(jni.JArray<jni.JByte> input) => - const $PDDocumentType().fromRef(_load12(input.reference).object); + static PDDocument load12( + jni.JArray<jni.JByte> input, + ) { + return const $PDDocumentType().fromRef(_load12(input.reference).object); + } static final _load13 = jniLookup< ffi.NativeFunction< @@ -869,9 +990,13 @@ ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load13(jni.JArray<jni.JByte> input, jni.JString password) => - const $PDDocumentType() - .fromRef(_load13(input.reference, password.reference).object); + static PDDocument load13( + jni.JArray<jni.JByte> input, + jni.JString password, + ) { + return const $PDDocumentType() + .fromRef(_load13(input.reference, password.reference).object); + } static final _load14 = jniLookup< ffi.NativeFunction< @@ -895,11 +1020,16 @@ ///@return loaded document ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. - static PDDocument load14(jni.JArray<jni.JByte> input, jni.JString password, - jni.JObject keyStore, jni.JString alias) => - const $PDDocumentType().fromRef(_load14(input.reference, - password.reference, keyStore.reference, alias.reference) - .object); + static PDDocument load14( + jni.JArray<jni.JByte> input, + jni.JString password, + jni.JObject keyStore, + jni.JString alias, + ) { + return const $PDDocumentType().fromRef(_load14(input.reference, + password.reference, keyStore.reference, alias.reference) + .object); + } static final _load15 = jniLookup< ffi.NativeFunction< @@ -930,18 +1060,20 @@ ///@throws InvalidPasswordException If the password is incorrect. ///@throws IOException In case of a reading or parsing error. static PDDocument load15( - jni.JArray<jni.JByte> input, - jni.JString password, - jni.JObject keyStore, - jni.JString alias, - jni.JObject memUsageSetting) => - const $PDDocumentType().fromRef(_load15( - input.reference, - password.reference, - keyStore.reference, - alias.reference, - memUsageSetting.reference) - .object); + jni.JArray<jni.JByte> input, + jni.JString password, + jni.JObject keyStore, + jni.JString alias, + jni.JObject memUsageSetting, + ) { + return const $PDDocumentType().fromRef(_load15( + input.reference, + password.reference, + keyStore.reference, + alias.reference, + memUsageSetting.reference) + .object); + } static final _save = jniLookup< ffi.NativeFunction< @@ -960,8 +1092,11 @@ /// do not use the document after saving because the contents are now encrypted. ///@param fileName The file to save as. ///@throws IOException if the output could not be written - void save(jni.JString fileName) => - _save(reference, fileName.reference).check(); + void save( + jni.JString fileName, + ) { + return _save(reference, fileName.reference).check(); + } static final _save1 = jniLookup< ffi.NativeFunction< @@ -980,7 +1115,11 @@ /// do not use the document after saving because the contents are now encrypted. ///@param file The file to save as. ///@throws IOException if the output could not be written - void save1(jni.JObject file) => _save1(reference, file.reference).check(); + void save1( + jni.JObject file, + ) { + return _save1(reference, file.reference).check(); + } static final _save2 = jniLookup< ffi.NativeFunction< @@ -1000,7 +1139,11 @@ ///@param output The stream to write to. It will be closed when done. It is recommended to wrap /// it in a java.io.BufferedOutputStream, unless it is already buffered. ///@throws IOException if the output could not be written - void save2(jni.JObject output) => _save2(reference, output.reference).check(); + void save2( + jni.JObject output, + ) { + return _save2(reference, output.reference).check(); + } static final _saveIncremental = jniLookup< ffi.NativeFunction< @@ -1025,8 +1168,11 @@ /// harmed! ///@throws IOException if the output could not be written ///@throws IllegalStateException if the document was not loaded from a file or a stream. - void saveIncremental(jni.JObject output) => - _saveIncremental(reference, output.reference).check(); + void saveIncremental( + jni.JObject output, + ) { + return _saveIncremental(reference, output.reference).check(); + } static final _saveIncremental1 = jniLookup< ffi.NativeFunction< @@ -1058,9 +1204,14 @@ ///@param objectsToWrite objects that __must__ be part of the incremental saving. ///@throws IOException if the output could not be written ///@throws IllegalStateException if the document was not loaded from a file or a stream. - void saveIncremental1(jni.JObject output, jni.JObject objectsToWrite) => - _saveIncremental1(reference, output.reference, objectsToWrite.reference) - .check(); + void saveIncremental1( + jni.JObject output, + jni.JObject objectsToWrite, + ) { + return _saveIncremental1( + reference, output.reference, objectsToWrite.reference) + .check(); + } static final _saveIncrementalForExternalSigning = jniLookup< ffi.NativeFunction< @@ -1111,10 +1262,12 @@ ///@throws IOException if the output could not be written ///@throws IllegalStateException if the document was not loaded from a file or a stream or /// signature options were not set. - jni.JObject saveIncrementalForExternalSigning(jni.JObject output) => - const jni.JObjectType().fromRef( - _saveIncrementalForExternalSigning(reference, output.reference) - .object); + jni.JObject saveIncrementalForExternalSigning( + jni.JObject output, + ) { + return const jni.JObjectType().fromRef( + _saveIncrementalForExternalSigning(reference, output.reference).object); + } static final _getPage = jniLookup< ffi.NativeFunction< @@ -1132,8 +1285,12 @@ /// PDDocument\#getPages() instead. ///@param pageIndex the 0-based page index ///@return the page at the given index. - jni.JObject getPage(int pageIndex) => - const jni.JObjectType().fromRef(_getPage(reference, pageIndex).object); + jni.JObject getPage( + int pageIndex, + ) { + return const jni.JObjectType() + .fromRef(_getPage(reference, pageIndex).object); + } static final _getPages = jniLookup< ffi.NativeFunction< @@ -1146,8 +1303,9 @@ /// /// Returns the page tree. ///@return the page tree - jni.JObject getPages() => - const jni.JObjectType().fromRef(_getPages(reference).object); + jni.JObject getPages() { + return const jni.JObjectType().fromRef(_getPages(reference).object); + } static final _getNumberOfPages = jniLookup< ffi.NativeFunction< @@ -1159,7 +1317,9 @@ /// /// This will return the total page count of the PDF document. ///@return The total number of pages in the PDF document. - int getNumberOfPages() => _getNumberOfPages(reference).integer; + int getNumberOfPages() { + return _getNumberOfPages(reference).integer; + } static final _close = jniLookup< ffi.NativeFunction< @@ -1171,7 +1331,9 @@ /// /// This will close the underlying COSDocument object. ///@throws IOException If there is an error releasing resources. - void close() => _close(reference).check(); + void close() { + return _close(reference).check(); + } static final _protect = jniLookup< ffi.NativeFunction< @@ -1193,8 +1355,11 @@ ///@see org.apache.pdfbox.pdmodel.encryption.PublicKeyProtectionPolicy ///@param policy The protection policy. ///@throws IOException if there isn't any suitable security handler. - void protect(jni.JObject policy) => - _protect(reference, policy.reference).check(); + void protect( + jni.JObject policy, + ) { + return _protect(reference, policy.reference).check(); + } static final _getCurrentAccessPermission = jniLookup< ffi.NativeFunction< @@ -1210,8 +1375,10 @@ /// only mode so that permissions cannot be changed. Methods providing access to content should rely on this object /// to verify if the current user is allowed to proceed. ///@return the access permissions for the current user on the document. - jni.JObject getCurrentAccessPermission() => const jni.JObjectType() - .fromRef(_getCurrentAccessPermission(reference).object); + jni.JObject getCurrentAccessPermission() { + return const jni.JObjectType() + .fromRef(_getCurrentAccessPermission(reference).object); + } static final _isAllSecurityToBeRemoved = jniLookup< ffi.NativeFunction< @@ -1223,8 +1390,9 @@ /// /// Indicates if all security is removed or not when writing the pdf. ///@return returns true if all security shall be removed otherwise false - bool isAllSecurityToBeRemoved() => - _isAllSecurityToBeRemoved(reference).boolean; + bool isAllSecurityToBeRemoved() { + return _isAllSecurityToBeRemoved(reference).boolean; + } static final _setAllSecurityToBeRemoved = jniLookup< ffi.NativeFunction< @@ -1236,8 +1404,12 @@ /// /// Activates/Deactivates the removal of all security when writing the pdf. ///@param removeAllSecurity remove all security if set to true - void setAllSecurityToBeRemoved(bool removeAllSecurity) => - _setAllSecurityToBeRemoved(reference, removeAllSecurity ? 1 : 0).check(); + void setAllSecurityToBeRemoved( + bool removeAllSecurity, + ) { + return _setAllSecurityToBeRemoved(reference, removeAllSecurity ? 1 : 0) + .check(); + } static final _getDocumentId = jniLookup< ffi.NativeFunction< @@ -1250,8 +1422,9 @@ /// /// Provides the document ID. ///@return the document ID - jni.JObject getDocumentId() => - const jni.JObjectType().fromRef(_getDocumentId(reference).object); + jni.JObject getDocumentId() { + return const jni.JObjectType().fromRef(_getDocumentId(reference).object); + } static final _setDocumentId = jniLookup< ffi.NativeFunction< @@ -1265,8 +1438,11 @@ /// /// Sets the document ID to the given value. ///@param docId the new document ID - void setDocumentId(jni.JObject docId) => - _setDocumentId(reference, docId.reference).check(); + void setDocumentId( + jni.JObject docId, + ) { + return _setDocumentId(reference, docId.reference).check(); + } static final _getVersion = jniLookup< ffi.NativeFunction< @@ -1278,7 +1454,9 @@ /// /// Returns the PDF specification version this document conforms to. ///@return the PDF version (e.g. 1.4f) - double getVersion() => _getVersion(reference).float; + double getVersion() { + return _getVersion(reference).float; + } static final _setVersion = jniLookup< ffi.NativeFunction< @@ -1290,8 +1468,11 @@ /// /// Sets the PDF specification version for this document. ///@param newVersion the new PDF version (e.g. 1.4f) - void setVersion(double newVersion) => - _setVersion(reference, newVersion).check(); + void setVersion( + double newVersion, + ) { + return _setVersion(reference, newVersion).check(); + } static final _getResourceCache = jniLookup< ffi.NativeFunction< @@ -1304,8 +1485,9 @@ /// /// Returns the resource cache associated with this document, or null if there is none. ///@return the resource cache or null. - jni.JObject getResourceCache() => - const jni.JObjectType().fromRef(_getResourceCache(reference).object); + jni.JObject getResourceCache() { + return const jni.JObjectType().fromRef(_getResourceCache(reference).object); + } static final _setResourceCache = jniLookup< ffi.NativeFunction< @@ -1319,8 +1501,11 @@ /// /// Sets the resource cache associated with this document. ///@param resourceCache A resource cache, or null. - void setResourceCache(jni.JObject resourceCache) => - _setResourceCache(reference, resourceCache.reference).check(); + void setResourceCache( + jni.JObject resourceCache, + ) { + return _setResourceCache(reference, resourceCache.reference).check(); + } } class $PDDocumentType extends jni.JObjType<PDDocument> { @@ -1331,4 +1516,18 @@ @override PDDocument fromRef(jni.JObjectPtr ref) => PDDocument.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($PDDocumentType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $PDDocumentType && other is $PDDocumentType; + } }
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart index bcb2655..90134bc 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart
@@ -47,9 +47,8 @@ ///@author Ben Litchfield ///@author Gerardo Ortiz class PDDocumentInformation extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; PDDocumentInformation.fromRef( jni.JObjectPtr ref, @@ -65,7 +64,9 @@ /// The returned object must be deleted after use, by calling the `delete` method. /// /// Default Constructor. - PDDocumentInformation() : super.fromRef(_ctor().object); + factory PDDocumentInformation() { + return PDDocumentInformation.fromRef(_ctor().object); + } static final _ctor1 = jniLookup< ffi.NativeFunction< @@ -78,8 +79,11 @@ /// /// Constructor that is used for a preexisting dictionary. ///@param dic The underlying dictionary. - PDDocumentInformation.ctor1(jni.JObject dic) - : super.fromRef(_ctor1(dic.reference).object); + factory PDDocumentInformation.ctor1( + jni.JObject dic, + ) { + return PDDocumentInformation.fromRef(_ctor1(dic.reference).object); + } static final _getCOSObject = jniLookup< ffi.NativeFunction< @@ -92,8 +96,9 @@ /// /// This will get the underlying dictionary that this object wraps. ///@return The underlying info dictionary. - jni.JObject getCOSObject() => - const jni.JObjectType().fromRef(_getCOSObject(reference).object); + jni.JObject getCOSObject() { + return const jni.JObjectType().fromRef(_getCOSObject(reference).object); + } static final _getPropertyStringValue = jniLookup< ffi.NativeFunction< @@ -115,9 +120,12 @@ /// ///@param propertyKey the dictionaries key ///@return the properties value - jni.JObject getPropertyStringValue(jni.JString propertyKey) => - const jni.JObjectType().fromRef( - _getPropertyStringValue(reference, propertyKey.reference).object); + jni.JObject getPropertyStringValue( + jni.JString propertyKey, + ) { + return const jni.JObjectType().fromRef( + _getPropertyStringValue(reference, propertyKey.reference).object); + } static final _getTitle = jniLookup< ffi.NativeFunction< @@ -130,8 +138,9 @@ /// /// This will get the title of the document. This will return null if no title exists. ///@return The title of the document. - jni.JString getTitle() => - const jni.JStringType().fromRef(_getTitle(reference).object); + jni.JString getTitle() { + return const jni.JStringType().fromRef(_getTitle(reference).object); + } static final _setTitle = jniLookup< ffi.NativeFunction< @@ -145,8 +154,11 @@ /// /// This will set the title of the document. ///@param title The new title for the document. - void setTitle(jni.JString title) => - _setTitle(reference, title.reference).check(); + void setTitle( + jni.JString title, + ) { + return _setTitle(reference, title.reference).check(); + } static final _getAuthor = jniLookup< ffi.NativeFunction< @@ -159,8 +171,9 @@ /// /// This will get the author of the document. This will return null if no author exists. ///@return The author of the document. - jni.JString getAuthor() => - const jni.JStringType().fromRef(_getAuthor(reference).object); + jni.JString getAuthor() { + return const jni.JStringType().fromRef(_getAuthor(reference).object); + } static final _setAuthor = jniLookup< ffi.NativeFunction< @@ -174,8 +187,11 @@ /// /// This will set the author of the document. ///@param author The new author for the document. - void setAuthor(jni.JString author) => - _setAuthor(reference, author.reference).check(); + void setAuthor( + jni.JString author, + ) { + return _setAuthor(reference, author.reference).check(); + } static final _getSubject = jniLookup< ffi.NativeFunction< @@ -188,8 +204,9 @@ /// /// This will get the subject of the document. This will return null if no subject exists. ///@return The subject of the document. - jni.JString getSubject() => - const jni.JStringType().fromRef(_getSubject(reference).object); + jni.JString getSubject() { + return const jni.JStringType().fromRef(_getSubject(reference).object); + } static final _setSubject = jniLookup< ffi.NativeFunction< @@ -203,8 +220,11 @@ /// /// This will set the subject of the document. ///@param subject The new subject for the document. - void setSubject(jni.JString subject) => - _setSubject(reference, subject.reference).check(); + void setSubject( + jni.JString subject, + ) { + return _setSubject(reference, subject.reference).check(); + } static final _getKeywords = jniLookup< ffi.NativeFunction< @@ -217,8 +237,9 @@ /// /// This will get the keywords of the document. This will return null if no keywords exists. ///@return The keywords of the document. - jni.JString getKeywords() => - const jni.JStringType().fromRef(_getKeywords(reference).object); + jni.JString getKeywords() { + return const jni.JStringType().fromRef(_getKeywords(reference).object); + } static final _setKeywords = jniLookup< ffi.NativeFunction< @@ -232,8 +253,11 @@ /// /// This will set the keywords of the document. ///@param keywords The new keywords for the document. - void setKeywords(jni.JString keywords) => - _setKeywords(reference, keywords.reference).check(); + void setKeywords( + jni.JString keywords, + ) { + return _setKeywords(reference, keywords.reference).check(); + } static final _getCreator = jniLookup< ffi.NativeFunction< @@ -246,8 +270,9 @@ /// /// This will get the creator of the document. This will return null if no creator exists. ///@return The creator of the document. - jni.JString getCreator() => - const jni.JStringType().fromRef(_getCreator(reference).object); + jni.JString getCreator() { + return const jni.JStringType().fromRef(_getCreator(reference).object); + } static final _setCreator = jniLookup< ffi.NativeFunction< @@ -261,8 +286,11 @@ /// /// This will set the creator of the document. ///@param creator The new creator for the document. - void setCreator(jni.JString creator) => - _setCreator(reference, creator.reference).check(); + void setCreator( + jni.JString creator, + ) { + return _setCreator(reference, creator.reference).check(); + } static final _getProducer = jniLookup< ffi.NativeFunction< @@ -275,8 +303,9 @@ /// /// This will get the producer of the document. This will return null if no producer exists. ///@return The producer of the document. - jni.JString getProducer() => - const jni.JStringType().fromRef(_getProducer(reference).object); + jni.JString getProducer() { + return const jni.JStringType().fromRef(_getProducer(reference).object); + } static final _setProducer = jniLookup< ffi.NativeFunction< @@ -290,8 +319,11 @@ /// /// This will set the producer of the document. ///@param producer The new producer for the document. - void setProducer(jni.JString producer) => - _setProducer(reference, producer.reference).check(); + void setProducer( + jni.JString producer, + ) { + return _setProducer(reference, producer.reference).check(); + } static final _getCreationDate = jniLookup< ffi.NativeFunction< @@ -304,8 +336,9 @@ /// /// This will get the creation date of the document. This will return null if no creation date exists. ///@return The creation date of the document. - jni.JObject getCreationDate() => - const jni.JObjectType().fromRef(_getCreationDate(reference).object); + jni.JObject getCreationDate() { + return const jni.JObjectType().fromRef(_getCreationDate(reference).object); + } static final _setCreationDate = jniLookup< ffi.NativeFunction< @@ -320,8 +353,11 @@ /// /// This will set the creation date of the document. ///@param date The new creation date for the document. - void setCreationDate(jni.JObject date) => - _setCreationDate(reference, date.reference).check(); + void setCreationDate( + jni.JObject date, + ) { + return _setCreationDate(reference, date.reference).check(); + } static final _getModificationDate = jniLookup< ffi.NativeFunction< @@ -334,8 +370,10 @@ /// /// This will get the modification date of the document. This will return null if no modification date exists. ///@return The modification date of the document. - jni.JObject getModificationDate() => - const jni.JObjectType().fromRef(_getModificationDate(reference).object); + jni.JObject getModificationDate() { + return const jni.JObjectType() + .fromRef(_getModificationDate(reference).object); + } static final _setModificationDate = jniLookup< ffi.NativeFunction< @@ -350,8 +388,11 @@ /// /// This will set the modification date of the document. ///@param date The new modification date for the document. - void setModificationDate(jni.JObject date) => - _setModificationDate(reference, date.reference).check(); + void setModificationDate( + jni.JObject date, + ) { + return _setModificationDate(reference, date.reference).check(); + } static final _getTrapped = jniLookup< ffi.NativeFunction< @@ -365,8 +406,9 @@ /// This will get the trapped value for the document. /// This will return null if one is not found. ///@return The trapped value for the document. - jni.JString getTrapped() => - const jni.JStringType().fromRef(_getTrapped(reference).object); + jni.JString getTrapped() { + return const jni.JStringType().fromRef(_getTrapped(reference).object); + } static final _getMetadataKeys = jniLookup< ffi.NativeFunction< @@ -380,8 +422,9 @@ /// This will get the keys of all metadata information fields for the document. ///@return all metadata key strings. ///@since Apache PDFBox 1.3.0 - jni.JObject getMetadataKeys() => - const jni.JObjectType().fromRef(_getMetadataKeys(reference).object); + jni.JObject getMetadataKeys() { + return const jni.JObjectType().fromRef(_getMetadataKeys(reference).object); + } static final _getCustomMetadataValue = jniLookup< ffi.NativeFunction< @@ -399,9 +442,12 @@ /// This will return null if one is not found. ///@param fieldName Name of custom metadata field from pdf document. ///@return String Value of metadata field - jni.JString getCustomMetadataValue(jni.JString fieldName) => - const jni.JStringType().fromRef( - _getCustomMetadataValue(reference, fieldName.reference).object); + jni.JString getCustomMetadataValue( + jni.JString fieldName, + ) { + return const jni.JStringType().fromRef( + _getCustomMetadataValue(reference, fieldName.reference).object); + } static final _setCustomMetadataValue = jniLookup< ffi.NativeFunction< @@ -417,10 +463,14 @@ /// Set the custom metadata value. ///@param fieldName The name of the custom metadata field. ///@param fieldValue The value to the custom metadata field. - void setCustomMetadataValue(jni.JString fieldName, jni.JString fieldValue) => - _setCustomMetadataValue( - reference, fieldName.reference, fieldValue.reference) - .check(); + void setCustomMetadataValue( + jni.JString fieldName, + jni.JString fieldValue, + ) { + return _setCustomMetadataValue( + reference, fieldName.reference, fieldValue.reference) + .check(); + } static final _setTrapped = jniLookup< ffi.NativeFunction< @@ -436,8 +486,11 @@ /// 'True', 'False', or 'Unknown'. ///@param value The new trapped value for the document. ///@throws IllegalArgumentException if the parameter is invalid. - void setTrapped(jni.JString value) => - _setTrapped(reference, value.reference).check(); + void setTrapped( + jni.JString value, + ) { + return _setTrapped(reference, value.reference).check(); + } } class $PDDocumentInformationType extends jni.JObjType<PDDocumentInformation> { @@ -449,4 +502,19 @@ @override PDDocumentInformation fromRef(jni.JObjectPtr ref) => PDDocumentInformation.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($PDDocumentInformationType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $PDDocumentInformationType && + other is $PDDocumentInformationType; + } }
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart index ccf668b..ee03391 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart
@@ -50,9 +50,8 @@ /// smaller and smaller chunks of the page. Eventually, we fully process each page and then print it. ///@author Ben Litchfield class PDFTextStripper extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; PDFTextStripper.fromRef( jni.JObjectPtr ref, @@ -193,7 +192,9 @@ /// /// Instantiate a new PDFTextStripper object. ///@throws IOException If there is an error loading the properties. - PDFTextStripper() : super.fromRef(_ctor().object); + factory PDFTextStripper() { + return PDFTextStripper.fromRef(_ctor().object); + } static final _getText = jniLookup< ffi.NativeFunction< @@ -216,8 +217,12 @@ ///@param doc The document to get the text from. ///@return The text of the PDF document. ///@throws IOException if the doc state is invalid or it is encrypted. - jni.JString getText(pddocument_.PDDocument doc) => const jni.JStringType() - .fromRef(_getText(reference, doc.reference).object); + jni.JString getText( + pddocument_.PDDocument doc, + ) { + return const jni.JStringType() + .fromRef(_getText(reference, doc.reference).object); + } static final _writeText = jniLookup< ffi.NativeFunction< @@ -235,8 +240,12 @@ ///@param doc The document to get the data from. ///@param outputStream The location to put the text. ///@throws IOException If the doc is in an invalid state. - void writeText(pddocument_.PDDocument doc, jni.JObject outputStream) => - _writeText(reference, doc.reference, outputStream.reference).check(); + void writeText( + pddocument_.PDDocument doc, + jni.JObject outputStream, + ) { + return _writeText(reference, doc.reference, outputStream.reference).check(); + } static final _processPages = jniLookup< ffi.NativeFunction< @@ -251,8 +260,11 @@ /// This will process all of the pages and the text that is in them. ///@param pages The pages object in the document. ///@throws IOException If there is an error parsing the text. - void processPages(jni.JObject pages) => - _processPages(reference, pages.reference).check(); + void processPages( + jni.JObject pages, + ) { + return _processPages(reference, pages.reference).check(); + } static final _startDocument = jniLookup< ffi.NativeFunction< @@ -267,8 +279,11 @@ /// This method is available for subclasses of this class. It will be called before processing of the document start. ///@param document The PDF document that is being processed. ///@throws IOException If an IO error occurs. - void startDocument(pddocument_.PDDocument document) => - _startDocument(reference, document.reference).check(); + void startDocument( + pddocument_.PDDocument document, + ) { + return _startDocument(reference, document.reference).check(); + } static final _endDocument = jniLookup< ffi.NativeFunction< @@ -284,8 +299,11 @@ /// finishes. ///@param document The PDF document that is being processed. ///@throws IOException If an IO error occurs. - void endDocument(pddocument_.PDDocument document) => - _endDocument(reference, document.reference).check(); + void endDocument( + pddocument_.PDDocument document, + ) { + return _endDocument(reference, document.reference).check(); + } static final _processPage = jniLookup< ffi.NativeFunction< @@ -300,8 +318,11 @@ /// This will process the contents of a page. ///@param page The page to process. ///@throws IOException If there is an error processing the page. - void processPage(jni.JObject page) => - _processPage(reference, page.reference).check(); + void processPage( + jni.JObject page, + ) { + return _processPage(reference, page.reference).check(); + } static final _startArticle = jniLookup< ffi.NativeFunction< @@ -315,7 +336,9 @@ /// assumes that the primary direction of text is left to right. Default implementation is to do nothing. Subclasses /// may provide additional information. ///@throws IOException If there is any error writing to the stream. - void startArticle() => _startArticle(reference).check(); + void startArticle() { + return _startArticle(reference).check(); + } static final _startArticle1 = jniLookup< ffi.NativeFunction< @@ -329,8 +352,11 @@ /// Default implementation is to do nothing. Subclasses may provide additional information. ///@param isLTR true if primary direction of text is left to right. ///@throws IOException If there is any error writing to the stream. - void startArticle1(bool isLTR) => - _startArticle1(reference, isLTR ? 1 : 0).check(); + void startArticle1( + bool isLTR, + ) { + return _startArticle1(reference, isLTR ? 1 : 0).check(); + } static final _endArticle = jniLookup< ffi.NativeFunction< @@ -342,7 +368,9 @@ /// /// End an article. Default implementation is to do nothing. Subclasses may provide additional information. ///@throws IOException If there is any error writing to the stream. - void endArticle() => _endArticle(reference).check(); + void endArticle() { + return _endArticle(reference).check(); + } static final _startPage = jniLookup< ffi.NativeFunction< @@ -357,8 +385,11 @@ /// Start a new page. Default implementation is to do nothing. Subclasses may provide additional information. ///@param page The page we are about to process. ///@throws IOException If there is any error writing to the stream. - void startPage(jni.JObject page) => - _startPage(reference, page.reference).check(); + void startPage( + jni.JObject page, + ) { + return _startPage(reference, page.reference).check(); + } static final _endPage = jniLookup< ffi.NativeFunction< @@ -373,7 +404,11 @@ /// End a page. Default implementation is to do nothing. Subclasses may provide additional information. ///@param page The page we are about to process. ///@throws IOException If there is any error writing to the stream. - void endPage(jni.JObject page) => _endPage(reference, page.reference).check(); + void endPage( + jni.JObject page, + ) { + return _endPage(reference, page.reference).check(); + } static final _writePage = jniLookup< ffi.NativeFunction< @@ -387,7 +422,9 @@ /// text, where newlines and word spacings should be placed. The text will be sorted only if that feature was /// enabled. ///@throws IOException If there is an error writing the text. - void writePage() => _writePage(reference).check(); + void writePage() { + return _writePage(reference).check(); + } static final _writeLineSeparator = jniLookup< ffi.NativeFunction< @@ -399,7 +436,9 @@ /// /// Write the line separator value to the output stream. ///@throws IOException If there is a problem writing out the line separator to the document. - void writeLineSeparator() => _writeLineSeparator(reference).check(); + void writeLineSeparator() { + return _writeLineSeparator(reference).check(); + } static final _writeWordSeparator = jniLookup< ffi.NativeFunction< @@ -411,7 +450,9 @@ /// /// Write the word separator value to the output stream. ///@throws IOException If there is a problem writing out the word separator to the document. - void writeWordSeparator() => _writeWordSeparator(reference).check(); + void writeWordSeparator() { + return _writeWordSeparator(reference).check(); + } static final _writeCharacters = jniLookup< ffi.NativeFunction< @@ -426,8 +467,11 @@ /// Write the string in TextPosition to the output stream. ///@param text The text to write to the stream. ///@throws IOException If there is an error when writing the text. - void writeCharacters(jni.JObject text) => - _writeCharacters(reference, text.reference).check(); + void writeCharacters( + jni.JObject text, + ) { + return _writeCharacters(reference, text.reference).check(); + } static final _writeString = jniLookup< ffi.NativeFunction< @@ -446,8 +490,13 @@ ///@param text The text to write to the stream. ///@param textPositions The TextPositions belonging to the text. ///@throws IOException If there is an error when writing the text. - void writeString(jni.JString text, jni.JObject textPositions) => - _writeString(reference, text.reference, textPositions.reference).check(); + void writeString( + jni.JString text, + jni.JObject textPositions, + ) { + return _writeString(reference, text.reference, textPositions.reference) + .check(); + } static final _writeString1 = jniLookup< ffi.NativeFunction< @@ -462,8 +511,11 @@ /// Write a Java string to the output stream. ///@param text The text to write to the stream. ///@throws IOException If there is an error when writing the text. - void writeString1(jni.JString text) => - _writeString1(reference, text.reference).check(); + void writeString1( + jni.JString text, + ) { + return _writeString1(reference, text.reference).check(); + } static final _processTextPosition = jniLookup< ffi.NativeFunction< @@ -479,8 +531,11 @@ /// This will process a TextPosition object and add the text to the list of characters on a page. It takes care of /// overlapping text. ///@param text The text to process. - void processTextPosition(jni.JObject text) => - _processTextPosition(reference, text.reference).check(); + void processTextPosition( + jni.JObject text, + ) { + return _processTextPosition(reference, text.reference).check(); + } static final _getStartPage = jniLookup< ffi.NativeFunction< @@ -494,7 +549,9 @@ /// document, if the start page is 1 then all pages will be extracted. If the start page is 4 then pages 4 and 5 will /// be extracted. The default value is 1. ///@return Value of property startPage. - int getStartPage() => _getStartPage(reference).integer; + int getStartPage() { + return _getStartPage(reference).integer; + } static final _setStartPage = jniLookup< ffi.NativeFunction< @@ -506,8 +563,11 @@ /// /// This will set the first page to be extracted by this class. ///@param startPageValue New value of 1-based startPage property. - void setStartPage(int startPageValue) => - _setStartPage(reference, startPageValue).check(); + void setStartPage( + int startPageValue, + ) { + return _setStartPage(reference, startPageValue).check(); + } static final _getEndPage = jniLookup< ffi.NativeFunction< @@ -521,7 +581,9 @@ /// value of 5 would extract the entire document, an end page of 2 would extract pages 1 and 2. This defaults to /// Integer.MAX_VALUE such that all pages of the pdf will be extracted. ///@return Value of property endPage. - int getEndPage() => _getEndPage(reference).integer; + int getEndPage() { + return _getEndPage(reference).integer; + } static final _setEndPage = jniLookup< ffi.NativeFunction< @@ -533,8 +595,11 @@ /// /// This will set the last page to be extracted by this class. ///@param endPageValue New value of 1-based endPage property. - void setEndPage(int endPageValue) => - _setEndPage(reference, endPageValue).check(); + void setEndPage( + int endPageValue, + ) { + return _setEndPage(reference, endPageValue).check(); + } static final _setLineSeparator = jniLookup< ffi.NativeFunction< @@ -549,8 +614,11 @@ /// Set the desired line separator for output text. The line.separator system property is used if the line separator /// preference is not set explicitly using this method. ///@param separator The desired line separator string. - void setLineSeparator(jni.JString separator) => - _setLineSeparator(reference, separator.reference).check(); + void setLineSeparator( + jni.JString separator, + ) { + return _setLineSeparator(reference, separator.reference).check(); + } static final _getLineSeparator = jniLookup< ffi.NativeFunction< @@ -563,8 +631,9 @@ /// /// This will get the line separator. ///@return The desired line separator string. - jni.JString getLineSeparator() => - const jni.JStringType().fromRef(_getLineSeparator(reference).object); + jni.JString getLineSeparator() { + return const jni.JStringType().fromRef(_getLineSeparator(reference).object); + } static final _getWordSeparator = jniLookup< ffi.NativeFunction< @@ -577,8 +646,9 @@ /// /// This will get the word separator. ///@return The desired word separator string. - jni.JString getWordSeparator() => - const jni.JStringType().fromRef(_getWordSeparator(reference).object); + jni.JString getWordSeparator() { + return const jni.JStringType().fromRef(_getWordSeparator(reference).object); + } static final _setWordSeparator = jniLookup< ffi.NativeFunction< @@ -595,8 +665,11 @@ /// accurate count of characters that are found in a PDF document then you might want to set the word separator to /// the empty string. ///@param separator The desired page separator string. - void setWordSeparator(jni.JString separator) => - _setWordSeparator(reference, separator.reference).check(); + void setWordSeparator( + jni.JString separator, + ) { + return _setWordSeparator(reference, separator.reference).check(); + } static final _getSuppressDuplicateOverlappingText = jniLookup< ffi.NativeFunction< @@ -607,8 +680,9 @@ /// from: public boolean getSuppressDuplicateOverlappingText() /// /// @return Returns the suppressDuplicateOverlappingText. - bool getSuppressDuplicateOverlappingText() => - _getSuppressDuplicateOverlappingText(reference).boolean; + bool getSuppressDuplicateOverlappingText() { + return _getSuppressDuplicateOverlappingText(reference).boolean; + } static final _getCurrentPageNo = jniLookup< ffi.NativeFunction< @@ -620,7 +694,9 @@ /// /// Get the current page number that is being processed. ///@return A 1 based number representing the current page. - int getCurrentPageNo() => _getCurrentPageNo(reference).integer; + int getCurrentPageNo() { + return _getCurrentPageNo(reference).integer; + } static final _getOutput = jniLookup< ffi.NativeFunction< @@ -633,8 +709,9 @@ /// /// The output stream that is being written to. ///@return The stream that output is being written to. - jni.JObject getOutput() => - const jni.JObjectType().fromRef(_getOutput(reference).object); + jni.JObject getOutput() { + return const jni.JObjectType().fromRef(_getOutput(reference).object); + } static final _getCharactersByArticle = jniLookup< ffi.NativeFunction< @@ -648,8 +725,10 @@ /// Character strings are grouped by articles. It is quite common that there will only be a single article. This /// returns a List that contains List objects, the inner lists will contain TextPosition objects. ///@return A double List of TextPositions for all text strings on the page. - jni.JObject getCharactersByArticle() => const jni.JObjectType() - .fromRef(_getCharactersByArticle(reference).object); + jni.JObject getCharactersByArticle() { + return const jni.JObjectType() + .fromRef(_getCharactersByArticle(reference).object); + } static final _setSuppressDuplicateOverlappingText = jniLookup< ffi.NativeFunction< @@ -664,10 +743,12 @@ /// means that certain sections will be duplicated, but better performance will be noticed. ///@param suppressDuplicateOverlappingTextValue The suppressDuplicateOverlappingText to set. void setSuppressDuplicateOverlappingText( - bool suppressDuplicateOverlappingTextValue) => - _setSuppressDuplicateOverlappingText( - reference, suppressDuplicateOverlappingTextValue ? 1 : 0) - .check(); + bool suppressDuplicateOverlappingTextValue, + ) { + return _setSuppressDuplicateOverlappingText( + reference, suppressDuplicateOverlappingTextValue ? 1 : 0) + .check(); + } static final _getSeparateByBeads = jniLookup< ffi.NativeFunction< @@ -679,7 +760,9 @@ /// /// This will tell if the text stripper should separate by beads. ///@return If the text will be grouped by beads. - bool getSeparateByBeads() => _getSeparateByBeads(reference).boolean; + bool getSeparateByBeads() { + return _getSeparateByBeads(reference).boolean; + } static final _setShouldSeparateByBeads = jniLookup< ffi.NativeFunction< @@ -691,9 +774,12 @@ /// /// Set if the text stripper should group the text output by a list of beads. The default value is true! ///@param aShouldSeparateByBeads The new grouping of beads. - void setShouldSeparateByBeads(bool aShouldSeparateByBeads) => - _setShouldSeparateByBeads(reference, aShouldSeparateByBeads ? 1 : 0) - .check(); + void setShouldSeparateByBeads( + bool aShouldSeparateByBeads, + ) { + return _setShouldSeparateByBeads(reference, aShouldSeparateByBeads ? 1 : 0) + .check(); + } static final _getEndBookmark = jniLookup< ffi.NativeFunction< @@ -706,8 +792,9 @@ /// /// Get the bookmark where text extraction should end, inclusive. Default is null. ///@return The ending bookmark. - jni.JObject getEndBookmark() => - const jni.JObjectType().fromRef(_getEndBookmark(reference).object); + jni.JObject getEndBookmark() { + return const jni.JObjectType().fromRef(_getEndBookmark(reference).object); + } static final _setEndBookmark = jniLookup< ffi.NativeFunction< @@ -721,8 +808,11 @@ /// /// Set the bookmark where the text extraction should stop. ///@param aEndBookmark The ending bookmark. - void setEndBookmark(jni.JObject aEndBookmark) => - _setEndBookmark(reference, aEndBookmark.reference).check(); + void setEndBookmark( + jni.JObject aEndBookmark, + ) { + return _setEndBookmark(reference, aEndBookmark.reference).check(); + } static final _getStartBookmark = jniLookup< ffi.NativeFunction< @@ -735,8 +825,9 @@ /// /// Get the bookmark where text extraction should start, inclusive. Default is null. ///@return The starting bookmark. - jni.JObject getStartBookmark() => - const jni.JObjectType().fromRef(_getStartBookmark(reference).object); + jni.JObject getStartBookmark() { + return const jni.JObjectType().fromRef(_getStartBookmark(reference).object); + } static final _setStartBookmark = jniLookup< ffi.NativeFunction< @@ -750,8 +841,11 @@ /// /// Set the bookmark where text extraction should start, inclusive. ///@param aStartBookmark The starting bookmark. - void setStartBookmark(jni.JObject aStartBookmark) => - _setStartBookmark(reference, aStartBookmark.reference).check(); + void setStartBookmark( + jni.JObject aStartBookmark, + ) { + return _setStartBookmark(reference, aStartBookmark.reference).check(); + } static final _getAddMoreFormatting = jniLookup< ffi.NativeFunction< @@ -763,7 +857,9 @@ /// /// This will tell if the text stripper should add some more text formatting. ///@return true if some more text formatting will be added - bool getAddMoreFormatting() => _getAddMoreFormatting(reference).boolean; + bool getAddMoreFormatting() { + return _getAddMoreFormatting(reference).boolean; + } static final _setAddMoreFormatting = jniLookup< ffi.NativeFunction< @@ -775,8 +871,12 @@ /// /// There will some additional text formatting be added if addMoreFormatting is set to true. Default is false. ///@param newAddMoreFormatting Tell PDFBox to add some more text formatting - void setAddMoreFormatting(bool newAddMoreFormatting) => - _setAddMoreFormatting(reference, newAddMoreFormatting ? 1 : 0).check(); + void setAddMoreFormatting( + bool newAddMoreFormatting, + ) { + return _setAddMoreFormatting(reference, newAddMoreFormatting ? 1 : 0) + .check(); + } static final _getSortByPosition = jniLookup< ffi.NativeFunction< @@ -788,7 +888,9 @@ /// /// This will tell if the text stripper should sort the text tokens before writing to the stream. ///@return true If the text tokens will be sorted before being written. - bool getSortByPosition() => _getSortByPosition(reference).boolean; + bool getSortByPosition() { + return _getSortByPosition(reference).boolean; + } static final _setSortByPosition = jniLookup< ffi.NativeFunction< @@ -806,8 +908,11 @@ /// A PDF writer could choose to write each character in a different order. By default PDFBox does __not__ sort /// the text tokens before processing them due to performance reasons. ///@param newSortByPosition Tell PDFBox to sort the text positions. - void setSortByPosition(bool newSortByPosition) => - _setSortByPosition(reference, newSortByPosition ? 1 : 0).check(); + void setSortByPosition( + bool newSortByPosition, + ) { + return _setSortByPosition(reference, newSortByPosition ? 1 : 0).check(); + } static final _getSpacingTolerance = jniLookup< ffi.NativeFunction< @@ -820,7 +925,9 @@ /// Get the current space width-based tolerance value that is being used to estimate where spaces in text should be /// added. Note that the default value for this has been determined from trial and error. ///@return The current tolerance / scaling factor - double getSpacingTolerance() => _getSpacingTolerance(reference).float; + double getSpacingTolerance() { + return _getSpacingTolerance(reference).float; + } static final _setSpacingTolerance = jniLookup< ffi.NativeFunction< @@ -834,8 +941,11 @@ /// that the default value for this has been determined from trial and error. Setting this value larger will reduce /// the number of spaces added. ///@param spacingToleranceValue tolerance / scaling factor to use - void setSpacingTolerance(double spacingToleranceValue) => - _setSpacingTolerance(reference, spacingToleranceValue).check(); + void setSpacingTolerance( + double spacingToleranceValue, + ) { + return _setSpacingTolerance(reference, spacingToleranceValue).check(); + } static final _getAverageCharTolerance = jniLookup< ffi.NativeFunction< @@ -848,7 +958,9 @@ /// Get the current character width-based tolerance value that is being used to estimate where spaces in text should /// be added. Note that the default value for this has been determined from trial and error. ///@return The current tolerance / scaling factor - double getAverageCharTolerance() => _getAverageCharTolerance(reference).float; + double getAverageCharTolerance() { + return _getAverageCharTolerance(reference).float; + } static final _setAverageCharTolerance = jniLookup< ffi.NativeFunction< @@ -862,8 +974,12 @@ /// that the default value for this has been determined from trial and error. Setting this value larger will reduce /// the number of spaces added. ///@param averageCharToleranceValue average tolerance / scaling factor to use - void setAverageCharTolerance(double averageCharToleranceValue) => - _setAverageCharTolerance(reference, averageCharToleranceValue).check(); + void setAverageCharTolerance( + double averageCharToleranceValue, + ) { + return _setAverageCharTolerance(reference, averageCharToleranceValue) + .check(); + } static final _getIndentThreshold = jniLookup< ffi.NativeFunction< @@ -876,7 +992,9 @@ /// returns the multiple of whitespace character widths for the current text which the current line start can be /// indented from the previous line start beyond which the current line start is considered to be a paragraph start. ///@return the number of whitespace character widths to use when detecting paragraph indents. - double getIndentThreshold() => _getIndentThreshold(reference).float; + double getIndentThreshold() { + return _getIndentThreshold(reference).float; + } static final _setIndentThreshold = jniLookup< ffi.NativeFunction< @@ -890,8 +1008,11 @@ /// indented from the previous line start beyond which the current line start is considered to be a paragraph start. /// The default value is 2.0. ///@param indentThresholdValue the number of whitespace character widths to use when detecting paragraph indents. - void setIndentThreshold(double indentThresholdValue) => - _setIndentThreshold(reference, indentThresholdValue).check(); + void setIndentThreshold( + double indentThresholdValue, + ) { + return _setIndentThreshold(reference, indentThresholdValue).check(); + } static final _getDropThreshold = jniLookup< ffi.NativeFunction< @@ -904,7 +1025,9 @@ /// the minimum whitespace, as a multiple of the max height of the current characters beyond which the current line /// start is considered to be a paragraph start. ///@return the character height multiple for max allowed whitespace between lines in the same paragraph. - double getDropThreshold() => _getDropThreshold(reference).float; + double getDropThreshold() { + return _getDropThreshold(reference).float; + } static final _setDropThreshold = jniLookup< ffi.NativeFunction< @@ -918,8 +1041,11 @@ /// line start is considered to be a paragraph start. The default value is 2.5. ///@param dropThresholdValue the character height multiple for max allowed whitespace between lines in the same /// paragraph. - void setDropThreshold(double dropThresholdValue) => - _setDropThreshold(reference, dropThresholdValue).check(); + void setDropThreshold( + double dropThresholdValue, + ) { + return _setDropThreshold(reference, dropThresholdValue).check(); + } static final _getParagraphStart = jniLookup< ffi.NativeFunction< @@ -932,8 +1058,10 @@ /// /// Returns the string which will be used at the beginning of a paragraph. ///@return the paragraph start string - jni.JString getParagraphStart() => - const jni.JStringType().fromRef(_getParagraphStart(reference).object); + jni.JString getParagraphStart() { + return const jni.JStringType() + .fromRef(_getParagraphStart(reference).object); + } static final _setParagraphStart = jniLookup< ffi.NativeFunction< @@ -947,8 +1075,11 @@ /// /// Sets the string which will be used at the beginning of a paragraph. ///@param s the paragraph start string - void setParagraphStart(jni.JString s) => - _setParagraphStart(reference, s.reference).check(); + void setParagraphStart( + jni.JString s, + ) { + return _setParagraphStart(reference, s.reference).check(); + } static final _getParagraphEnd = jniLookup< ffi.NativeFunction< @@ -961,8 +1092,9 @@ /// /// Returns the string which will be used at the end of a paragraph. ///@return the paragraph end string - jni.JString getParagraphEnd() => - const jni.JStringType().fromRef(_getParagraphEnd(reference).object); + jni.JString getParagraphEnd() { + return const jni.JStringType().fromRef(_getParagraphEnd(reference).object); + } static final _setParagraphEnd = jniLookup< ffi.NativeFunction< @@ -976,8 +1108,11 @@ /// /// Sets the string which will be used at the end of a paragraph. ///@param s the paragraph end string - void setParagraphEnd(jni.JString s) => - _setParagraphEnd(reference, s.reference).check(); + void setParagraphEnd( + jni.JString s, + ) { + return _setParagraphEnd(reference, s.reference).check(); + } static final _getPageStart = jniLookup< ffi.NativeFunction< @@ -990,8 +1125,9 @@ /// /// Returns the string which will be used at the beginning of a page. ///@return the page start string - jni.JString getPageStart() => - const jni.JStringType().fromRef(_getPageStart(reference).object); + jni.JString getPageStart() { + return const jni.JStringType().fromRef(_getPageStart(reference).object); + } static final _setPageStart = jniLookup< ffi.NativeFunction< @@ -1005,8 +1141,11 @@ /// /// Sets the string which will be used at the beginning of a page. ///@param pageStartValue the page start string - void setPageStart(jni.JString pageStartValue) => - _setPageStart(reference, pageStartValue.reference).check(); + void setPageStart( + jni.JString pageStartValue, + ) { + return _setPageStart(reference, pageStartValue.reference).check(); + } static final _getPageEnd = jniLookup< ffi.NativeFunction< @@ -1019,8 +1158,9 @@ /// /// Returns the string which will be used at the end of a page. ///@return the page end string - jni.JString getPageEnd() => - const jni.JStringType().fromRef(_getPageEnd(reference).object); + jni.JString getPageEnd() { + return const jni.JStringType().fromRef(_getPageEnd(reference).object); + } static final _setPageEnd = jniLookup< ffi.NativeFunction< @@ -1034,8 +1174,11 @@ /// /// Sets the string which will be used at the end of a page. ///@param pageEndValue the page end string - void setPageEnd(jni.JString pageEndValue) => - _setPageEnd(reference, pageEndValue.reference).check(); + void setPageEnd( + jni.JString pageEndValue, + ) { + return _setPageEnd(reference, pageEndValue.reference).check(); + } static final _getArticleStart = jniLookup< ffi.NativeFunction< @@ -1048,8 +1191,9 @@ /// /// Returns the string which will be used at the beginning of an article. ///@return the article start string - jni.JString getArticleStart() => - const jni.JStringType().fromRef(_getArticleStart(reference).object); + jni.JString getArticleStart() { + return const jni.JStringType().fromRef(_getArticleStart(reference).object); + } static final _setArticleStart = jniLookup< ffi.NativeFunction< @@ -1063,8 +1207,11 @@ /// /// Sets the string which will be used at the beginning of an article. ///@param articleStartValue the article start string - void setArticleStart(jni.JString articleStartValue) => - _setArticleStart(reference, articleStartValue.reference).check(); + void setArticleStart( + jni.JString articleStartValue, + ) { + return _setArticleStart(reference, articleStartValue.reference).check(); + } static final _getArticleEnd = jniLookup< ffi.NativeFunction< @@ -1077,8 +1224,9 @@ /// /// Returns the string which will be used at the end of an article. ///@return the article end string - jni.JString getArticleEnd() => - const jni.JStringType().fromRef(_getArticleEnd(reference).object); + jni.JString getArticleEnd() { + return const jni.JStringType().fromRef(_getArticleEnd(reference).object); + } static final _setArticleEnd = jniLookup< ffi.NativeFunction< @@ -1092,8 +1240,11 @@ /// /// Sets the string which will be used at the end of an article. ///@param articleEndValue the article end string - void setArticleEnd(jni.JString articleEndValue) => - _setArticleEnd(reference, articleEndValue.reference).check(); + void setArticleEnd( + jni.JString articleEndValue, + ) { + return _setArticleEnd(reference, articleEndValue.reference).check(); + } static final _writeParagraphSeparator = jniLookup< ffi.NativeFunction< @@ -1105,7 +1256,9 @@ /// /// writes the paragraph separator string to the output. ///@throws IOException if something went wrong - void writeParagraphSeparator() => _writeParagraphSeparator(reference).check(); + void writeParagraphSeparator() { + return _writeParagraphSeparator(reference).check(); + } static final _writeParagraphStart = jniLookup< ffi.NativeFunction< @@ -1117,7 +1270,9 @@ /// /// Write something (if defined) at the start of a paragraph. ///@throws IOException if something went wrong - void writeParagraphStart() => _writeParagraphStart(reference).check(); + void writeParagraphStart() { + return _writeParagraphStart(reference).check(); + } static final _writeParagraphEnd = jniLookup< ffi.NativeFunction< @@ -1129,7 +1284,9 @@ /// /// Write something (if defined) at the end of a paragraph. ///@throws IOException if something went wrong - void writeParagraphEnd() => _writeParagraphEnd(reference).check(); + void writeParagraphEnd() { + return _writeParagraphEnd(reference).check(); + } static final _writePageStart = jniLookup< ffi.NativeFunction< @@ -1141,7 +1298,9 @@ /// /// Write something (if defined) at the start of a page. ///@throws IOException if something went wrong - void writePageStart() => _writePageStart(reference).check(); + void writePageStart() { + return _writePageStart(reference).check(); + } static final _writePageEnd = jniLookup< ffi.NativeFunction< @@ -1153,7 +1312,9 @@ /// /// Write something (if defined) at the end of a page. ///@throws IOException if something went wrong - void writePageEnd() => _writePageEnd(reference).check(); + void writePageEnd() { + return _writePageEnd(reference).check(); + } static final _setListItemPatterns = jniLookup< ffi.NativeFunction< @@ -1168,8 +1329,11 @@ /// /// use to supply a different set of regular expression patterns for matching list item starts. ///@param patterns list of patterns - void setListItemPatterns(jni.JObject patterns) => - _setListItemPatterns(reference, patterns.reference).check(); + void setListItemPatterns( + jni.JObject patterns, + ) { + return _setListItemPatterns(reference, patterns.reference).check(); + } static final _getListItemPatterns = jniLookup< ffi.NativeFunction< @@ -1196,8 +1360,10 @@ /// /// This method returns a list of such regular expression Patterns. ///@return a list of Pattern objects. - jni.JObject getListItemPatterns() => - const jni.JObjectType().fromRef(_getListItemPatterns(reference).object); + jni.JObject getListItemPatterns() { + return const jni.JObjectType() + .fromRef(_getListItemPatterns(reference).object); + } static final _matchPattern = jniLookup< ffi.NativeFunction< @@ -1220,9 +1386,13 @@ ///@param string the string to be searched ///@param patterns list of patterns ///@return matching pattern - static jni.JObject matchPattern(jni.JString string, jni.JObject patterns) => - const jni.JObjectType() - .fromRef(_matchPattern(string.reference, patterns.reference).object); + static jni.JObject matchPattern( + jni.JString string, + jni.JObject patterns, + ) { + return const jni.JObjectType() + .fromRef(_matchPattern(string.reference, patterns.reference).object); + } } class $PDFTextStripperType extends jni.JObjType<PDFTextStripper> { @@ -1233,4 +1403,19 @@ @override PDFTextStripper fromRef(jni.JObjectPtr ref) => PDFTextStripper.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($PDFTextStripperType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $PDFTextStripperType && + other is $PDFTextStripperType; + } }
diff --git a/pkgs/jnigen/lib/src/bindings/dart_generator.dart b/pkgs/jnigen/lib/src/bindings/dart_generator.dart index 56fff02..58561f9 100644 --- a/pkgs/jnigen/lib/src/bindings/dart_generator.dart +++ b/pkgs/jnigen/lib/src/bindings/dart_generator.dart
@@ -4,6 +4,8 @@ import 'dart:io'; +import 'package:meta/meta.dart'; + import '../config/config.dart'; import '../elements/elements.dart'; import '../logging/logging.dart'; @@ -50,6 +52,16 @@ String capitalize() { return '${this[0].toUpperCase()}${substring(1)}'; } + + /// Reverses an ASCII string. + String get reversed => split('').reversed.join(); +} + +extension on Iterable<String> { + /// Similar to [join] but adds the [separator] to the end as well. + String delimited([String separator = '']) { + return map((e) => '$e$separator').join(); + } } /// Encloses [inside] in the middle of [open] and [close] @@ -63,6 +75,33 @@ return '\n${' ' * depth}'; } +/// Merges two maps. For the same keys, their value lists will be concatenated. +/// +/// ** After calling this, the original maps might get modified! ** +Map<K, List<V>> _mergeMapValues<K, V>(Map<K, List<V>> a, Map<K, List<V>> b) { + final merged = <K, List<V>>{}; + for (final key in {...a.keys, ...b.keys}) { + if (!a.containsKey(key)) { + merged[key] = b[key]!; + continue; + } + if (!b.containsKey(key)) { + merged[key] = a[key]!; + continue; + } + + // Merging the smaller one to the bigger one + if (a[key]!.length > b[key]!.length) { + merged[key] = a[key]!; + merged[key]!.addAll(b[key]!); + } else { + merged[key] = b[key]!; + merged[key]!.addAll(a[key]!); + } + } + return merged; +} + /// **Naming Convention** /// /// Let's take the following code as an example: @@ -87,10 +126,10 @@ /// * `fTypeClassesDef` refers to `JType<T> $T, JType<U> $U`. /// * `fTypeClassesCall` refers to `$T, $U` when calling the method. class DartGenerator extends Visitor<Classes, Future<void>> { - DartGenerator(this.config); - final Config config; + DartGenerator(this.config); + static const cInitImport = 'import "dart:ffi" as ffi;\n' 'import "package:jni/internal_helpers_for_jnigen.dart";\n'; @@ -243,16 +282,16 @@ /// Generates the Dart class definition, type class, and the array extension class _ClassGenerator extends Visitor<ClassDecl, void> { + final Config config; + final StringSink s; + final Resolver? resolver; + _ClassGenerator( this.config, this.s, { this.resolver, }); - final Config config; - final StringSink s; - final Resolver? resolver; - static const staticTypeGetter = 'type'; static const instanceTypeGetter = '\$$staticTypeGetter'; @@ -277,18 +316,22 @@ ); final typeParams = node.allTypeParams .accept(const _TypeParamGenerator(withExtends: false)); - final typeParamsCall = _encloseIfNotEmpty('<', typeParams.join(', '), '>'); + final typeParamsCall = _encloseIfNotEmpty( + '<', + typeParams.map((typeParam) => '$_typeParamPrefix$typeParam').join(', '), + '>', + ); final staticTypeGetterCallArgs = _encloseIfNotEmpty( '(', - typeParams.map((typeParams) => '$_typeParamPrefix$typeParams').join(', '), + typeParams.join(', '), ')', ); final typeClassDefinitions = typeParams .map((typeParam) => - 'final $_jType<$typeParam> $_typeParamPrefix$typeParam;') + 'final $_jType<$_typeParamPrefix$typeParam> $typeParam;') .join(_newLine(depth: 1)); final ctorTypeClassesDef = typeParams - .map((typeParam) => 'this.$_typeParamPrefix$typeParam,') + .map((typeParam) => 'this.$typeParam,') .join(_newLine(depth: 2)); final superClass = (node.classDecl.superclass!.type as DeclaredType); final superTypeClassesCall = superClass.classDecl == ClassDecl.object @@ -299,9 +342,8 @@ .join(_newLine(depth: 2)); s.write(''' class $name$typeParamsDef extends $superName { - late final $_jType? _$instanceTypeGetter; @override - $_jType get $instanceTypeGetter => _$instanceTypeGetter ??= $staticTypeGetter$staticTypeGetterCallArgs; + late final $_jType $instanceTypeGetter = $staticTypeGetter$staticTypeGetterCallArgs; $typeClassDefinitions @@ -332,11 +374,10 @@ } else { final staticTypeGetterTypeClassesDef = typeParams .map( - (typeParam) => '$_jType<$typeParam> $_typeParamPrefix$typeParam,') + (typeParam) => '$_jType<$_typeParamPrefix$typeParam> $typeParam,') .join(_newLine(depth: 2)); - final typeClassesCall = typeParams - .map((typeParam) => '$_typeParamPrefix$typeParam,') - .join(_newLine(depth: 3)); + final typeClassesCall = + typeParams.map((typeParam) => '$typeParam,').join(_newLine(depth: 3)); s.write(''' static $typeClassName$typeParamsCall $staticTypeGetter$typeParamsDef( $staticTypeGetterTypeClassesDef @@ -363,10 +404,17 @@ s.writeln('}'); // TypeClass definition - final typeClassesCall = typeParams - .map((typeParam) => '$_typeParamPrefix$typeParam,') - .join(_newLine(depth: 2)); + final typeClassesCall = + typeParams.map((typeParam) => '$typeParam,').join(_newLine(depth: 2)); final signature = node.signature; + final superTypeClass = superClass.accept(_TypeClassGenerator(resolver)); + final hashCodeTypeClasses = typeParams.join(', '); + final equalityTypeClasses = typeParams + .map((typeParam) => ' && $typeParam == other.$typeParam') + .join(); + final hashCode = typeParams.isEmpty + ? '($typeClassName).hashCode' + : 'Object.hash($typeClassName, $hashCodeTypeClasses)'; s.write(''' class $typeClassName$typeParamsDef extends $_jType<$name$typeParamsCall> { $typeClassDefinitions @@ -383,6 +431,20 @@ $typeClassesCall ref ); + + @override + $_jType get superType => ${superTypeClass.name}; + + @override + final superCount = ${node.superCount}; + + @override + int get hashCode => $hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $typeClassName && other is $typeClassName$equalityTypeClasses; + } } '''); @@ -392,11 +454,11 @@ /// Generates the JavaDoc comments. class _DocGenerator extends Visitor<JavaDocComment, void> { - const _DocGenerator(this.s, {required this.depth}); - final StringSink s; final int depth; + const _DocGenerator(this.s, {required this.depth}); + @override void visit(JavaDocComment node) { final link = RegExp('{@link ([^{}]+)}'); @@ -421,10 +483,10 @@ /// Generates the user-facing Dart type. class _TypeGenerator extends TypeVisitor<String> { - const _TypeGenerator(this.resolver); - final Resolver? resolver; + const _TypeGenerator(this.resolver); + @override String visitArrayType(ArrayType node) { final innerType = node.type; @@ -478,7 +540,7 @@ @override String visitTypeVar(TypeVar node) { - return node.name; + return '$_typeParamPrefix${node.name}'; } @override @@ -494,10 +556,10 @@ } class _TypeClass { - const _TypeClass(this.name, this.canBeConst); - final String name; final bool canBeConst; + + const _TypeClass(this.name, this.canBeConst); } /// Generates the type class. @@ -528,7 +590,6 @@ } final allTypeParams = node.classDecl.allTypeParams .accept(const _TypeParamGenerator(withExtends: false)) - .map((typeParam) => '$_typeParamPrefix$typeParam') .toList(); // The ones that are declared. @@ -539,9 +600,6 @@ // also const. final canBeConst = definedTypeClasses.every((e) => e.canBeConst); - // Adding const to `JObjectType`s if the entire expression is not const. - final constJObject = canBeConst ? '' : 'const '; - // Replacing the declared ones. They come at the end. // The rest will be `JObjectType`. if (allTypeParams.length >= node.params.length) { @@ -550,13 +608,16 @@ allTypeParams.length - node.params.length, List.filled( allTypeParams.length - node.params.length, - '$constJObject$_jObject$_typeClassSuffix()', + // Adding const to subexpressions if the entire expression is not const. + '${canBeConst ? '' : 'const '}$_jObject$_typeClassSuffix()', ), ); allTypeParams.replaceRange( allTypeParams.length - node.params.length, allTypeParams.length, - definedTypeClasses.map((param) => param.name), + // Adding const to subexpressions if the entire expression is not const. + definedTypeClasses.map((param) => + '${param.canBeConst && !canBeConst ? 'const ' : ''}${param.name}'), ); } @@ -577,7 +638,7 @@ @override _TypeClass visitTypeVar(TypeVar node) { - return _TypeClass('$_typeParamPrefix${node.name}', false); + return _TypeClass(node.name, false); } @override @@ -594,17 +655,17 @@ } class _TypeParamGenerator extends Visitor<TypeParam, String> { - const _TypeParamGenerator({required this.withExtends}); - final bool withExtends; + const _TypeParamGenerator({required this.withExtends}); + @override String visit(TypeParam node) { if (!withExtends) { return node.name; } // TODO(#144): resolve the actual type being extended, if any. - return '${node.name} extends $_jObject'; + return '$_typeParamPrefix${node.name} extends $_jObject'; } } @@ -637,10 +698,10 @@ /// .asFunction<jni.JniResult Function(int, int)>(); /// ``` class _TypeSig extends TypeVisitor<String> { - const _TypeSig({required this.isFfi}); - final bool isFfi; + const _TypeSig({required this.isFfi}); + @override String visitPrimitiveType(PrimitiveType node) { if (isFfi) return '$_ffi.${node.ffiType}'; @@ -700,11 +761,11 @@ } class _FromNative extends TypeVisitor<String> { - const _FromNative(this.resolver, this.value); - final Resolver? resolver; final String value; + const _FromNative(this.resolver, this.value); + @override String visitPrimitiveType(PrimitiveType node) { return value; @@ -718,12 +779,12 @@ } class _FieldGenerator extends Visitor<Field, void> { - const _FieldGenerator(this.config, this.resolver, this.s); - final Config config; final Resolver? resolver; final StringSink s; + const _FieldGenerator(this.config, this.resolver, this.s); + void writeCAccessor(Field node) { final name = node.finalName; final cName = node.accept(const CFieldName()); @@ -854,10 +915,10 @@ } class _MethodTypeSig extends Visitor<Method, String> { - const _MethodTypeSig({required this.isFfi}); - final bool isFfi; + const _MethodTypeSig({required this.isFfi}); + @override String visit(Method node) { final args = [ @@ -872,12 +933,12 @@ /// Generates Dart bindings for Java methods. class _MethodGenerator extends Visitor<Method, void> { - const _MethodGenerator(this.config, this.resolver, this.s); - final Config config; final Resolver? resolver; final StringSink s; + const _MethodGenerator(this.config, this.resolver, this.s); + void writeCAccessor(Method node) { final name = node.finalName; final cName = node.accept(const CMethodName()); @@ -938,7 +999,8 @@ final params = node.params.accept(const _ParamCall(isCBased: false)).join(', '); final resultGetter = node.returnType.accept(const _JniResultGetter()); - return '$_accessors.call${ifStatic}MethodWithArgs($self, _id_$name, $callType, [$params]).$resultGetter'; + return '$_accessors.call${ifStatic}MethodWithArgs' + '($self, _id_$name, $callType, [$params]).$resultGetter'; } @override @@ -959,27 +1021,58 @@ } node.javadoc?.accept(_DocGenerator(s, depth: 1)); + // Used for inferring the type parameter from the given parameters. + final typeLocators = node.params + .accept(_ParamTypeLocator(resolver: resolver)) + .fold(<String, List<String>>{}, _mergeMapValues).map( + (key, value) => MapEntry( + key, + _encloseIfNotEmpty( + '[', + value.delimited(', '), + ']', + ), + )); + + bool isRequired(TypeParam typeParam) { + return (typeLocators[typeParam.name] ?? '').isEmpty; + } + + final typeInference = + (node.isCtor ? node.classDecl.allTypeParams : node.typeParams) + .where((tp) => !isRequired(tp)) + .map((tp) => tp.name) + .map((tp) => '$tp ??= $_jni.lowestCommonSuperType' + '(${typeLocators[tp]}) as $_jType<$_typeParamPrefix$tp>;') + .join(_newLine(depth: 2)); + if (node.isCtor) { final className = node.classDecl.finalName; final name = node.finalName; final ctorName = name == 'ctor' ? className : '$className.$name'; - final paramsDef = [ - ...node.classDecl.allTypeParams.accept(const _ClassTypeParamDef()), - ...node.params.accept(_ParamDef(resolver)), - ].join(', '); - final superClass = (node.classDecl.superclass!.type as DeclaredType); - final superTypeClassesCall = superClass.classDecl == ClassDecl.object - ? '' - : superClass.params - .accept(_TypeClassGenerator(resolver)) - .map((typeClass) => '${typeClass.name},') - .join(_newLine(depth: 2)); + final paramsDef = node.params.accept(_ParamDef(resolver)).delimited(', '); + final typeClassDef = _encloseIfNotEmpty( + '{', + node.classDecl.allTypeParams + .map((typeParam) => typeParam + .accept(_CtorTypeClassDef(isRequired: isRequired(typeParam)))) + .delimited(', '), + '}', + ); + final typeClassCall = node.classDecl.allTypeParams + .map((typeParam) => + typeParam.accept(const _TypeParamGenerator(withExtends: false))) + .delimited(', '); + final ctorExpr = (isCBased ? cCtor : dartOnlyCtor)(node); s.write(''' - $ctorName($paramsDef) : super.fromRef( - $superTypeClassesCall - $ctorExpr.object - ); + factory $ctorName($paramsDef$typeClassDef) { + $typeInference + return ${node.classDecl.finalName}.fromRef( + $typeClassCall + $ctorExpr.object + ); + } '''); return; @@ -993,10 +1086,16 @@ .accept(_TypeClassGenerator(resolver)) .name; final ifStatic = node.isStatic ? 'static ' : ''; - final defArgs = [ - ...node.typeParams.accept(const _MethodTypeParamDef()), - ...node.params.accept(_ParamDef(resolver)) - ]; + final defArgs = node.params.accept(_ParamDef(resolver)).toList(); + final typeClassDef = _encloseIfNotEmpty( + '{', + node.typeParams + .map((typeParam) => typeParam.accept(_MethodTypeClassDef( + isRequired: isRequired(typeParam), + ))) + .delimited(', '), + '}', + ); final typeParamsDef = _encloseIfNotEmpty( '<', node.typeParams @@ -1007,13 +1106,14 @@ if (isSuspendFun(node)) { defArgs.removeLast(); } - final params = defArgs.join(', '); - s.write(' $ifStatic$returnType $name$typeParamsDef($params) '); + final params = defArgs.delimited(', '); + s.write(' $ifStatic$returnType $name$typeParamsDef($params$typeClassDef)'); final callExpr = (isCBased ? cMethodCall : dartOnlyMethodCall)(node); if (isSuspendFun(node)) { final returning = node.asyncReturnType!.accept(_FromNative(resolver, '\$o')); s.write('''async { + $typeInference final \$p = ReceivePort(); final \$c = $_jObject.fromRef($_jni.Jni.newPortContinuation(\$p)); $callExpr; @@ -1028,41 +1128,51 @@ '''); } else { final returning = node.returnType.accept(_FromNative(resolver, callExpr)); - s.writeln('=> $returning;\n'); + s.writeln('''{ + $typeInference + return $returning; + } +'''); } } } /// Generates the method type param definition. /// -/// For example `JObjType<T> $T` in: +/// For example `required JObjType<T> $T` in: /// ```dart -/// void bar(JObjType<T> $T, ...) => ... +/// void bar(..., {required JObjType<T> $T}) => ... /// ``` -class _MethodTypeParamDef extends Visitor<TypeParam, String> { - const _MethodTypeParamDef(); +class _MethodTypeClassDef extends Visitor<TypeParam, String> { + final bool isRequired; + + const _MethodTypeClassDef({required this.isRequired}); @override String visit(TypeParam node) { - return '$_jType<${node.name}> $_typeParamPrefix${node.name}'; + return '${isRequired ? 'required ' : ''}$_jType' + '<$_typeParamPrefix${node.name}>${isRequired ? '' : '?'} ${node.name}'; } } /// Generates the class type param definition. Used only in constructors. /// -/// For example `this.$T` in: +/// For example `required this.$T` in: /// ```dart /// class Foo { /// final JObjType<T> $T; -/// Foo(this.$T, ...) => ... +/// Foo(..., {required this.$T}) => ... /// } /// ``` -class _ClassTypeParamDef extends Visitor<TypeParam, String> { - const _ClassTypeParamDef(); +class _CtorTypeClassDef extends Visitor<TypeParam, String> { + final bool isRequired; + + const _CtorTypeClassDef({required this.isRequired}); @override String visit(TypeParam node) { - return 'this.$_typeParamPrefix${node.name}'; + return '${isRequired ? 'required ' : ''} $_jType' + '<$_typeParamPrefix${node.name}>${isRequired ? '' : '?'} ${node.name}'; } } @@ -1073,10 +1183,10 @@ /// void bar(Foo foo) => ... /// ``` class _ParamDef extends Visitor<Param, String> { - const _ParamDef(this.resolver); - final Resolver? resolver; + const _ParamDef(this.resolver); + @override String visit(Param node) { final type = node.type.accept(_TypeGenerator(resolver)); @@ -1131,3 +1241,135 @@ return '$_jni.JValue${node.name.capitalize()}($param)'; } } + +/// A pair of [StringBuffer]s that can create an expression from the outer layer +/// inwards. +/// +/// For example: +/// ```dart +/// final buffer = OutsideInBuffer(); // asterisk (*) is used to show the middle +/// buffer.appendLeft('f('); // f(* +/// buffer.prependRight('x)'); // f(*x) +/// buffer.appendLeft('g('); // f(g(*x) +/// buffer.prependRight('y) + '); // f(g(*y) + x) +/// buffer.toString(); // f(g(y) + x) +/// ``` +@visibleForTesting +class OutsideInBuffer { + final StringBuffer _leftBuffer; + final StringBuffer _rightBuffer; + + OutsideInBuffer() + : _leftBuffer = StringBuffer(), + _rightBuffer = StringBuffer(); + + void prependRight(Object? object) { + final s = object.toString(); + for (var i = 0; i < s.length; ++i) { + _rightBuffer.write(s[s.length - i - 1]); + } + } + + void appendLeft(Object? object) { + _leftBuffer.write(object); + } + + @override + String toString() { + return _leftBuffer.toString() + _rightBuffer.toString().reversed; + } +} + +/// The ways to locate each type parameter. +/// +/// For example in `JArray<JMap<$T, $T>> a`, `T` can be retreived using +/// ```dart +/// ((((a.$type as jni.JArrayType).elementType) as $JMapType).K) as jni.JObjType<$T> +/// ``` +/// and +/// ```dart +/// ((((a.$type as jni.JArrayType).elementType) as $JMapType).V) as jni.JObjType<$T> +/// ``` +class _ParamTypeLocator extends Visitor<Param, Map<String, List<String>>> { + final Resolver? resolver; + + _ParamTypeLocator({required this.resolver}); + + @override + Map<String, List<String>> visit(Param node) { + return node.type.accept(_TypeVarLocator(resolver: resolver)).map( + (key, value) => MapEntry( + key, + value + .map((e) => + (e..appendLeft('${node.finalName}.\$type')).toString()) + .toList(), + ), + ); + } +} + +class _TypeVarLocator extends TypeVisitor<Map<String, List<OutsideInBuffer>>> { + final Resolver? resolver; + + _TypeVarLocator({required this.resolver}); + + @override + Map<String, List<OutsideInBuffer>> visitNonPrimitiveType(ReferredType node) { + return {}; + } + + @override + Map<String, List<OutsideInBuffer>> visitWildcard(Wildcard node) { + // TODO(#141): Support wildcards + return super.visitWildcard(node); + } + + @override + Map<String, List<OutsideInBuffer>> visitTypeVar(TypeVar node) { + return { + node.name: [ + OutsideInBuffer(), + ], + }; + } + + @override + Map<String, List<OutsideInBuffer>> visitDeclaredType(DeclaredType node) { + if (node.classDecl == ClassDecl.object) { + return {}; + } + final offset = node.classDecl.allTypeParams.length - node.params.length; + final result = <String, List<OutsideInBuffer>>{}; + final prefix = resolver?.resolvePrefix(node.binaryName) ?? ''; + final typeClass = + '$prefix$_typeClassPrefix${node.classDecl.finalName}$_typeClassSuffix'; + for (var i = 0; i < node.params.length; ++i) { + final typeParam = node.classDecl.allTypeParams[i + offset].name; + final exprs = node.params[i].accept(this); + for (final expr in exprs.entries) { + for (final buffer in expr.value) { + buffer.appendLeft('('); + buffer.prependRight(' as $typeClass).$typeParam'); + result[expr.key] = (result[expr.key] ?? [])..add(buffer); + } + } + } + return result; + } + + @override + Map<String, List<OutsideInBuffer>> visitArrayType(ArrayType node) { + final exprs = node.type.accept(this); + for (final e in exprs.values.expand((i) => i)) { + e.appendLeft('(('); + e.prependRight(' as $_jArray$_typeClassSuffix).elementType as $_jType)'); + } + return exprs; + } + + @override + Map<String, List<OutsideInBuffer>> visitPrimitiveType(PrimitiveType node) { + return {}; + } +}
diff --git a/pkgs/jnigen/lib/src/bindings/excluder.dart b/pkgs/jnigen/lib/src/bindings/excluder.dart index 88beefd..1568bd3 100644 --- a/pkgs/jnigen/lib/src/bindings/excluder.dart +++ b/pkgs/jnigen/lib/src/bindings/excluder.dart
@@ -11,10 +11,10 @@ !classMember.isPublic && !classMember.isProtected; class Excluder extends Visitor<Classes, void> { - const Excluder(this.config); - final Config config; + const Excluder(this.config); + @override void visit(Classes node) { node.decls.removeWhere((_, classDecl) { @@ -33,10 +33,10 @@ } class _ClassExcluder extends Visitor<ClassDecl, void> { - _ClassExcluder(this.config); - final Config config; + _ClassExcluder(this.config); + @override void visit(ClassDecl node) { node.methods = node.methods.where((method) {
diff --git a/pkgs/jnigen/lib/src/bindings/linker.dart b/pkgs/jnigen/lib/src/bindings/linker.dart index f4fe617..e50d437 100644 --- a/pkgs/jnigen/lib/src/bindings/linker.dart +++ b/pkgs/jnigen/lib/src/bindings/linker.dart
@@ -61,6 +61,8 @@ final superclass = (node.superclass!.type as DeclaredType).classDecl; superclass.accept(this); + node.superCount = superclass.superCount + 1; + final fieldLinker = _FieldLinker(typeLinker); for (final field in node.fields) { field.classDecl = node;
diff --git a/pkgs/jnigen/lib/src/bindings/renamer.dart b/pkgs/jnigen/lib/src/bindings/renamer.dart index e9fbda9..4f1c440 100644 --- a/pkgs/jnigen/lib/src/bindings/renamer.dart +++ b/pkgs/jnigen/lib/src/bindings/renamer.dart
@@ -119,9 +119,10 @@ } class Renamer implements Visitor<Classes, void> { - Renamer(this.config); final Config config; + Renamer(this.config); + @override void visit(Classes node) { final classRenamer = _ClassRenamer(config); @@ -133,10 +134,6 @@ } class _ClassRenamer implements Visitor<ClassDecl, void> { - _ClassRenamer( - this.config, - ); - final Config config; final Map<String, int> classNameCounts = {}; final Set<ClassDecl> renamed = {...ClassDecl.predefined.values}; @@ -147,6 +144,10 @@ }; final Map<ClassDecl, Map<String, int>> methodNumsAfterRenaming = {}; + _ClassRenamer( + this.config, + ); + /// Returns class name as useful in dart. /// /// Eg -> a.b.X.Y -> X_Y
diff --git a/pkgs/jnigen/lib/src/bindings/resolver.dart b/pkgs/jnigen/lib/src/bindings/resolver.dart index cc7a45e..b0c8230 100644 --- a/pkgs/jnigen/lib/src/bindings/resolver.dart +++ b/pkgs/jnigen/lib/src/bindings/resolver.dart
@@ -7,12 +7,6 @@ import '../logging/logging.dart'; class Resolver { - Resolver({ - required this.importMap, - required this.currentClass, - this.inputClassNames = const {}, - }); - static const Map<String, String> predefined = { 'java.lang.String': 'jni.', }; @@ -32,6 +26,12 @@ final Map<String, String> _importedNameToClass = {}; final Map<String, String> _classToImportedName = {}; + Resolver({ + required this.importMap, + required this.currentClass, + this.inputClassNames = const {}, + }); + static String getFileClassName(String binaryName) { final dollarSign = binaryName.indexOf('\$'); if (dollarSign != -1) {
diff --git a/pkgs/jnigen/lib/src/bindings/visitor.dart b/pkgs/jnigen/lib/src/bindings/visitor.dart index 8454cac..c2bf9e6 100644 --- a/pkgs/jnigen/lib/src/bindings/visitor.dart +++ b/pkgs/jnigen/lib/src/bindings/visitor.dart
@@ -22,18 +22,21 @@ } extension MultiVisitor<T extends Element<T>> on Iterable<Element<T>> { + /// Accepts all lazily. Remember to call `.toList()` or similar methods! Iterable<R> accept<R>(Visitor<T, R> v) { return map((e) => e.accept(v)); } } extension MultiTypeVisitor<T extends ReferredType> on Iterable<T> { + /// Accepts all lazily. Remember to call `.toList()` or similar methods! Iterable<R> accept<R>(TypeVisitor<R> v) { return map((e) => e.accept(v)); } } extension MultiTypeUsageVisitor on Iterable<TypeUsage> { + /// Accepts all lazily. Remember to call `.toList()` or similar methods! Iterable<R> accept<R>(TypeVisitor<R> v) { return map((e) => e.type.accept(v)); }
diff --git a/pkgs/jnigen/lib/src/elements/elements.dart b/pkgs/jnigen/lib/src/elements/elements.dart index 7347665..4c3ce2a 100644 --- a/pkgs/jnigen/lib/src/elements/elements.dart +++ b/pkgs/jnigen/lib/src/elements/elements.dart
@@ -97,15 +97,21 @@ String get internalName => binaryName.replaceAll(".", "/"); + /// The number of super classes this type has. + /// + /// Populated by [Linker]. + @JsonKey(includeFromJson: false) + late final int superCount; + /// Parent's [ClassDecl] obtained from [parentName]. /// - /// Will be populated by [Linker]. + /// Populated by [Linker]. @JsonKey(includeFromJson: false) late final ClassDecl? parent; /// Final name of this class. /// - /// Will be populated by [Renamer]. + /// Populated by [Renamer]. @JsonKey(includeFromJson: false) late final String finalName; @@ -114,13 +120,13 @@ /// This is used by C bindings instead of fully qualified name to reduce /// the verbosity of generated bindings. /// - /// Will be populated by [Renamer]. + /// Populated by [Renamer]. @JsonKey(includeFromJson: false) late final String uniqueName; /// Type parameters including the ones from its ancestors /// - /// Will be populated by [Linker]. + /// Populated by [Linker]. @JsonKey(includeFromJson: false) List<TypeParam> allTypeParams = const []; @@ -135,14 +141,18 @@ binaryName: 'java.lang.Object', packageName: 'java.lang', simpleName: 'Object', - )..finalName = 'JObject'; + ) + ..finalName = 'JObject' + ..superCount = 0; static final string = ClassDecl( superclass: TypeUsage.object, binaryName: 'java.lang.String', packageName: 'java.lang', simpleName: 'String', - )..finalName = 'JString'; + ) + ..finalName = 'JString' + ..superCount = 1; static final predefined = { 'java.lang.Object': object, @@ -202,7 +212,7 @@ @JsonKey(name: "type") final Map<String, dynamic> typeJson; - /// Will be populated in [TypeUsage.fromJson]. + /// Populated by in [TypeUsage.fromJson]. @JsonKey(includeFromJson: false) late final ReferredType type; @@ -462,12 +472,12 @@ /// The [ClassDecl] where this method is defined. /// - /// Will be populated by [Linker]. + /// Populated by [Linker]. @JsonKey(includeFromJson: false) @override late ClassDecl classDecl; - /// Will be populated by [Renamer]. + /// Populated by [Renamer]. @JsonKey(includeFromJson: false) late String finalName; @@ -513,7 +523,7 @@ final String name; final TypeUsage type; - /// Will be populated by [Renamer]. + /// Populated by [Renamer]. @JsonKey(includeFromJson: false) late String finalName; @@ -548,12 +558,12 @@ /// The [ClassDecl] where this field is defined. /// - /// Will be populated by [Linker]. + /// Populated by [Linker]. @JsonKey(includeFromJson: false) @override late final ClassDecl classDecl; - /// Will be populated by [Renamer]. + /// Populated by [Renamer]. @JsonKey(includeFromJson: false) late final String finalName;
diff --git a/pkgs/jnigen/pubspec.yaml b/pkgs/jnigen/pubspec.yaml index 2a3c731..48092a8 100644 --- a/pkgs/jnigen/pubspec.yaml +++ b/pkgs/jnigen/pubspec.yaml
@@ -3,7 +3,7 @@ # BSD-style license that can be found in the LICENSE file. name: jnigen -version: 0.3.0 +version: 0.4.0-dev description: Experimental generator for FFI+JNI bindings. repository: https://github.com/dart-lang/jnigen/tree/main/jnigen @@ -17,12 +17,13 @@ args: ^2.3.0 yaml: ^3.1.0 logging: ^1.0.2 + meta: ^1.8.0 cli_config: ^0.1.0 dev_dependencies: lints: ^2.0.0 jni: path: ../jni - test: ^1.17.5 + test: ^1.24.1 build_runner: ^2.2.0 json_serializable: ^6.6.0
diff --git a/pkgs/jnigen/test/bindings_test.dart b/pkgs/jnigen/test/bindings_test.dart index 3c1cd9f..107c24d 100644 --- a/pkgs/jnigen/test/bindings_test.dart +++ b/pkgs/jnigen/test/bindings_test.dart
@@ -50,6 +50,7 @@ join(group, 'generics', 'StringStack.java'), join(group, 'generics', 'StringValuedMap.java'), join(group, 'generics', 'StringKeyedMap.java'), + join(group, 'generics', 'StringMap.java'), join(group, 'annotations', 'JsonSerializable.java'), join(group, 'annotations', 'MyDataClass.java'), join(group, 'pkg2', 'C2.java'), @@ -185,9 +186,18 @@ expect(() => Example.throwException(), throwsException); }); group('generics', () { + test('GrandParent constructor', () { + using((arena) { + final grandParent = GrandParent('Hello'.toJString()..deletedIn(arena)) + ..deletedIn(arena); + expect(grandParent, isA<GrandParent<JString>>()); + expect(grandParent.$type, isA<$GrandParentType<JString>>()); + expect(grandParent.value.toDartString(deleteOriginal: true), 'Hello'); + }); + }); test('MyStack<T>', () { using((arena) { - final stack = MyStack(JString.type)..deletedIn(arena); + final stack = MyStack(T: JString.type)..deletedIn(arena); stack.push('Hello'.toJString()..deletedIn(arena)); stack.push('World'.toJString()..deletedIn(arena)); expect(stack.pop().toDartString(deleteOriginal: true), 'World'); @@ -196,7 +206,7 @@ }); test('MyMap<K, V>', () { using((arena) { - final map = MyMap(JString.type, Example.type)..deletedIn(arena); + final map = MyMap(K: JString.type, V: Example.type)..deletedIn(arena); final helloExample = Example.ctor1(1)..deletedIn(arena); final worldExample = Example.ctor1(2)..deletedIn(arena); map.put('Hello'.toJString()..deletedIn(arena), helloExample); @@ -230,7 +240,7 @@ }); test('StringKeyedMap', () { using((arena) { - final map = StringKeyedMap(Example.type)..deletedIn(arena); + final map = StringKeyedMap(V: Example.type)..deletedIn(arena); final example = Example()..deletedIn(arena); map.put('Hello'.toJString()..deletedIn(arena), example); expect( @@ -242,7 +252,7 @@ }); test('StringValuedMap', () { using((arena) { - final map = StringValuedMap(Example.type)..deletedIn(arena); + final map = StringValuedMap(K: Example.type)..deletedIn(arena); final example = Example()..deletedIn(arena); map.put(example, 'Hello'.toJString()..deletedIn(arena)); expect( @@ -251,11 +261,31 @@ ); }); }); + test('StringMap', () { + using((arena) { + final map = StringMap()..deletedIn(arena); + map.put('hello'.toJString()..deletedIn(arena), + 'world'.toJString()..deletedIn(arena)); + expect( + map + .get0('hello'.toJString()..deletedIn(arena)) + .toDartString(deleteOriginal: true), + 'world', + ); + }); + }); + }); + test('superclass count', () { + expect(JObject.type.superCount, 0); + expect(MyMap.type(JObject.type, JObject.type).superCount, 1); + expect(StringKeyedMap.type(JObject.type).superCount, 2); + expect(StringValuedMap.type(JObject.type).superCount, 2); + expect(StringMap.type.superCount, 3); }); test('nested generics', () { using((arena) { final grandParent = - GrandParent(JString.type, "!".toJString()..deletedIn(arena)) + GrandParent(T: JString.type, "!".toJString()..deletedIn(arena)) ..deletedIn(arena); expect( grandParent.value.toDartString(deleteOriginal: true), @@ -270,7 +300,7 @@ ); final exampleStaticParent = GrandParent.varStaticParent( - Example.type, Example()..deletedIn(arena)) + S: Example.type, Example()..deletedIn(arena)) ..deletedIn(arena); expect( (exampleStaticParent.value..deletedIn(arena)).getInternal(), @@ -290,7 +320,7 @@ ); final exampleParent = grandParent.varParent( - Example.type, Example()..deletedIn(arena)) + S: Example.type, Example()..deletedIn(arena)) ..deletedIn(arena); expect( exampleParent.parentValue @@ -307,6 +337,99 @@ }); }); }); + group('Generic type inference', () { + test('MyStack.of1', () { + using((arena) { + final emptyStack = MyStack(T: JString.type)..deletedIn(arena); + expect(emptyStack.size(), 0); + final stack = MyStack.of1( + "Hello".toJString()..deletedIn(arena), + )..deletedIn(arena); + expect(stack, isA<MyStack<JString>>()); + expect(stack.$type, isA<$MyStackType<JString>>()); + expect( + stack.pop().toDartString(deleteOriginal: true), + "Hello", + ); + }); + }); + test('MyStack.of 2 strings', () { + using((arena) { + final stack = MyStack.of2( + "Hello".toJString()..deletedIn(arena), + "World".toJString()..deletedIn(arena), + )..deletedIn(arena); + expect(stack, isA<MyStack<JString>>()); + expect(stack.$type, isA<$MyStackType<JString>>()); + expect( + stack.pop().toDartString(deleteOriginal: true), + "World", + ); + expect( + stack.pop().toDartString(deleteOriginal: true), + "Hello", + ); + }); + }); + test('MyStack.of a string and an array', () { + using((arena) { + final array = JArray.filled(1, "World".toJString()..deletedIn(arena)) + ..deletedIn(arena); + final stack = MyStack.of2( + "Hello".toJString()..deletedIn(arena), + array, + )..deletedIn(arena); + expect(stack, isA<MyStack<JObject>>()); + expect(stack.$type, isA<$MyStackType<JObject>>()); + expect( + stack + .pop() + .castTo(JArray.type(JString.type), deleteOriginal: true)[0] + .toDartString(deleteOriginal: true), + "World", + ); + expect( + stack + .pop() + .castTo(JString.type, deleteOriginal: true) + .toDartString(deleteOriginal: true), + "Hello", + ); + }); + }); + test('MyStack.from array of string', () { + using((arena) { + final array = JArray.filled(1, "Hello".toJString()..deletedIn(arena)) + ..deletedIn(arena); + final stack = MyStack.fromArray(array)..deletedIn(arena); + expect(stack, isA<MyStack<JString>>()); + expect(stack.$type, isA<$MyStackType<JString>>()); + expect( + stack.pop().toDartString(deleteOriginal: true), + "Hello", + ); + }); + }); + test('MyStack.fromArrayOfArrayOfGrandParents', () { + using((arena) { + final firstDimention = JArray.filled( + 1, + GrandParent("Hello".toJString()..deletedIn(arena))..deletedIn(arena), + )..deletedIn(arena); + final twoDimentionalArray = JArray.filled(1, firstDimention) + ..deletedIn(arena); + final stack = + MyStack.fromArrayOfArrayOfGrandParents(twoDimentionalArray) + ..deletedIn(arena); + expect(stack, isA<MyStack<JString>>()); + expect(stack.$type, isA<$MyStackType<JString>>()); + expect( + stack.pop().toDartString(deleteOriginal: true), + "Hello", + ); + }); + }); + }); group('Kotlin support', () { test('Suspend functions', () async { await using((arena) async {
diff --git a/pkgs/jnigen/test/dart_generator_test.dart b/pkgs/jnigen/test/dart_generator_test.dart new file mode 100644 index 0000000..4ad2eb8 --- /dev/null +++ b/pkgs/jnigen/test/dart_generator_test.dart
@@ -0,0 +1,17 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. 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:jnigen/src/bindings/dart_generator.dart'; +import 'package:test/test.dart'; + +void main() { + test('OutsideInBuffer', () { + final buffer = OutsideInBuffer(); + buffer.appendLeft('f('); + buffer.prependRight('x)'); + buffer.appendLeft('g('); + buffer.prependRight('y) + '); + expect(buffer.toString(), 'f(g(y) + x)'); + }); +}
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart index 7ce9e77..2ceb324 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart
@@ -59,9 +59,8 @@ /// instances. ///@author Tatu Saloranta class JsonFactory extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonFactory.fromRef( jni.JObjectPtr ref, @@ -155,18 +154,22 @@ /// processing objects (such as symbol tables parsers use) /// and this reuse only works within context of a single /// factory instance. - JsonFactory() - : super.fromRef( - jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + factory JsonFactory() { + return JsonFactory.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } static final _id_ctor1 = jniAccessors.getMethodIDOf( _classRef, r"<init>", r"(Lcom/fasterxml/jackson/core/ObjectCodec;)V"); /// from: public void <init>(com.fasterxml.jackson.core.ObjectCodec oc) /// The returned object must be deleted after use, by calling the `delete` method. - JsonFactory.ctor1(jni.JObject oc) - : super.fromRef(jniAccessors - .newObjectWithArgs(_classRef, _id_ctor1, [oc.reference]).object); + factory JsonFactory.ctor1( + jni.JObject oc, + ) { + return JsonFactory.fromRef(jniAccessors + .newObjectWithArgs(_classRef, _id_ctor1, [oc.reference]).object); + } static final _id_ctor2 = jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(Lcom/fasterxml/jackson/core/JsonFactory;Lcom/fasterxml/jackson/core/ObjectCodec;)V"); @@ -178,9 +181,13 @@ ///@param src Original factory to copy settings from ///@param codec Databinding-level codec to use, if any ///@since 2.2.1 - JsonFactory.ctor2(JsonFactory src, jni.JObject codec) - : super.fromRef(jniAccessors.newObjectWithArgs( - _classRef, _id_ctor2, [src.reference, codec.reference]).object); + factory JsonFactory.ctor2( + JsonFactory src, + jni.JObject codec, + ) { + return JsonFactory.fromRef(jniAccessors.newObjectWithArgs( + _classRef, _id_ctor2, [src.reference, codec.reference]).object); + } static final _id_ctor3 = jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(Lcom/fasterxml/jackson/core/JsonFactoryBuilder;)V"); @@ -191,9 +198,12 @@ /// Constructor used by JsonFactoryBuilder for instantiation. ///@param b Builder that contains settings to use ///@since 2.10 - JsonFactory.ctor3(jni.JObject b) - : super.fromRef(jniAccessors - .newObjectWithArgs(_classRef, _id_ctor3, [b.reference]).object); + factory JsonFactory.ctor3( + jni.JObject b, + ) { + return JsonFactory.fromRef(jniAccessors + .newObjectWithArgs(_classRef, _id_ctor3, [b.reference]).object); + } static final _id_ctor4 = jniAccessors.getMethodIDOf( _classRef, r"<init>", r"(Lcom/fasterxml/jackson/core/TSFBuilder;Z)V"); @@ -206,9 +216,13 @@ /// implementation for json. ///@param b Builder that contains settings to use ///@param bogus Argument only needed to separate constructor signature; ignored - JsonFactory.ctor4(jni.JObject b, bool bogus) - : super.fromRef(jniAccessors.newObjectWithArgs( - _classRef, _id_ctor4, [b.reference, bogus ? 1 : 0]).object); + factory JsonFactory.ctor4( + jni.JObject b, + bool bogus, + ) { + return JsonFactory.fromRef(jniAccessors.newObjectWithArgs( + _classRef, _id_ctor4, [b.reference, bogus ? 1 : 0]).object); + } static final _id_rebuild = jniAccessors.getMethodIDOf( _classRef, r"rebuild", r"()Lcom/fasterxml/jackson/core/TSFBuilder;"); @@ -220,9 +234,10 @@ /// with settings of this factory. ///@return Builder instance to use ///@since 2.10 - jni.JObject rebuild() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_rebuild, jni.JniCallType.objectType, []).object); + jni.JObject rebuild() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_rebuild, jni.JniCallType.objectType, []).object); + } static final _id_builder = jniAccessors.getStaticMethodIDOf( _classRef, r"builder", r"()Lcom/fasterxml/jackson/core/TSFBuilder;"); @@ -238,9 +253,11 @@ /// NOTE: signature unfortunately does not expose true implementation type; this /// will be fixed in 3.0. ///@return Builder instance to use - static jni.JObject builder() => - const jni.JObjectType().fromRef(jniAccessors.callStaticMethodWithArgs( - _classRef, _id_builder, jni.JniCallType.objectType, []).object); + static jni.JObject builder() { + return const jni.JObjectType().fromRef(jniAccessors + .callStaticMethodWithArgs( + _classRef, _id_builder, jni.JniCallType.objectType, []).object); + } static final _id_copy = jniAccessors.getMethodIDOf( _classRef, r"copy", r"()Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -260,9 +277,10 @@ /// set codec after making the copy. ///@return Copy of this factory instance ///@since 2.1 - JsonFactory copy() => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_copy, jni.JniCallType.objectType, []).object); + JsonFactory copy() { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_copy, jni.JniCallType.objectType, []).object); + } static final _id_readResolve = jniAccessors.getMethodIDOf( _classRef, r"readResolve", r"()Ljava/lang/Object;"); @@ -276,9 +294,10 @@ /// /// Note: must be overridden by sub-classes as well. ///@return Newly constructed instance - jni.JObject readResolve() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_readResolve, jni.JniCallType.objectType, []).object); + jni.JObject readResolve() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_readResolve, jni.JniCallType.objectType, []).object); + } static final _id_requiresPropertyOrdering = jniAccessors.getMethodIDOf( _classRef, r"requiresPropertyOrdering", r"()Z"); @@ -299,8 +318,10 @@ ///@return Whether format supported by this factory /// requires Object properties to be ordered. ///@since 2.3 - bool requiresPropertyOrdering() => jniAccessors.callMethodWithArgs(reference, - _id_requiresPropertyOrdering, jni.JniCallType.booleanType, []).boolean; + bool requiresPropertyOrdering() { + return jniAccessors.callMethodWithArgs(reference, + _id_requiresPropertyOrdering, jni.JniCallType.booleanType, []).boolean; + } static final _id_canHandleBinaryNatively = jniAccessors.getMethodIDOf(_classRef, r"canHandleBinaryNatively", r"()Z"); @@ -318,8 +339,10 @@ ///@return Whether format supported by this factory /// supports native binary content ///@since 2.3 - bool canHandleBinaryNatively() => jniAccessors.callMethodWithArgs(reference, - _id_canHandleBinaryNatively, jni.JniCallType.booleanType, []).boolean; + bool canHandleBinaryNatively() { + return jniAccessors.callMethodWithArgs(reference, + _id_canHandleBinaryNatively, jni.JniCallType.booleanType, []).boolean; + } static final _id_canUseCharArrays = jniAccessors.getMethodIDOf(_classRef, r"canUseCharArrays", r"()Z"); @@ -337,8 +360,10 @@ ///@return Whether access to decoded textual content can be efficiently /// accessed using parser method {@code getTextCharacters()}. ///@since 2.4 - bool canUseCharArrays() => jniAccessors.callMethodWithArgs( - reference, _id_canUseCharArrays, jni.JniCallType.booleanType, []).boolean; + bool canUseCharArrays() { + return jniAccessors.callMethodWithArgs(reference, _id_canUseCharArrays, + jni.JniCallType.booleanType, []).boolean; + } static final _id_canParseAsync = jniAccessors.getMethodIDOf(_classRef, r"canParseAsync", r"()Z"); @@ -352,28 +377,34 @@ ///@return Whether this factory supports non-blocking ("async") parsing or /// not (and consequently whether {@code createNonBlockingXxx()} method(s) work) ///@since 2.9 - bool canParseAsync() => jniAccessors.callMethodWithArgs( - reference, _id_canParseAsync, jni.JniCallType.booleanType, []).boolean; + bool canParseAsync() { + return jniAccessors.callMethodWithArgs( + reference, _id_canParseAsync, jni.JniCallType.booleanType, []).boolean; + } static final _id_getFormatReadFeatureType = jniAccessors.getMethodIDOf( _classRef, r"getFormatReadFeatureType", r"()Ljava/lang/Class;"); /// from: public java.lang.Class<? extends com.fasterxml.jackson.core.FormatFeature> getFormatReadFeatureType() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject getFormatReadFeatureType() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getFormatReadFeatureType, jni.JniCallType.objectType, []).object); + jni.JObject getFormatReadFeatureType() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getFormatReadFeatureType, + jni.JniCallType.objectType, []).object); + } static final _id_getFormatWriteFeatureType = jniAccessors.getMethodIDOf( _classRef, r"getFormatWriteFeatureType", r"()Ljava/lang/Class;"); /// from: public java.lang.Class<? extends com.fasterxml.jackson.core.FormatFeature> getFormatWriteFeatureType() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject getFormatWriteFeatureType() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_getFormatWriteFeatureType, - jni.JniCallType.objectType, []).object); + jni.JObject getFormatWriteFeatureType() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getFormatWriteFeatureType, + jni.JniCallType.objectType, []).object); + } static final _id_canUseSchema = jniAccessors.getMethodIDOf(_classRef, r"canUseSchema", r"(Lcom/fasterxml/jackson/core/FormatSchema;)Z"); @@ -389,11 +420,12 @@ ///@param schema Schema instance to check ///@return Whether parsers and generators constructed by this factory /// can use specified format schema instance - bool canUseSchema(jni.JObject schema) => jniAccessors.callMethodWithArgs( - reference, - _id_canUseSchema, - jni.JniCallType.booleanType, - [schema.reference]).boolean; + bool canUseSchema( + jni.JObject schema, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_canUseSchema, + jni.JniCallType.booleanType, [schema.reference]).boolean; + } static final _id_getFormatName = jniAccessors.getMethodIDOf( _classRef, r"getFormatName", r"()Ljava/lang/String;"); @@ -407,9 +439,10 @@ /// Note: sub-classes should override this method; default /// implementation will return null for all sub-classes ///@return Name of the format handled by parsers, generators this factory creates - jni.JString getFormatName() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getFormatName, jni.JniCallType.objectType, []).object); + jni.JString getFormatName() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getFormatName, jni.JniCallType.objectType, []).object); + } static final _id_hasFormat = jniAccessors.getMethodIDOf( _classRef, @@ -418,9 +451,15 @@ /// from: public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject hasFormat(jni.JObject acc) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_hasFormat, jni.JniCallType.objectType, [acc.reference]).object); + jni.JObject hasFormat( + jni.JObject acc, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_hasFormat, + jni.JniCallType.objectType, + [acc.reference]).object); + } static final _id_requiresCustomCodec = jniAccessors.getMethodIDOf(_classRef, r"requiresCustomCodec", r"()Z"); @@ -436,8 +475,10 @@ /// generators created by this factory; false if a general /// ObjectCodec is enough ///@since 2.1 - bool requiresCustomCodec() => jniAccessors.callMethodWithArgs(reference, - _id_requiresCustomCodec, jni.JniCallType.booleanType, []).boolean; + bool requiresCustomCodec() { + return jniAccessors.callMethodWithArgs(reference, _id_requiresCustomCodec, + jni.JniCallType.booleanType, []).boolean; + } static final _id_hasJSONFormat = jniAccessors.getMethodIDOf( _classRef, @@ -446,21 +487,25 @@ /// from: protected com.fasterxml.jackson.core.format.MatchStrength hasJSONFormat(com.fasterxml.jackson.core.format.InputAccessor acc) /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject hasJSONFormat(jni.JObject acc) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_hasJSONFormat, - jni.JniCallType.objectType, - [acc.reference]).object); + jni.JObject hasJSONFormat( + jni.JObject acc, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_hasJSONFormat, + jni.JniCallType.objectType, + [acc.reference]).object); + } static final _id_version = jniAccessors.getMethodIDOf( _classRef, r"version", r"()Lcom/fasterxml/jackson/core/Version;"); /// from: public com.fasterxml.jackson.core.Version version() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject version() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_version, jni.JniCallType.objectType, []).object); + jni.JObject version() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_version, jni.JniCallType.objectType, []).object); + } static final _id_configure = jniAccessors.getMethodIDOf( _classRef, @@ -476,12 +521,16 @@ ///@param state Whether to enable or disable the feature ///@return This factory instance (to allow call chaining) ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory configure(JsonFactory_Feature f, bool state) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_configure, - jni.JniCallType.objectType, - [f.reference, state ? 1 : 0]).object); + JsonFactory configure( + JsonFactory_Feature f, + bool state, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_configure, + jni.JniCallType.objectType, + [f.reference, state ? 1 : 0]).object); + } static final _id_enable = jniAccessors.getMethodIDOf(_classRef, r"enable", r"(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -494,12 +543,15 @@ ///@param f Feature to enable ///@return This factory instance (to allow call chaining) ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory enable(JsonFactory_Feature f) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_enable, - jni.JniCallType.objectType, - [f.reference]).object); + JsonFactory enable( + JsonFactory_Feature f, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_enable, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_disable = jniAccessors.getMethodIDOf(_classRef, r"disable", r"(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -512,12 +564,15 @@ ///@param f Feature to disable ///@return This factory instance (to allow call chaining) ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory disable(JsonFactory_Feature f) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_disable, - jni.JniCallType.objectType, - [f.reference]).object); + JsonFactory disable( + JsonFactory_Feature f, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_disable, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_isEnabled = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Z"); @@ -527,39 +582,48 @@ /// Checked whether specified parser feature is enabled. ///@param f Feature to check ///@return True if the specified feature is enabled - bool isEnabled(JsonFactory_Feature f) => jniAccessors.callMethodWithArgs( - reference, - _id_isEnabled, - jni.JniCallType.booleanType, - [f.reference]).boolean; + bool isEnabled( + JsonFactory_Feature f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_getParserFeatures = jniAccessors.getMethodIDOf(_classRef, r"getParserFeatures", r"()I"); /// from: public final int getParserFeatures() - int getParserFeatures() => jniAccessors.callMethodWithArgs( - reference, _id_getParserFeatures, jni.JniCallType.intType, []).integer; + int getParserFeatures() { + return jniAccessors.callMethodWithArgs( + reference, _id_getParserFeatures, jni.JniCallType.intType, []).integer; + } static final _id_getGeneratorFeatures = jniAccessors.getMethodIDOf(_classRef, r"getGeneratorFeatures", r"()I"); /// from: public final int getGeneratorFeatures() - int getGeneratorFeatures() => jniAccessors.callMethodWithArgs( - reference, _id_getGeneratorFeatures, jni.JniCallType.intType, []).integer; + int getGeneratorFeatures() { + return jniAccessors.callMethodWithArgs(reference, _id_getGeneratorFeatures, + jni.JniCallType.intType, []).integer; + } static final _id_getFormatParserFeatures = jniAccessors.getMethodIDOf(_classRef, r"getFormatParserFeatures", r"()I"); /// from: public int getFormatParserFeatures() - int getFormatParserFeatures() => jniAccessors.callMethodWithArgs(reference, - _id_getFormatParserFeatures, jni.JniCallType.intType, []).integer; + int getFormatParserFeatures() { + return jniAccessors.callMethodWithArgs(reference, + _id_getFormatParserFeatures, jni.JniCallType.intType, []).integer; + } static final _id_getFormatGeneratorFeatures = jniAccessors.getMethodIDOf( _classRef, r"getFormatGeneratorFeatures", r"()I"); /// from: public int getFormatGeneratorFeatures() - int getFormatGeneratorFeatures() => jniAccessors.callMethodWithArgs(reference, - _id_getFormatGeneratorFeatures, jni.JniCallType.intType, []).integer; + int getFormatGeneratorFeatures() { + return jniAccessors.callMethodWithArgs(reference, + _id_getFormatGeneratorFeatures, jni.JniCallType.intType, []).integer; + } static final _id_configure1 = jniAccessors.getMethodIDOf( _classRef, @@ -574,12 +638,16 @@ ///@param f Feature to enable/disable ///@param state Whether to enable or disable the feature ///@return This factory instance (to allow call chaining) - JsonFactory configure1(jsonparser_.JsonParser_Feature f, bool state) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_configure1, - jni.JniCallType.objectType, - [f.reference, state ? 1 : 0]).object); + JsonFactory configure1( + jsonparser_.JsonParser_Feature f, + bool state, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_configure1, + jni.JniCallType.objectType, + [f.reference, state ? 1 : 0]).object); + } static final _id_enable1 = jniAccessors.getMethodIDOf(_classRef, r"enable", r"(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -591,12 +659,15 @@ /// (check JsonParser.Feature for list of features) ///@param f Feature to enable ///@return This factory instance (to allow call chaining) - JsonFactory enable1(jsonparser_.JsonParser_Feature f) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_enable1, - jni.JniCallType.objectType, - [f.reference]).object); + JsonFactory enable1( + jsonparser_.JsonParser_Feature f, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_enable1, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_disable1 = jniAccessors.getMethodIDOf(_classRef, r"disable", r"(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -608,12 +679,15 @@ /// (check JsonParser.Feature for list of features) ///@param f Feature to disable ///@return This factory instance (to allow call chaining) - JsonFactory disable1(jsonparser_.JsonParser_Feature f) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_disable1, - jni.JniCallType.objectType, - [f.reference]).object); + JsonFactory disable1( + jsonparser_.JsonParser_Feature f, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_disable1, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_isEnabled1 = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Z"); @@ -623,9 +697,12 @@ /// Method for checking if the specified parser feature is enabled. ///@param f Feature to check ///@return True if specified feature is enabled - bool isEnabled1(jsonparser_.JsonParser_Feature f) => - jniAccessors.callMethodWithArgs(reference, _id_isEnabled1, - jni.JniCallType.booleanType, [f.reference]).boolean; + bool isEnabled1( + jsonparser_.JsonParser_Feature f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled1, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_isEnabled2 = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/StreamReadFeature;)Z"); @@ -636,8 +713,12 @@ ///@param f Feature to check ///@return True if specified feature is enabled ///@since 2.10 - bool isEnabled2(jni.JObject f) => jniAccessors.callMethodWithArgs(reference, - _id_isEnabled2, jni.JniCallType.booleanType, [f.reference]).boolean; + bool isEnabled2( + jni.JObject f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled2, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_getInputDecorator = jniAccessors.getMethodIDOf( _classRef, @@ -650,9 +731,12 @@ /// Method for getting currently configured input decorator (if any; /// there is no default decorator). ///@return InputDecorator configured, if any - jni.JObject getInputDecorator() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getInputDecorator, jni.JniCallType.objectType, []).object); + jni.JObject getInputDecorator() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getInputDecorator, + jni.JniCallType.objectType, []).object); + } static final _id_setInputDecorator = jniAccessors.getMethodIDOf( _classRef, @@ -666,12 +750,15 @@ ///@param d Decorator to configure for this factory, if any ({@code null} if none) ///@return This factory instance (to allow call chaining) ///@deprecated Since 2.10 use JsonFactoryBuilder\#inputDecorator(InputDecorator) instead - JsonFactory setInputDecorator(jni.JObject d) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_setInputDecorator, - jni.JniCallType.objectType, - [d.reference]).object); + JsonFactory setInputDecorator( + jni.JObject d, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_setInputDecorator, + jni.JniCallType.objectType, + [d.reference]).object); + } static final _id_configure2 = jniAccessors.getMethodIDOf( _classRef, @@ -686,12 +773,16 @@ ///@param f Feature to enable/disable ///@param state Whether to enable or disable the feature ///@return This factory instance (to allow call chaining) - JsonFactory configure2(jni.JObject f, bool state) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_configure2, - jni.JniCallType.objectType, - [f.reference, state ? 1 : 0]).object); + JsonFactory configure2( + jni.JObject f, + bool state, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_configure2, + jni.JniCallType.objectType, + [f.reference, state ? 1 : 0]).object); + } static final _id_enable2 = jniAccessors.getMethodIDOf(_classRef, r"enable", r"(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -703,12 +794,15 @@ /// (check JsonGenerator.Feature for list of features) ///@param f Feature to enable ///@return This factory instance (to allow call chaining) - JsonFactory enable2(jni.JObject f) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_enable2, - jni.JniCallType.objectType, - [f.reference]).object); + JsonFactory enable2( + jni.JObject f, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_enable2, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_disable2 = jniAccessors.getMethodIDOf(_classRef, r"disable", r"(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -720,12 +814,15 @@ /// (check JsonGenerator.Feature for list of features) ///@param f Feature to disable ///@return This factory instance (to allow call chaining) - JsonFactory disable2(jni.JObject f) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_disable2, - jni.JniCallType.objectType, - [f.reference]).object); + JsonFactory disable2( + jni.JObject f, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_disable2, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_isEnabled3 = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Z"); @@ -735,8 +832,12 @@ /// Check whether specified generator feature is enabled. ///@param f Feature to check ///@return Whether specified feature is enabled - bool isEnabled3(jni.JObject f) => jniAccessors.callMethodWithArgs(reference, - _id_isEnabled3, jni.JniCallType.booleanType, [f.reference]).boolean; + bool isEnabled3( + jni.JObject f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled3, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_isEnabled4 = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/StreamWriteFeature;)Z"); @@ -747,8 +848,12 @@ ///@param f Feature to check ///@return Whether specified feature is enabled ///@since 2.10 - bool isEnabled4(jni.JObject f) => jniAccessors.callMethodWithArgs(reference, - _id_isEnabled4, jni.JniCallType.booleanType, [f.reference]).boolean; + bool isEnabled4( + jni.JObject f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled4, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_getCharacterEscapes = jniAccessors.getMethodIDOf( _classRef, @@ -761,9 +866,12 @@ /// Method for accessing custom escapes factory uses for JsonGenerators /// it creates. ///@return Configured {@code CharacterEscapes}, if any; {@code null} if none - jni.JObject getCharacterEscapes() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getCharacterEscapes, jni.JniCallType.objectType, []).object); + jni.JObject getCharacterEscapes() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getCharacterEscapes, + jni.JniCallType.objectType, []).object); + } static final _id_setCharacterEscapes = jniAccessors.getMethodIDOf( _classRef, @@ -777,12 +885,15 @@ /// it creates. ///@param esc CharaterEscapes to set (or {@code null} for "none") ///@return This factory instance (to allow call chaining) - JsonFactory setCharacterEscapes(jni.JObject esc) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_setCharacterEscapes, - jni.JniCallType.objectType, - [esc.reference]).object); + JsonFactory setCharacterEscapes( + jni.JObject esc, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_setCharacterEscapes, + jni.JniCallType.objectType, + [esc.reference]).object); + } static final _id_getOutputDecorator = jniAccessors.getMethodIDOf( _classRef, @@ -796,9 +907,12 @@ /// there is no default decorator). ///@return OutputDecorator configured for generators factory creates, if any; /// {@code null} if none. - jni.JObject getOutputDecorator() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getOutputDecorator, jni.JniCallType.objectType, []).object); + jni.JObject getOutputDecorator() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getOutputDecorator, + jni.JniCallType.objectType, []).object); + } static final _id_setOutputDecorator = jniAccessors.getMethodIDOf( _classRef, @@ -812,12 +926,15 @@ ///@return This factory instance (to allow call chaining) ///@param d Output decorator to use, if any ///@deprecated Since 2.10 use JsonFactoryBuilder\#outputDecorator(OutputDecorator) instead - JsonFactory setOutputDecorator(jni.JObject d) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_setOutputDecorator, - jni.JniCallType.objectType, - [d.reference]).object); + JsonFactory setOutputDecorator( + jni.JObject d, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_setOutputDecorator, + jni.JniCallType.objectType, + [d.reference]).object); + } static final _id_setRootValueSeparator = jniAccessors.getMethodIDOf( _classRef, @@ -832,12 +949,15 @@ ///@param sep Separator to use, if any; null means that no separator is /// automatically added ///@return This factory instance (to allow call chaining) - JsonFactory setRootValueSeparator(jni.JString sep) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_setRootValueSeparator, - jni.JniCallType.objectType, - [sep.reference]).object); + JsonFactory setRootValueSeparator( + jni.JString sep, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_setRootValueSeparator, + jni.JniCallType.objectType, + [sep.reference]).object); + } static final _id_getRootValueSeparator = jniAccessors.getMethodIDOf( _classRef, r"getRootValueSeparator", r"()Ljava/lang/String;"); @@ -846,9 +966,12 @@ /// The returned object must be deleted after use, by calling the `delete` method. /// /// @return Root value separator configured, if any - jni.JString getRootValueSeparator() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getRootValueSeparator, jni.JniCallType.objectType, []).object); + jni.JString getRootValueSeparator() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getRootValueSeparator, + jni.JniCallType.objectType, []).object); + } static final _id_setCodec = jniAccessors.getMethodIDOf(_classRef, r"setCodec", r"(Lcom/fasterxml/jackson/core/ObjectCodec;)Lcom/fasterxml/jackson/core/JsonFactory;"); @@ -863,21 +986,25 @@ /// of JsonParser and JsonGenerator instances. ///@param oc Codec to use ///@return This factory instance (to allow call chaining) - JsonFactory setCodec(jni.JObject oc) => - const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_setCodec, - jni.JniCallType.objectType, - [oc.reference]).object); + JsonFactory setCodec( + jni.JObject oc, + ) { + return const $JsonFactoryType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_setCodec, + jni.JniCallType.objectType, + [oc.reference]).object); + } static final _id_getCodec = jniAccessors.getMethodIDOf( _classRef, r"getCodec", r"()Lcom/fasterxml/jackson/core/ObjectCodec;"); /// from: public com.fasterxml.jackson.core.ObjectCodec getCodec() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JObject getCodec() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getCodec, jni.JniCallType.objectType, []).object); + jni.JObject getCodec() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getCodec, jni.JniCallType.objectType, []).object); + } static final _id_createParser = jniAccessors.getMethodIDOf( _classRef, @@ -903,10 +1030,13 @@ /// the parser, since caller has no access to it. ///@param f File that contains JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser(jni.JObject f) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser, - jni.JniCallType.objectType, [f.reference]).object); + jsonparser_.JsonParser createParser( + jni.JObject f, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser, + jni.JniCallType.objectType, [f.reference]).object); + } static final _id_createParser1 = jniAccessors.getMethodIDOf( _classRef, @@ -930,10 +1060,13 @@ /// the parser, since caller has no access to it. ///@param url URL pointing to resource that contains JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser1(jni.JObject url) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser1, - jni.JniCallType.objectType, [url.reference]).object); + jsonparser_.JsonParser createParser1( + jni.JObject url, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser1, + jni.JniCallType.objectType, [url.reference]).object); + } static final _id_createParser2 = jniAccessors.getMethodIDOf( _classRef, @@ -960,10 +1093,13 @@ /// For other charsets use \#createParser(java.io.Reader). ///@param in InputStream to use for reading JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser2(jni.JObject in0) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser2, - jni.JniCallType.objectType, [in0.reference]).object); + jsonparser_.JsonParser createParser2( + jni.JObject in0, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser2, + jni.JniCallType.objectType, [in0.reference]).object); + } static final _id_createParser3 = jniAccessors.getMethodIDOf( _classRef, @@ -983,10 +1119,13 @@ /// is enabled. ///@param r Reader to use for reading JSON content to parse ///@since 2.1 - jsonparser_.JsonParser createParser3(jni.JObject r) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser3, - jni.JniCallType.objectType, [r.reference]).object); + jsonparser_.JsonParser createParser3( + jni.JObject r, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser3, + jni.JniCallType.objectType, [r.reference]).object); + } static final _id_createParser4 = jniAccessors.getMethodIDOf(_classRef, r"createParser", r"([B)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -997,10 +1136,13 @@ /// Method for constructing parser for parsing /// the contents of given byte array. ///@since 2.1 - jsonparser_.JsonParser createParser4(jni.JArray<jni.JByte> data) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser4, - jni.JniCallType.objectType, [data.reference]).object); + jsonparser_.JsonParser createParser4( + jni.JArray<jni.JByte> data, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser4, + jni.JniCallType.objectType, [data.reference]).object); + } static final _id_createParser5 = jniAccessors.getMethodIDOf(_classRef, r"createParser", r"([BII)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -1015,14 +1157,18 @@ ///@param len Length of contents to parse within buffer ///@since 2.1 jsonparser_.JsonParser createParser5( - jni.JArray<jni.JByte> data, int offset, int len) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs( - reference, _id_createParser5, jni.JniCallType.objectType, [ - data.reference, - jni.JValueInt(offset), - jni.JValueInt(len) - ]).object); + jni.JArray<jni.JByte> data, + int offset, + int len, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_createParser5, jni.JniCallType.objectType, [ + data.reference, + jni.JValueInt(offset), + jni.JValueInt(len) + ]).object); + } static final _id_createParser6 = jniAccessors.getMethodIDOf( _classRef, @@ -1035,10 +1181,13 @@ /// Method for constructing parser for parsing /// contents of given String. ///@since 2.1 - jsonparser_.JsonParser createParser6(jni.JString content) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser6, - jni.JniCallType.objectType, [content.reference]).object); + jsonparser_.JsonParser createParser6( + jni.JString content, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser6, + jni.JniCallType.objectType, [content.reference]).object); + } static final _id_createParser7 = jniAccessors.getMethodIDOf(_classRef, r"createParser", r"([C)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -1049,10 +1198,13 @@ /// Method for constructing parser for parsing /// contents of given char array. ///@since 2.4 - jsonparser_.JsonParser createParser7(jni.JArray<jni.JChar> content) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser7, - jni.JniCallType.objectType, [content.reference]).object); + jsonparser_.JsonParser createParser7( + jni.JArray<jni.JChar> content, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser7, + jni.JniCallType.objectType, [content.reference]).object); + } static final _id_createParser8 = jniAccessors.getMethodIDOf(_classRef, r"createParser", r"([CII)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -1063,14 +1215,18 @@ /// Method for constructing parser for parsing contents of given char array. ///@since 2.4 jsonparser_.JsonParser createParser8( - jni.JArray<jni.JChar> content, int offset, int len) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs( - reference, _id_createParser8, jni.JniCallType.objectType, [ - content.reference, - jni.JValueInt(offset), - jni.JValueInt(len) - ]).object); + jni.JArray<jni.JChar> content, + int offset, + int len, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_createParser8, jni.JniCallType.objectType, [ + content.reference, + jni.JValueInt(offset), + jni.JValueInt(len) + ]).object); + } static final _id_createParser9 = jniAccessors.getMethodIDOf( _classRef, @@ -1086,10 +1242,13 @@ /// If this factory does not support DataInput as source, /// will throw UnsupportedOperationException ///@since 2.8 - jsonparser_.JsonParser createParser9(jni.JObject in0) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createParser9, - jni.JniCallType.objectType, [in0.reference]).object); + jsonparser_.JsonParser createParser9( + jni.JObject in0, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createParser9, + jni.JniCallType.objectType, [in0.reference]).object); + } static final _id_createNonBlockingByteArrayParser = jniAccessors.getMethodIDOf(_classRef, r"createNonBlockingByteArrayParser", @@ -1111,10 +1270,11 @@ /// (and US-ASCII since it is proper subset); other encodings are not supported /// at this point. ///@since 2.9 - jsonparser_.JsonParser createNonBlockingByteArrayParser() => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createNonBlockingByteArrayParser, - jni.JniCallType.objectType, []).object); + jsonparser_.JsonParser createNonBlockingByteArrayParser() { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createNonBlockingByteArrayParser, + jni.JniCallType.objectType, []).object); + } static final _id_createGenerator = jniAccessors.getMethodIDOf( _classRef, @@ -1142,12 +1302,16 @@ ///@param out OutputStream to use for writing JSON content ///@param enc Character encoding to use ///@since 2.1 - jni.JObject createGenerator(jni.JObject out, jni.JObject enc) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createGenerator, - jni.JniCallType.objectType, - [out.reference, enc.reference]).object); + jni.JObject createGenerator( + jni.JObject out, + jni.JObject enc, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createGenerator, + jni.JniCallType.objectType, + [out.reference, enc.reference]).object); + } static final _id_createGenerator1 = jniAccessors.getMethodIDOf( _classRef, @@ -1162,12 +1326,15 @@ /// /// Note: there are formats that use fixed encoding (like most binary data formats). ///@since 2.1 - jni.JObject createGenerator1(jni.JObject out) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createGenerator1, - jni.JniCallType.objectType, - [out.reference]).object); + jni.JObject createGenerator1( + jni.JObject out, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createGenerator1, + jni.JniCallType.objectType, + [out.reference]).object); + } static final _id_createGenerator2 = jniAccessors.getMethodIDOf( _classRef, @@ -1188,12 +1355,15 @@ /// Using application needs to close it explicitly. ///@since 2.1 ///@param w Writer to use for writing JSON content - jni.JObject createGenerator2(jni.JObject w) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createGenerator2, - jni.JniCallType.objectType, - [w.reference]).object); + jni.JObject createGenerator2( + jni.JObject w, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createGenerator2, + jni.JniCallType.objectType, + [w.reference]).object); + } static final _id_createGenerator3 = jniAccessors.getMethodIDOf( _classRef, @@ -1215,12 +1385,16 @@ ///@param f File to write contents to ///@param enc Character encoding to use ///@since 2.1 - jni.JObject createGenerator3(jni.JObject f, jni.JObject enc) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createGenerator3, - jni.JniCallType.objectType, - [f.reference, enc.reference]).object); + jni.JObject createGenerator3( + jni.JObject f, + jni.JObject enc, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createGenerator3, + jni.JniCallType.objectType, + [f.reference, enc.reference]).object); + } static final _id_createGenerator4 = jniAccessors.getMethodIDOf( _classRef, @@ -1233,12 +1407,16 @@ /// Method for constructing generator for writing content using specified /// DataOutput instance. ///@since 2.8 - jni.JObject createGenerator4(jni.JObject out, jni.JObject enc) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createGenerator4, - jni.JniCallType.objectType, - [out.reference, enc.reference]).object); + jni.JObject createGenerator4( + jni.JObject out, + jni.JObject enc, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createGenerator4, + jni.JniCallType.objectType, + [out.reference, enc.reference]).object); + } static final _id_createGenerator5 = jniAccessors.getMethodIDOf( _classRef, @@ -1253,12 +1431,15 @@ /// /// Note: there are formats that use fixed encoding (like most binary data formats). ///@since 2.8 - jni.JObject createGenerator5(jni.JObject out) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createGenerator5, - jni.JniCallType.objectType, - [out.reference]).object); + jni.JObject createGenerator5( + jni.JObject out, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createGenerator5, + jni.JniCallType.objectType, + [out.reference]).object); + } static final _id_createJsonParser = jniAccessors.getMethodIDOf( _classRef, @@ -1286,10 +1467,13 @@ ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(File) instead. - jsonparser_.JsonParser createJsonParser(jni.JObject f) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createJsonParser, - jni.JniCallType.objectType, [f.reference]).object); + jsonparser_.JsonParser createJsonParser( + jni.JObject f, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createJsonParser, + jni.JniCallType.objectType, [f.reference]).object); + } static final _id_createJsonParser1 = jniAccessors.getMethodIDOf( _classRef, @@ -1316,10 +1500,13 @@ ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(URL) instead. - jsonparser_.JsonParser createJsonParser1(jni.JObject url) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createJsonParser1, - jni.JniCallType.objectType, [url.reference]).object); + jsonparser_.JsonParser createJsonParser1( + jni.JObject url, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createJsonParser1, + jni.JniCallType.objectType, [url.reference]).object); + } static final _id_createJsonParser2 = jniAccessors.getMethodIDOf( _classRef, @@ -1349,10 +1536,13 @@ ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(InputStream) instead. - jsonparser_.JsonParser createJsonParser2(jni.JObject in0) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createJsonParser2, - jni.JniCallType.objectType, [in0.reference]).object); + jsonparser_.JsonParser createJsonParser2( + jni.JObject in0, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createJsonParser2, + jni.JniCallType.objectType, [in0.reference]).object); + } static final _id_createJsonParser3 = jniAccessors.getMethodIDOf( _classRef, @@ -1375,10 +1565,13 @@ ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(Reader) instead. - jsonparser_.JsonParser createJsonParser3(jni.JObject r) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createJsonParser3, - jni.JniCallType.objectType, [r.reference]).object); + jsonparser_.JsonParser createJsonParser3( + jni.JObject r, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createJsonParser3, + jni.JniCallType.objectType, [r.reference]).object); + } static final _id_createJsonParser4 = jniAccessors.getMethodIDOf(_classRef, r"createJsonParser", r"([B)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -1392,10 +1585,13 @@ ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(byte[]) instead. - jsonparser_.JsonParser createJsonParser4(jni.JArray<jni.JByte> data) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createJsonParser4, - jni.JniCallType.objectType, [data.reference]).object); + jsonparser_.JsonParser createJsonParser4( + jni.JArray<jni.JByte> data, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createJsonParser4, + jni.JniCallType.objectType, [data.reference]).object); + } static final _id_createJsonParser5 = jniAccessors.getMethodIDOf(_classRef, r"createJsonParser", r"([BII)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -1413,14 +1609,18 @@ ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(byte[],int,int) instead. jsonparser_.JsonParser createJsonParser5( - jni.JArray<jni.JByte> data, int offset, int len) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs( - reference, _id_createJsonParser5, jni.JniCallType.objectType, [ - data.reference, - jni.JValueInt(offset), - jni.JValueInt(len) - ]).object); + jni.JArray<jni.JByte> data, + int offset, + int len, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_createJsonParser5, jni.JniCallType.objectType, [ + data.reference, + jni.JValueInt(offset), + jni.JValueInt(len) + ]).object); + } static final _id_createJsonParser6 = jniAccessors.getMethodIDOf( _classRef, @@ -1437,10 +1637,13 @@ ///@throws IOException if parser initialization fails due to I/O (read) problem ///@throws JsonParseException if parser initialization fails due to content decoding problem ///@deprecated Since 2.2, use \#createParser(String) instead. - jsonparser_.JsonParser createJsonParser6(jni.JString content) => - const jsonparser_.$JsonParserType().fromRef(jniAccessors - .callMethodWithArgs(reference, _id_createJsonParser6, - jni.JniCallType.objectType, [content.reference]).object); + jsonparser_.JsonParser createJsonParser6( + jni.JString content, + ) { + return const jsonparser_.$JsonParserType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_createJsonParser6, + jni.JniCallType.objectType, [content.reference]).object); + } static final _id_createJsonGenerator = jniAccessors.getMethodIDOf( _classRef, @@ -1470,12 +1673,16 @@ ///@return Generator constructed ///@throws IOException if parser initialization fails due to I/O (write) problem ///@deprecated Since 2.2, use \#createGenerator(OutputStream, JsonEncoding) instead. - jni.JObject createJsonGenerator(jni.JObject out, jni.JObject enc) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createJsonGenerator, - jni.JniCallType.objectType, - [out.reference, enc.reference]).object); + jni.JObject createJsonGenerator( + jni.JObject out, + jni.JObject enc, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createJsonGenerator, + jni.JniCallType.objectType, + [out.reference, enc.reference]).object); + } static final _id_createJsonGenerator1 = jniAccessors.getMethodIDOf( _classRef, @@ -1498,12 +1705,15 @@ ///@return Generator constructed ///@throws IOException if parser initialization fails due to I/O (write) problem ///@deprecated Since 2.2, use \#createGenerator(Writer) instead. - jni.JObject createJsonGenerator1(jni.JObject out) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createJsonGenerator1, - jni.JniCallType.objectType, - [out.reference]).object); + jni.JObject createJsonGenerator1( + jni.JObject out, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createJsonGenerator1, + jni.JniCallType.objectType, + [out.reference]).object); + } static final _id_createJsonGenerator2 = jniAccessors.getMethodIDOf( _classRef, @@ -1521,12 +1731,15 @@ ///@return Generator constructed ///@throws IOException if parser initialization fails due to I/O (write) problem ///@deprecated Since 2.2, use \#createGenerator(OutputStream) instead. - jni.JObject createJsonGenerator2(jni.JObject out) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_createJsonGenerator2, - jni.JniCallType.objectType, - [out.reference]).object); + jni.JObject createJsonGenerator2( + jni.JObject out, + ) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_createJsonGenerator2, + jni.JniCallType.objectType, + [out.reference]).object); + } } class $JsonFactoryType extends jni.JObjType<JsonFactory> { @@ -1537,6 +1750,20 @@ @override JsonFactory fromRef(jni.JObjectPtr ref) => JsonFactory.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonFactoryType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonFactoryType && other is $JsonFactoryType; + } } /// from: com.fasterxml.jackson.core.JsonFactory$Feature @@ -1544,9 +1771,8 @@ /// Enumeration that defines all on/off features that can only be /// changed for JsonFactory. class JsonFactory_Feature extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonFactory_Feature.fromRef( jni.JObjectPtr ref, @@ -1562,10 +1788,11 @@ /// from: static public com.fasterxml.jackson.core.JsonFactory.Feature[] values() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JArray<JsonFactory_Feature> values() => - const jni.JArrayType($JsonFactory_FeatureType()).fromRef(jniAccessors - .callStaticMethodWithArgs( - _classRef, _id_values, jni.JniCallType.objectType, []).object); + static jni.JArray<JsonFactory_Feature> values() { + return const jni.JArrayType($JsonFactory_FeatureType()).fromRef(jniAccessors + .callStaticMethodWithArgs( + _classRef, _id_values, jni.JniCallType.objectType, []).object); + } static final _id_valueOf = jniAccessors.getStaticMethodIDOf( _classRef, @@ -1574,10 +1801,13 @@ /// from: static public com.fasterxml.jackson.core.JsonFactory.Feature valueOf(java.lang.String name) /// The returned object must be deleted after use, by calling the `delete` method. - static JsonFactory_Feature valueOf(jni.JString name) => - const $JsonFactory_FeatureType().fromRef(jniAccessors - .callStaticMethodWithArgs(_classRef, _id_valueOf, - jni.JniCallType.objectType, [name.reference]).object); + static JsonFactory_Feature valueOf( + jni.JString name, + ) { + return const $JsonFactory_FeatureType().fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_valueOf, + jni.JniCallType.objectType, [name.reference]).object); + } static final _id_collectDefaults = jniAccessors.getStaticMethodIDOf(_classRef, r"collectDefaults", r"()I"); @@ -1587,32 +1817,39 @@ /// Method that calculates bit set (flags) of all features that /// are enabled by default. ///@return Bit field of features enabled by default - static int collectDefaults() => jniAccessors.callStaticMethodWithArgs( - _classRef, _id_collectDefaults, jni.JniCallType.intType, []).integer; + static int collectDefaults() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_collectDefaults, jni.JniCallType.intType, []).integer; + } static final _id_enabledByDefault = jniAccessors.getMethodIDOf(_classRef, r"enabledByDefault", r"()Z"); /// from: public boolean enabledByDefault() - bool enabledByDefault() => jniAccessors.callMethodWithArgs( - reference, _id_enabledByDefault, jni.JniCallType.booleanType, []).boolean; + bool enabledByDefault() { + return jniAccessors.callMethodWithArgs(reference, _id_enabledByDefault, + jni.JniCallType.booleanType, []).boolean; + } static final _id_enabledIn = jniAccessors.getMethodIDOf(_classRef, r"enabledIn", r"(I)Z"); /// from: public boolean enabledIn(int flags) - bool enabledIn(int flags) => jniAccessors.callMethodWithArgs( - reference, - _id_enabledIn, - jni.JniCallType.booleanType, - [jni.JValueInt(flags)]).boolean; + bool enabledIn( + int flags, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_enabledIn, + jni.JniCallType.booleanType, [jni.JValueInt(flags)]).boolean; + } static final _id_getMask = jniAccessors.getMethodIDOf(_classRef, r"getMask", r"()I"); /// from: public int getMask() - int getMask() => jniAccessors.callMethodWithArgs( - reference, _id_getMask, jni.JniCallType.intType, []).integer; + int getMask() { + return jniAccessors.callMethodWithArgs( + reference, _id_getMask, jni.JniCallType.intType, []).integer; + } } class $JsonFactory_FeatureType extends jni.JObjType<JsonFactory_Feature> { @@ -1624,4 +1861,19 @@ @override JsonFactory_Feature fromRef(jni.JObjectPtr ref) => JsonFactory_Feature.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonFactory_FeatureType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonFactory_FeatureType && + other is $JsonFactory_FeatureType; + } }
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart index 1f71c76..e8caa42 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart
@@ -46,9 +46,8 @@ /// a JsonFactory instance. ///@author Tatu Saloranta class JsonParser extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonParser.fromRef( jni.JObjectPtr ref, @@ -83,18 +82,22 @@ /// from: protected void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - JsonParser() - : super.fromRef( - jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + factory JsonParser() { + return JsonParser.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } static final _id_ctor1 = jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(I)V"); /// from: protected void <init>(int features) /// The returned object must be deleted after use, by calling the `delete` method. - JsonParser.ctor1(int features) - : super.fromRef(jniAccessors.newObjectWithArgs( - _classRef, _id_ctor1, [jni.JValueInt(features)]).object); + factory JsonParser.ctor1( + int features, + ) { + return JsonParser.fromRef(jniAccessors.newObjectWithArgs( + _classRef, _id_ctor1, [jni.JValueInt(features)]).object); + } static final _id_getCodec = jniAccessors.getMethodIDOf( _classRef, r"getCodec", r"()Lcom/fasterxml/jackson/core/ObjectCodec;"); @@ -106,9 +109,10 @@ /// parser, if any. Codec is used by \#readValueAs(Class) /// method (and its variants). ///@return Codec assigned to this parser, if any; {@code null} if none - jni.JObject getCodec() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getCodec, jni.JniCallType.objectType, []).object); + jni.JObject getCodec() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getCodec, jni.JniCallType.objectType, []).object); + } static final _id_setCodec = jniAccessors.getMethodIDOf( _classRef, r"setCodec", r"(Lcom/fasterxml/jackson/core/ObjectCodec;)V"); @@ -119,8 +123,12 @@ /// parser, if any. Codec is used by \#readValueAs(Class) /// method (and its variants). ///@param oc Codec to assign, if any; {@code null} if none - void setCodec(jni.JObject oc) => jniAccessors.callMethodWithArgs(reference, - _id_setCodec, jni.JniCallType.voidType, [oc.reference]).check(); + void setCodec( + jni.JObject oc, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setCodec, + jni.JniCallType.voidType, [oc.reference]).check(); + } static final _id_getInputSource = jniAccessors.getMethodIDOf( _classRef, r"getInputSource", r"()Ljava/lang/Object;"); @@ -142,9 +150,10 @@ /// In general use of this accessor should be considered as /// "last effort", i.e. only used if no other mechanism is applicable. ///@return Input source this parser was configured with - jni.JObject getInputSource() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getInputSource, jni.JniCallType.objectType, []).object); + jni.JObject getInputSource() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getInputSource, jni.JniCallType.objectType, []).object); + } static final _id_setRequestPayloadOnError = jniAccessors.getMethodIDOf( _classRef, @@ -156,9 +165,15 @@ /// Sets the payload to be passed if JsonParseException is thrown. ///@param payload Payload to pass ///@since 2.8 - void setRequestPayloadOnError(jni.JObject payload) => - jniAccessors.callMethodWithArgs(reference, _id_setRequestPayloadOnError, - jni.JniCallType.voidType, [payload.reference]).check(); + void setRequestPayloadOnError( + jni.JObject payload, + ) { + return jniAccessors.callMethodWithArgs( + reference, + _id_setRequestPayloadOnError, + jni.JniCallType.voidType, + [payload.reference]).check(); + } static final _id_setRequestPayloadOnError1 = jniAccessors.getMethodIDOf( _classRef, r"setRequestPayloadOnError", r"([BLjava/lang/String;)V"); @@ -170,12 +185,15 @@ ///@param charset Character encoding for (lazily) decoding payload ///@since 2.8 void setRequestPayloadOnError1( - jni.JArray<jni.JByte> payload, jni.JString charset) => - jniAccessors.callMethodWithArgs( - reference, - _id_setRequestPayloadOnError1, - jni.JniCallType.voidType, - [payload.reference, charset.reference]).check(); + jni.JArray<jni.JByte> payload, + jni.JString charset, + ) { + return jniAccessors.callMethodWithArgs( + reference, + _id_setRequestPayloadOnError1, + jni.JniCallType.voidType, + [payload.reference, charset.reference]).check(); + } static final _id_setRequestPayloadOnError2 = jniAccessors.getMethodIDOf( _classRef, r"setRequestPayloadOnError", r"(Ljava/lang/String;)V"); @@ -185,9 +203,15 @@ /// Sets the String request payload ///@param payload Payload to pass ///@since 2.8 - void setRequestPayloadOnError2(jni.JString payload) => - jniAccessors.callMethodWithArgs(reference, _id_setRequestPayloadOnError2, - jni.JniCallType.voidType, [payload.reference]).check(); + void setRequestPayloadOnError2( + jni.JString payload, + ) { + return jniAccessors.callMethodWithArgs( + reference, + _id_setRequestPayloadOnError2, + jni.JniCallType.voidType, + [payload.reference]).check(); + } static final _id_setSchema = jniAccessors.getMethodIDOf( _classRef, r"setSchema", r"(Lcom/fasterxml/jackson/core/FormatSchema;)V"); @@ -204,11 +228,12 @@ /// is thrown. ///@param schema Schema to use ///@throws UnsupportedOperationException if parser does not support schema - void setSchema(jni.JObject schema) => jniAccessors.callMethodWithArgs( - reference, - _id_setSchema, - jni.JniCallType.voidType, - [schema.reference]).check(); + void setSchema( + jni.JObject schema, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setSchema, + jni.JniCallType.voidType, [schema.reference]).check(); + } static final _id_getSchema = jniAccessors.getMethodIDOf( _classRef, r"getSchema", r"()Lcom/fasterxml/jackson/core/FormatSchema;"); @@ -220,9 +245,10 @@ /// Default implementation returns null. ///@return Schema in use by this parser, if any; {@code null} if none ///@since 2.1 - jni.JObject getSchema() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getSchema, jni.JniCallType.objectType, []).object); + jni.JObject getSchema() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getSchema, jni.JniCallType.objectType, []).object); + } static final _id_canUseSchema = jniAccessors.getMethodIDOf(_classRef, r"canUseSchema", r"(Lcom/fasterxml/jackson/core/FormatSchema;)Z"); @@ -233,11 +259,12 @@ /// this parser (using \#setSchema). ///@param schema Schema to check ///@return True if this parser can use given schema; false if not - bool canUseSchema(jni.JObject schema) => jniAccessors.callMethodWithArgs( - reference, - _id_canUseSchema, - jni.JniCallType.booleanType, - [schema.reference]).boolean; + bool canUseSchema( + jni.JObject schema, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_canUseSchema, + jni.JniCallType.booleanType, [schema.reference]).boolean; + } static final _id_requiresCustomCodec = jniAccessors.getMethodIDOf(_classRef, r"requiresCustomCodec", r"()Z"); @@ -252,8 +279,10 @@ ///@return True if format-specific codec is needed with this parser; false if a general /// ObjectCodec is enough ///@since 2.1 - bool requiresCustomCodec() => jniAccessors.callMethodWithArgs(reference, - _id_requiresCustomCodec, jni.JniCallType.booleanType, []).boolean; + bool requiresCustomCodec() { + return jniAccessors.callMethodWithArgs(reference, _id_requiresCustomCodec, + jni.JniCallType.booleanType, []).boolean; + } static final _id_canParseAsync = jniAccessors.getMethodIDOf(_classRef, r"canParseAsync", r"()Z"); @@ -271,8 +300,10 @@ /// input is read by blocking ///@return True if this is a non-blocking ("asynchronous") parser ///@since 2.9 - bool canParseAsync() => jniAccessors.callMethodWithArgs( - reference, _id_canParseAsync, jni.JniCallType.booleanType, []).boolean; + bool canParseAsync() { + return jniAccessors.callMethodWithArgs( + reference, _id_canParseAsync, jni.JniCallType.booleanType, []).boolean; + } static final _id_getNonBlockingInputFeeder = jniAccessors.getMethodIDOf( _classRef, @@ -287,11 +318,12 @@ /// parsers that use blocking I/O. ///@return Input feeder to use with non-blocking (async) parsing ///@since 2.9 - jni.JObject getNonBlockingInputFeeder() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_getNonBlockingInputFeeder, - jni.JniCallType.objectType, []).object); + jni.JObject getNonBlockingInputFeeder() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getNonBlockingInputFeeder, + jni.JniCallType.objectType, []).object); + } static final _id_getReadCapabilities = jniAccessors.getMethodIDOf( _classRef, @@ -305,9 +337,12 @@ /// underlying data format being read (directly or indirectly). ///@return Set of read capabilities for content to read via this parser ///@since 2.12 - jni.JObject getReadCapabilities() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getReadCapabilities, jni.JniCallType.objectType, []).object); + jni.JObject getReadCapabilities() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getReadCapabilities, + jni.JniCallType.objectType, []).object); + } static final _id_version = jniAccessors.getMethodIDOf( _classRef, r"version", r"()Lcom/fasterxml/jackson/core/Version;"); @@ -319,9 +354,10 @@ /// Left for sub-classes to implement. ///@return Version of this generator (derived from version declared for /// {@code jackson-core} jar that contains the class - jni.JObject version() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_version, jni.JniCallType.objectType, []).object); + jni.JObject version() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_version, jni.JniCallType.objectType, []).object); + } static final _id_close = jniAccessors.getMethodIDOf(_classRef, r"close", r"()V"); @@ -342,8 +378,10 @@ /// java.io.File or java.net.URL and creates /// stream or reader it does own them. ///@throws IOException if there is either an underlying I/O problem - void close() => jniAccessors.callMethodWithArgs( - reference, _id_close, jni.JniCallType.voidType, []).check(); + void close() { + return jniAccessors.callMethodWithArgs( + reference, _id_close, jni.JniCallType.voidType, []).check(); + } static final _id_isClosed = jniAccessors.getMethodIDOf(_classRef, r"isClosed", r"()Z"); @@ -357,8 +395,10 @@ /// call to \#close or because parser has encountered /// end of input. ///@return {@code True} if this parser instance has been closed - bool isClosed() => jniAccessors.callMethodWithArgs( - reference, _id_isClosed, jni.JniCallType.booleanType, []).boolean; + bool isClosed() { + return jniAccessors.callMethodWithArgs( + reference, _id_isClosed, jni.JniCallType.booleanType, []).boolean; + } static final _id_getParsingContext = jniAccessors.getMethodIDOf( _classRef, @@ -377,9 +417,12 @@ /// Contexts can also be used for simple xpath-like matching of /// input, if so desired. ///@return Stream input context (JsonStreamContext) associated with this parser - jni.JObject getParsingContext() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getParsingContext, jni.JniCallType.objectType, []).object); + jni.JObject getParsingContext() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getParsingContext, + jni.JniCallType.objectType, []).object); + } static final _id_currentLocation = jniAccessors.getMethodIDOf(_classRef, r"currentLocation", r"()Lcom/fasterxml/jackson/core/JsonLocation;"); @@ -399,9 +442,10 @@ /// to other library) ///@return Location of the last processed input unit (byte or character) ///@since 2.13 - jni.JObject currentLocation() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_currentLocation, jni.JniCallType.objectType, []).object); + jni.JObject currentLocation() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_currentLocation, jni.JniCallType.objectType, []).object); + } static final _id_currentTokenLocation = jniAccessors.getMethodIDOf(_classRef, r"currentTokenLocation", r"()Lcom/fasterxml/jackson/core/JsonLocation;"); @@ -421,9 +465,12 @@ /// to other library) ///@return Starting location of the token parser currently points to ///@since 2.13 (will eventually replace \#getTokenLocation) - jni.JObject currentTokenLocation() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_currentTokenLocation, jni.JniCallType.objectType, []).object); + jni.JObject currentTokenLocation() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_currentTokenLocation, + jni.JniCallType.objectType, []).object); + } static final _id_getCurrentLocation = jniAccessors.getMethodIDOf(_classRef, r"getCurrentLocation", r"()Lcom/fasterxml/jackson/core/JsonLocation;"); @@ -434,9 +481,12 @@ /// Alias for \#currentLocation(), to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@return Location of the last processed input unit (byte or character) - jni.JObject getCurrentLocation() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getCurrentLocation, jni.JniCallType.objectType, []).object); + jni.JObject getCurrentLocation() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getCurrentLocation, + jni.JniCallType.objectType, []).object); + } static final _id_getTokenLocation = jniAccessors.getMethodIDOf(_classRef, r"getTokenLocation", r"()Lcom/fasterxml/jackson/core/JsonLocation;"); @@ -447,9 +497,12 @@ /// Alias for \#currentTokenLocation(), to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@return Starting location of the token parser currently points to - jni.JObject getTokenLocation() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getTokenLocation, jni.JniCallType.objectType, []).object); + jni.JObject getTokenLocation() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getTokenLocation, + jni.JniCallType.objectType, []).object); + } static final _id_currentValue = jniAccessors.getMethodIDOf( _classRef, r"currentValue", r"()Ljava/lang/Object;"); @@ -468,9 +521,10 @@ /// and gets passed through data-binding. ///@return "Current value" associated with the current input context (state) of this parser ///@since 2.13 (added as replacement for older \#getCurrentValue() - jni.JObject currentValue() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_currentValue, jni.JniCallType.objectType, []).object); + jni.JObject currentValue() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_currentValue, jni.JniCallType.objectType, []).object); + } static final _id_assignCurrentValue = jniAccessors.getMethodIDOf( _classRef, r"assignCurrentValue", r"(Ljava/lang/Object;)V"); @@ -483,11 +537,12 @@ ///</code> ///@param v Current value to assign for the current input context of this parser ///@since 2.13 (added as replacement for older \#setCurrentValue - void assignCurrentValue(jni.JObject v) => jniAccessors.callMethodWithArgs( - reference, - _id_assignCurrentValue, - jni.JniCallType.voidType, - [v.reference]).check(); + void assignCurrentValue( + jni.JObject v, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_assignCurrentValue, + jni.JniCallType.voidType, [v.reference]).check(); + } static final _id_getCurrentValue = jniAccessors.getMethodIDOf( _classRef, r"getCurrentValue", r"()Ljava/lang/Object;"); @@ -498,9 +553,10 @@ /// Alias for \#currentValue(), to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@return Location of the last processed input unit (byte or character) - jni.JObject getCurrentValue() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getCurrentValue, jni.JniCallType.objectType, []).object); + jni.JObject getCurrentValue() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getCurrentValue, jni.JniCallType.objectType, []).object); + } static final _id_setCurrentValue = jniAccessors.getMethodIDOf( _classRef, r"setCurrentValue", r"(Ljava/lang/Object;)V"); @@ -510,11 +566,12 @@ /// Alias for \#assignCurrentValue, to be deprecated in later /// Jackson 2.x versions (and removed from Jackson 3.0). ///@param v Current value to assign for the current input context of this parser - void setCurrentValue(jni.JObject v) => jniAccessors.callMethodWithArgs( - reference, - _id_setCurrentValue, - jni.JniCallType.voidType, - [v.reference]).check(); + void setCurrentValue( + jni.JObject v, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setCurrentValue, + jni.JniCallType.voidType, [v.reference]).check(); + } static final _id_releaseBuffered = jniAccessors.getMethodIDOf( _classRef, r"releaseBuffered", r"(Ljava/io/OutputStream;)I"); @@ -532,11 +589,12 @@ /// (that is, input can not be sent to OutputStream; /// otherwise number of bytes released (0 if there was nothing to release) ///@throws IOException if write to stream threw exception - int releaseBuffered(jni.JObject out) => jniAccessors.callMethodWithArgs( - reference, - _id_releaseBuffered, - jni.JniCallType.intType, - [out.reference]).integer; + int releaseBuffered( + jni.JObject out, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_releaseBuffered, + jni.JniCallType.intType, [out.reference]).integer; + } static final _id_releaseBuffered1 = jniAccessors.getMethodIDOf( _classRef, r"releaseBuffered", r"(Ljava/io/Writer;)I"); @@ -555,11 +613,12 @@ /// (that is, input can not be sent to Writer; /// otherwise number of chars released (0 if there was nothing to release) ///@throws IOException if write using Writer threw exception - int releaseBuffered1(jni.JObject w) => jniAccessors.callMethodWithArgs( - reference, - _id_releaseBuffered1, - jni.JniCallType.intType, - [w.reference]).integer; + int releaseBuffered1( + jni.JObject w, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_releaseBuffered1, + jni.JniCallType.intType, [w.reference]).integer; + } static final _id_enable = jniAccessors.getMethodIDOf(_classRef, r"enable", r"(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -571,9 +630,15 @@ /// (check Feature for list of features) ///@param f Feature to enable ///@return This parser, to allow call chaining - JsonParser enable(JsonParser_Feature f) => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_enable, jni.JniCallType.objectType, [f.reference]).object); + JsonParser enable( + JsonParser_Feature f, + ) { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_enable, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_disable = jniAccessors.getMethodIDOf(_classRef, r"disable", r"(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -585,9 +650,15 @@ /// (check Feature for list of features) ///@param f Feature to disable ///@return This parser, to allow call chaining - JsonParser disable(JsonParser_Feature f) => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_disable, jni.JniCallType.objectType, [f.reference]).object); + JsonParser disable( + JsonParser_Feature f, + ) { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_disable, + jni.JniCallType.objectType, + [f.reference]).object); + } static final _id_configure = jniAccessors.getMethodIDOf( _classRef, @@ -602,12 +673,16 @@ ///@param f Feature to enable or disable ///@param state Whether to enable feature ({@code true}) or disable ({@code false}) ///@return This parser, to allow call chaining - JsonParser configure(JsonParser_Feature f, bool state) => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_configure, - jni.JniCallType.objectType, - [f.reference, state ? 1 : 0]).object); + JsonParser configure( + JsonParser_Feature f, + bool state, + ) { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_configure, + jni.JniCallType.objectType, + [f.reference, state ? 1 : 0]).object); + } static final _id_isEnabled = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Z"); @@ -617,11 +692,12 @@ /// Method for checking whether specified Feature is enabled. ///@param f Feature to check ///@return {@code True} if feature is enabled; {@code false} otherwise - bool isEnabled(JsonParser_Feature f) => jniAccessors.callMethodWithArgs( - reference, - _id_isEnabled, - jni.JniCallType.booleanType, - [f.reference]).boolean; + bool isEnabled( + JsonParser_Feature f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_isEnabled1 = jniAccessors.getMethodIDOf(_classRef, r"isEnabled", r"(Lcom/fasterxml/jackson/core/StreamReadFeature;)Z"); @@ -632,8 +708,12 @@ ///@param f Feature to check ///@return {@code True} if feature is enabled; {@code false} otherwise ///@since 2.10 - bool isEnabled1(jni.JObject f) => jniAccessors.callMethodWithArgs(reference, - _id_isEnabled1, jni.JniCallType.booleanType, [f.reference]).boolean; + bool isEnabled1( + jni.JObject f, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_isEnabled1, + jni.JniCallType.booleanType, [f.reference]).boolean; + } static final _id_getFeatureMask = jniAccessors.getMethodIDOf(_classRef, r"getFeatureMask", r"()I"); @@ -643,8 +723,10 @@ /// Bulk access method for getting state of all standard Features. ///@return Bit mask that defines current states of all standard Features. ///@since 2.3 - int getFeatureMask() => jniAccessors.callMethodWithArgs( - reference, _id_getFeatureMask, jni.JniCallType.intType, []).integer; + int getFeatureMask() { + return jniAccessors.callMethodWithArgs( + reference, _id_getFeatureMask, jni.JniCallType.intType, []).integer; + } static final _id_setFeatureMask = jniAccessors.getMethodIDOf(_classRef, r"setFeatureMask", r"(I)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -657,12 +739,15 @@ ///@return This parser, to allow call chaining ///@since 2.3 ///@deprecated Since 2.7, use \#overrideStdFeatures(int, int) instead - JsonParser setFeatureMask(int mask) => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_setFeatureMask, - jni.JniCallType.objectType, - [jni.JValueInt(mask)]).object); + JsonParser setFeatureMask( + int mask, + ) { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_setFeatureMask, + jni.JniCallType.objectType, + [jni.JValueInt(mask)]).object); + } static final _id_overrideStdFeatures = jniAccessors.getMethodIDOf(_classRef, r"overrideStdFeatures", r"(II)Lcom/fasterxml/jackson/core/JsonParser;"); @@ -682,12 +767,16 @@ ///@param mask Bit mask of features to change ///@return This parser, to allow call chaining ///@since 2.6 - JsonParser overrideStdFeatures(int values, int mask) => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_overrideStdFeatures, - jni.JniCallType.objectType, - [jni.JValueInt(values), jni.JValueInt(mask)]).object); + JsonParser overrideStdFeatures( + int values, + int mask, + ) { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_overrideStdFeatures, + jni.JniCallType.objectType, + [jni.JValueInt(values), jni.JValueInt(mask)]).object); + } static final _id_getFormatFeatures = jniAccessors.getMethodIDOf(_classRef, r"getFormatFeatures", r"()I"); @@ -698,8 +787,10 @@ /// on/off configuration settings. ///@return Bit mask that defines current states of all standard FormatFeatures. ///@since 2.6 - int getFormatFeatures() => jniAccessors.callMethodWithArgs( - reference, _id_getFormatFeatures, jni.JniCallType.intType, []).integer; + int getFormatFeatures() { + return jniAccessors.callMethodWithArgs( + reference, _id_getFormatFeatures, jni.JniCallType.intType, []).integer; + } static final _id_overrideFormatFeatures = jniAccessors.getMethodIDOf( _classRef, @@ -719,12 +810,16 @@ ///@param mask Bit mask of features to change ///@return This parser, to allow call chaining ///@since 2.6 - JsonParser overrideFormatFeatures(int values, int mask) => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_overrideFormatFeatures, - jni.JniCallType.objectType, - [jni.JValueInt(values), jni.JValueInt(mask)]).object); + JsonParser overrideFormatFeatures( + int values, + int mask, + ) { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_overrideFormatFeatures, + jni.JniCallType.objectType, + [jni.JValueInt(values), jni.JValueInt(mask)]).object); + } static final _id_nextToken = jniAccessors.getMethodIDOf( _classRef, r"nextToken", r"()Lcom/fasterxml/jackson/core/JsonToken;"); @@ -740,9 +835,11 @@ /// to indicate end-of-input ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jsontoken_.JsonToken nextToken() => - const jsontoken_.$JsonTokenType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_nextToken, jni.JniCallType.objectType, []).object); + jsontoken_.JsonToken nextToken() { + return const jsontoken_.$JsonTokenType().fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_nextToken, jni.JniCallType.objectType, []).object); + } static final _id_nextValue = jniAccessors.getMethodIDOf( _classRef, r"nextValue", r"()Lcom/fasterxml/jackson/core/JsonToken;"); @@ -766,9 +863,11 @@ /// available yet) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jsontoken_.JsonToken nextValue() => - const jsontoken_.$JsonTokenType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_nextValue, jni.JniCallType.objectType, []).object); + jsontoken_.JsonToken nextValue() { + return const jsontoken_.$JsonTokenType().fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_nextValue, jni.JniCallType.objectType, []).object); + } static final _id_nextFieldName = jniAccessors.getMethodIDOf(_classRef, r"nextFieldName", r"(Lcom/fasterxml/jackson/core/SerializableString;)Z"); @@ -790,11 +889,12 @@ /// specified name; {@code false} otherwise (different token or non-matching name) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - bool nextFieldName(jni.JObject str) => jniAccessors.callMethodWithArgs( - reference, - _id_nextFieldName, - jni.JniCallType.booleanType, - [str.reference]).boolean; + bool nextFieldName( + jni.JObject str, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_nextFieldName, + jni.JniCallType.booleanType, [str.reference]).boolean; + } static final _id_nextFieldName1 = jniAccessors.getMethodIDOf( _classRef, r"nextFieldName", r"()Ljava/lang/String;"); @@ -810,9 +910,10 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.5 - jni.JString nextFieldName1() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_nextFieldName1, jni.JniCallType.objectType, []).object); + jni.JString nextFieldName1() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_nextFieldName1, jni.JniCallType.objectType, []).object); + } static final _id_nextTextValue = jniAccessors.getMethodIDOf( _classRef, r"nextTextValue", r"()Ljava/lang/String;"); @@ -833,9 +934,10 @@ /// to; or {@code null} if next token is of some other type ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JString nextTextValue() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_nextTextValue, jni.JniCallType.objectType, []).object); + jni.JString nextTextValue() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_nextTextValue, jni.JniCallType.objectType, []).object); + } static final _id_nextIntValue = jniAccessors.getMethodIDOf(_classRef, r"nextIntValue", r"(I)I"); @@ -859,11 +961,12 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@throws InputCoercionException if integer number does not fit in Java {@code int} - int nextIntValue(int defaultValue) => jniAccessors.callMethodWithArgs( - reference, - _id_nextIntValue, - jni.JniCallType.intType, - [jni.JValueInt(defaultValue)]).integer; + int nextIntValue( + int defaultValue, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_nextIntValue, + jni.JniCallType.intType, [jni.JValueInt(defaultValue)]).integer; + } static final _id_nextLongValue = jniAccessors.getMethodIDOf(_classRef, r"nextLongValue", r"(J)J"); @@ -887,11 +990,12 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@throws InputCoercionException if integer number does not fit in Java {@code long} - int nextLongValue(int defaultValue) => jniAccessors.callMethodWithArgs( - reference, - _id_nextLongValue, - jni.JniCallType.longType, - [defaultValue]).long; + int nextLongValue( + int defaultValue, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_nextLongValue, + jni.JniCallType.longType, [defaultValue]).long; + } static final _id_nextBooleanValue = jniAccessors.getMethodIDOf( _classRef, r"nextBooleanValue", r"()Ljava/lang/Boolean;"); @@ -915,9 +1019,12 @@ /// token parser advanced to; or {@code null} if next token is of some other type ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JObject nextBooleanValue() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_nextBooleanValue, jni.JniCallType.objectType, []).object); + jni.JObject nextBooleanValue() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_nextBooleanValue, + jni.JniCallType.objectType, []).object); + } static final _id_skipChildren = jniAccessors.getMethodIDOf( _classRef, r"skipChildren", r"()Lcom/fasterxml/jackson/core/JsonParser;"); @@ -940,9 +1047,10 @@ ///@return This parser, to allow call chaining ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - JsonParser skipChildren() => - const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_skipChildren, jni.JniCallType.objectType, []).object); + JsonParser skipChildren() { + return const $JsonParserType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_skipChildren, jni.JniCallType.objectType, []).object); + } static final _id_finishToken = jniAccessors.getMethodIDOf(_classRef, r"finishToken", r"()V"); @@ -962,8 +1070,10 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.8 - void finishToken() => jniAccessors.callMethodWithArgs( - reference, _id_finishToken, jni.JniCallType.voidType, []).check(); + void finishToken() { + return jniAccessors.callMethodWithArgs( + reference, _id_finishToken, jni.JniCallType.voidType, []).check(); + } static final _id_currentToken = jniAccessors.getMethodIDOf( _classRef, r"currentToken", r"()Lcom/fasterxml/jackson/core/JsonToken;"); @@ -980,9 +1090,11 @@ /// after end-of-input has been encountered, as well as /// if the current token has been explicitly cleared. ///@since 2.8 - jsontoken_.JsonToken currentToken() => - const jsontoken_.$JsonTokenType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_currentToken, jni.JniCallType.objectType, []).object); + jsontoken_.JsonToken currentToken() { + return const jsontoken_.$JsonTokenType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_currentToken, + jni.JniCallType.objectType, []).object); + } static final _id_currentTokenId = jniAccessors.getMethodIDOf(_classRef, r"currentTokenId", r"()I"); @@ -998,8 +1110,10 @@ /// to profile performance before deciding to use this method. ///@since 2.8 ///@return {@code int} matching one of constants from JsonTokenId. - int currentTokenId() => jniAccessors.callMethodWithArgs( - reference, _id_currentTokenId, jni.JniCallType.intType, []).integer; + int currentTokenId() { + return jniAccessors.callMethodWithArgs( + reference, _id_currentTokenId, jni.JniCallType.intType, []).integer; + } static final _id_getCurrentToken = jniAccessors.getMethodIDOf(_classRef, r"getCurrentToken", r"()Lcom/fasterxml/jackson/core/JsonToken;"); @@ -1011,11 +1125,11 @@ /// Jackson 2.13 (will be removed from 3.0). ///@return Type of the token this parser currently points to, /// if any: null before any tokens have been read, and - jsontoken_.JsonToken getCurrentToken() => - const jsontoken_.$JsonTokenType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_getCurrentToken, - jni.JniCallType.objectType, []).object); + jsontoken_.JsonToken getCurrentToken() { + return const jsontoken_.$JsonTokenType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_getCurrentToken, + jni.JniCallType.objectType, []).object); + } static final _id_getCurrentTokenId = jniAccessors.getMethodIDOf(_classRef, r"getCurrentTokenId", r"()I"); @@ -1025,8 +1139,10 @@ /// Deprecated alias for \#currentTokenId(). ///@return {@code int} matching one of constants from JsonTokenId. ///@deprecated Since 2.12 use \#currentTokenId instead - int getCurrentTokenId() => jniAccessors.callMethodWithArgs( - reference, _id_getCurrentTokenId, jni.JniCallType.intType, []).integer; + int getCurrentTokenId() { + return jniAccessors.callMethodWithArgs( + reference, _id_getCurrentTokenId, jni.JniCallType.intType, []).integer; + } static final _id_hasCurrentToken = jniAccessors.getMethodIDOf(_classRef, r"hasCurrentToken", r"()Z"); @@ -1041,8 +1157,10 @@ /// was just constructed, encountered end-of-input /// and returned null from \#nextToken, or the token /// has been consumed) - bool hasCurrentToken() => jniAccessors.callMethodWithArgs( - reference, _id_hasCurrentToken, jni.JniCallType.booleanType, []).boolean; + bool hasCurrentToken() { + return jniAccessors.callMethodWithArgs(reference, _id_hasCurrentToken, + jni.JniCallType.booleanType, []).boolean; + } static final _id_hasTokenId = jniAccessors.getMethodIDOf(_classRef, r"hasTokenId", r"(I)Z"); @@ -1061,8 +1179,12 @@ ///@param id Token id to match (from (@link JsonTokenId}) ///@return {@code True} if the parser current points to specified token ///@since 2.5 - bool hasTokenId(int id) => jniAccessors.callMethodWithArgs(reference, - _id_hasTokenId, jni.JniCallType.booleanType, [jni.JValueInt(id)]).boolean; + bool hasTokenId( + int id, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_hasTokenId, + jni.JniCallType.booleanType, [jni.JValueInt(id)]).boolean; + } static final _id_hasToken = jniAccessors.getMethodIDOf( _classRef, r"hasToken", r"(Lcom/fasterxml/jackson/core/JsonToken;)Z"); @@ -1081,11 +1203,12 @@ ///@param t Token to match ///@return {@code True} if the parser current points to specified token ///@since 2.6 - bool hasToken(jsontoken_.JsonToken t) => jniAccessors.callMethodWithArgs( - reference, - _id_hasToken, - jni.JniCallType.booleanType, - [t.reference]).boolean; + bool hasToken( + jsontoken_.JsonToken t, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_hasToken, + jni.JniCallType.booleanType, [t.reference]).boolean; + } static final _id_isExpectedStartArrayToken = jniAccessors.getMethodIDOf( _classRef, r"isExpectedStartArrayToken", r"()Z"); @@ -1108,8 +1231,10 @@ ///@return True if the current token can be considered as a /// start-array marker (such JsonToken\#START_ARRAY); /// {@code false} if not - bool isExpectedStartArrayToken() => jniAccessors.callMethodWithArgs(reference, - _id_isExpectedStartArrayToken, jni.JniCallType.booleanType, []).boolean; + bool isExpectedStartArrayToken() { + return jniAccessors.callMethodWithArgs(reference, + _id_isExpectedStartArrayToken, jni.JniCallType.booleanType, []).boolean; + } static final _id_isExpectedStartObjectToken = jniAccessors.getMethodIDOf( _classRef, r"isExpectedStartObjectToken", r"()Z"); @@ -1122,10 +1247,12 @@ /// start-array marker (such JsonToken\#START_OBJECT); /// {@code false} if not ///@since 2.5 - bool isExpectedStartObjectToken() => jniAccessors.callMethodWithArgs( - reference, - _id_isExpectedStartObjectToken, - jni.JniCallType.booleanType, []).boolean; + bool isExpectedStartObjectToken() { + return jniAccessors.callMethodWithArgs( + reference, + _id_isExpectedStartObjectToken, + jni.JniCallType.booleanType, []).boolean; + } static final _id_isExpectedNumberIntToken = jniAccessors.getMethodIDOf( _classRef, r"isExpectedNumberIntToken", r"()Z"); @@ -1141,8 +1268,10 @@ /// start-array marker (such JsonToken\#VALUE_NUMBER_INT); /// {@code false} if not ///@since 2.12 - bool isExpectedNumberIntToken() => jniAccessors.callMethodWithArgs(reference, - _id_isExpectedNumberIntToken, jni.JniCallType.booleanType, []).boolean; + bool isExpectedNumberIntToken() { + return jniAccessors.callMethodWithArgs(reference, + _id_isExpectedNumberIntToken, jni.JniCallType.booleanType, []).boolean; + } static final _id_isNaN = jniAccessors.getMethodIDOf(_classRef, r"isNaN", r"()Z"); @@ -1161,8 +1290,10 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.9 - bool isNaN() => jniAccessors.callMethodWithArgs( - reference, _id_isNaN, jni.JniCallType.booleanType, []).boolean; + bool isNaN() { + return jniAccessors.callMethodWithArgs( + reference, _id_isNaN, jni.JniCallType.booleanType, []).boolean; + } static final _id_clearCurrentToken = jniAccessors.getMethodIDOf(_classRef, r"clearCurrentToken", r"()V"); @@ -1179,8 +1310,10 @@ /// Method was added to be used by the optional data binder, since /// it has to be able to consume last token used for binding (so that /// it will not be used again). - void clearCurrentToken() => jniAccessors.callMethodWithArgs( - reference, _id_clearCurrentToken, jni.JniCallType.voidType, []).check(); + void clearCurrentToken() { + return jniAccessors.callMethodWithArgs( + reference, _id_clearCurrentToken, jni.JniCallType.voidType, []).check(); + } static final _id_getLastClearedToken = jniAccessors.getMethodIDOf(_classRef, r"getLastClearedToken", r"()Lcom/fasterxml/jackson/core/JsonToken;"); @@ -1194,11 +1327,11 @@ /// Will return null if no tokens have been cleared, /// or if parser has been closed. ///@return Last cleared token, if any; {@code null} otherwise - jsontoken_.JsonToken getLastClearedToken() => - const jsontoken_.$JsonTokenType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_getLastClearedToken, - jni.JniCallType.objectType, []).object); + jsontoken_.JsonToken getLastClearedToken() { + return const jsontoken_.$JsonTokenType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_getLastClearedToken, + jni.JniCallType.objectType, []).object); + } static final _id_overrideCurrentName = jniAccessors.getMethodIDOf( _classRef, r"overrideCurrentName", r"(Ljava/lang/String;)V"); @@ -1213,11 +1346,12 @@ /// Note that use of this method should only be done as sort of last /// resort, as it is a work-around for regular operation. ///@param name Name to use as the current name; may be null. - void overrideCurrentName(jni.JString name) => jniAccessors.callMethodWithArgs( - reference, - _id_overrideCurrentName, - jni.JniCallType.voidType, - [name.reference]).check(); + void overrideCurrentName( + jni.JString name, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_overrideCurrentName, + jni.JniCallType.voidType, [name.reference]).check(); + } static final _id_getCurrentName = jniAccessors.getMethodIDOf( _classRef, r"getCurrentName", r"()Ljava/lang/String;"); @@ -1229,9 +1363,10 @@ ///@return Name of the current field in the parsing context ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JString getCurrentName() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getCurrentName, jni.JniCallType.objectType, []).object); + jni.JString getCurrentName() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getCurrentName, jni.JniCallType.objectType, []).object); + } static final _id_currentName = jniAccessors.getMethodIDOf( _classRef, r"currentName", r"()Ljava/lang/String;"); @@ -1248,9 +1383,10 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.10 - jni.JString currentName() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_currentName, jni.JniCallType.objectType, []).object); + jni.JString currentName() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_currentName, jni.JniCallType.objectType, []).object); + } static final _id_getText = jniAccessors.getMethodIDOf( _classRef, r"getText", r"()Ljava/lang/String;"); @@ -1266,9 +1402,10 @@ /// by \#nextToken() or other iteration methods) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JString getText() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getText, jni.JniCallType.objectType, []).object); + jni.JString getText() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getText, jni.JniCallType.objectType, []).object); + } static final _id_getText1 = jniAccessors.getMethodIDOf(_classRef, r"getText", r"(Ljava/io/Writer;)I"); @@ -1290,8 +1427,12 @@ /// {@code writer}, or /// JsonParseException for decoding problems ///@since 2.8 - int getText1(jni.JObject writer) => jniAccessors.callMethodWithArgs(reference, - _id_getText1, jni.JniCallType.intType, [writer.reference]).integer; + int getText1( + jni.JObject writer, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_getText1, + jni.JniCallType.intType, [writer.reference]).integer; + } static final _id_getTextCharacters = jniAccessors.getMethodIDOf(_classRef, r"getTextCharacters", r"()[C"); @@ -1326,10 +1467,11 @@ /// at offset 0, and not necessarily until the end of buffer) ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JArray<jni.JChar> getTextCharacters() => - const jni.JArrayType(jni.JCharType()).fromRef(jniAccessors - .callMethodWithArgs(reference, _id_getTextCharacters, - jni.JniCallType.objectType, []).object); + jni.JArray<jni.JChar> getTextCharacters() { + return const jni.JArrayType(jni.JCharType()).fromRef(jniAccessors + .callMethodWithArgs(reference, _id_getTextCharacters, + jni.JniCallType.objectType, []).object); + } static final _id_getTextLength = jniAccessors.getMethodIDOf(_classRef, r"getTextLength", r"()I"); @@ -1343,8 +1485,10 @@ /// textual content of the current token. ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getTextLength() => jniAccessors.callMethodWithArgs( - reference, _id_getTextLength, jni.JniCallType.intType, []).integer; + int getTextLength() { + return jniAccessors.callMethodWithArgs( + reference, _id_getTextLength, jni.JniCallType.intType, []).integer; + } static final _id_getTextOffset = jniAccessors.getMethodIDOf(_classRef, r"getTextOffset", r"()I"); @@ -1358,8 +1502,10 @@ /// textual content of the current token. ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getTextOffset() => jniAccessors.callMethodWithArgs( - reference, _id_getTextOffset, jni.JniCallType.intType, []).integer; + int getTextOffset() { + return jniAccessors.callMethodWithArgs( + reference, _id_getTextOffset, jni.JniCallType.intType, []).integer; + } static final _id_hasTextCharacters = jniAccessors.getMethodIDOf(_classRef, r"hasTextCharacters", r"()Z"); @@ -1380,8 +1526,10 @@ ///@return True if parser currently has character array that can /// be efficiently returned via \#getTextCharacters; false /// means that it may or may not exist - bool hasTextCharacters() => jniAccessors.callMethodWithArgs(reference, - _id_hasTextCharacters, jni.JniCallType.booleanType, []).boolean; + bool hasTextCharacters() { + return jniAccessors.callMethodWithArgs(reference, _id_hasTextCharacters, + jni.JniCallType.booleanType, []).boolean; + } static final _id_getNumberValue = jniAccessors.getMethodIDOf( _classRef, r"getNumberValue", r"()Ljava/lang/Number;"); @@ -1399,9 +1547,10 @@ /// the current token is not numeric, or if decoding of the value fails /// (invalid format for numbers); plain IOException if underlying /// content read fails (possible if values are extracted lazily) - jni.JObject getNumberValue() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getNumberValue, jni.JniCallType.objectType, []).object); + jni.JObject getNumberValue() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getNumberValue, jni.JniCallType.objectType, []).object); + } static final _id_getNumberValueExact = jniAccessors.getMethodIDOf( _classRef, r"getNumberValueExact", r"()Ljava/lang/Number;"); @@ -1423,9 +1572,12 @@ /// (invalid format for numbers); plain IOException if underlying /// content read fails (possible if values are extracted lazily) ///@since 2.12 - jni.JObject getNumberValueExact() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getNumberValueExact, jni.JniCallType.objectType, []).object); + jni.JObject getNumberValueExact() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getNumberValueExact, + jni.JniCallType.objectType, []).object); + } static final _id_getNumberType = jniAccessors.getMethodIDOf( _classRef, @@ -1442,9 +1594,11 @@ ///@return Type of current number, if parser points to numeric token; {@code null} otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - JsonParser_NumberType getNumberType() => const $JsonParser_NumberTypeType() - .fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getNumberType, jni.JniCallType.objectType, []).object); + JsonParser_NumberType getNumberType() { + return const $JsonParser_NumberTypeType().fromRef(jniAccessors + .callMethodWithArgs(reference, _id_getNumberType, + jni.JniCallType.objectType, []).object); + } static final _id_getByteValue = jniAccessors.getMethodIDOf(_classRef, r"getByteValue", r"()B"); @@ -1472,8 +1626,10 @@ /// range of {@code [-128, 255]}); otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getByteValue() => jniAccessors.callMethodWithArgs( - reference, _id_getByteValue, jni.JniCallType.byteType, []).byte; + int getByteValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_getByteValue, jni.JniCallType.byteType, []).byte; + } static final _id_getShortValue = jniAccessors.getMethodIDOf(_classRef, r"getShortValue", r"()S"); @@ -1495,8 +1651,10 @@ /// Java 16-bit signed {@code short} range); otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getShortValue() => jniAccessors.callMethodWithArgs( - reference, _id_getShortValue, jni.JniCallType.shortType, []).short; + int getShortValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_getShortValue, jni.JniCallType.shortType, []).short; + } static final _id_getIntValue = jniAccessors.getMethodIDOf(_classRef, r"getIntValue", r"()I"); @@ -1518,8 +1676,10 @@ /// Java 32-bit signed {@code int} range); otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getIntValue() => jniAccessors.callMethodWithArgs( - reference, _id_getIntValue, jni.JniCallType.intType, []).integer; + int getIntValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_getIntValue, jni.JniCallType.intType, []).integer; + } static final _id_getLongValue = jniAccessors.getMethodIDOf(_classRef, r"getLongValue", r"()J"); @@ -1541,8 +1701,10 @@ /// Java 32-bit signed {@code long} range); otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getLongValue() => jniAccessors.callMethodWithArgs( - reference, _id_getLongValue, jni.JniCallType.longType, []).long; + int getLongValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_getLongValue, jni.JniCallType.longType, []).long; + } static final _id_getBigIntegerValue = jniAccessors.getMethodIDOf( _classRef, r"getBigIntegerValue", r"()Ljava/math/BigInteger;"); @@ -1561,9 +1723,12 @@ /// otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JObject getBigIntegerValue() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getBigIntegerValue, jni.JniCallType.objectType, []).object); + jni.JObject getBigIntegerValue() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getBigIntegerValue, + jni.JniCallType.objectType, []).object); + } static final _id_getFloatValue = jniAccessors.getMethodIDOf(_classRef, r"getFloatValue", r"()F"); @@ -1585,8 +1750,10 @@ /// Java {@code float} range); otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - double getFloatValue() => jniAccessors.callMethodWithArgs( - reference, _id_getFloatValue, jni.JniCallType.floatType, []).float; + double getFloatValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_getFloatValue, jni.JniCallType.floatType, []).float; + } static final _id_getDoubleValue = jniAccessors.getMethodIDOf(_classRef, r"getDoubleValue", r"()D"); @@ -1608,8 +1775,10 @@ /// Java {@code double} range); otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - double getDoubleValue() => jniAccessors.callMethodWithArgs(reference, - _id_getDoubleValue, jni.JniCallType.doubleType, []).doubleFloat; + double getDoubleValue() { + return jniAccessors.callMethodWithArgs(reference, _id_getDoubleValue, + jni.JniCallType.doubleType, []).doubleFloat; + } static final _id_getDecimalValue = jniAccessors.getMethodIDOf( _classRef, r"getDecimalValue", r"()Ljava/math/BigDecimal;"); @@ -1625,9 +1794,10 @@ /// otherwise exception thrown ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JObject getDecimalValue() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getDecimalValue, jni.JniCallType.objectType, []).object); + jni.JObject getDecimalValue() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getDecimalValue, jni.JniCallType.objectType, []).object); + } static final _id_getBooleanValue = jniAccessors.getMethodIDOf(_classRef, r"getBooleanValue", r"()Z"); @@ -1645,8 +1815,10 @@ /// otherwise throws JsonParseException ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - bool getBooleanValue() => jniAccessors.callMethodWithArgs( - reference, _id_getBooleanValue, jni.JniCallType.booleanType, []).boolean; + bool getBooleanValue() { + return jniAccessors.callMethodWithArgs(reference, _id_getBooleanValue, + jni.JniCallType.booleanType, []).boolean; + } static final _id_getEmbeddedObject = jniAccessors.getMethodIDOf( _classRef, r"getEmbeddedObject", r"()Ljava/lang/Object;"); @@ -1668,9 +1840,12 @@ /// for the current token, if any; {@code null otherwise} ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JObject getEmbeddedObject() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getEmbeddedObject, jni.JniCallType.objectType, []).object); + jni.JObject getEmbeddedObject() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getEmbeddedObject, + jni.JniCallType.objectType, []).object); + } static final _id_getBinaryValue = jniAccessors.getMethodIDOf(_classRef, r"getBinaryValue", r"(Lcom/fasterxml/jackson/core/Base64Variant;)[B"); @@ -1698,10 +1873,13 @@ ///@return Decoded binary data ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JArray<jni.JByte> getBinaryValue(jni.JObject bv) => - const jni.JArrayType(jni.JByteType()).fromRef(jniAccessors - .callMethodWithArgs(reference, _id_getBinaryValue, - jni.JniCallType.objectType, [bv.reference]).object); + jni.JArray<jni.JByte> getBinaryValue( + jni.JObject bv, + ) { + return const jni.JArrayType(jni.JByteType()).fromRef(jniAccessors + .callMethodWithArgs(reference, _id_getBinaryValue, + jni.JniCallType.objectType, [bv.reference]).object); + } static final _id_getBinaryValue1 = jniAccessors.getMethodIDOf(_classRef, r"getBinaryValue", r"()[B"); @@ -1715,10 +1893,11 @@ ///@return Decoded binary data ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - jni.JArray<jni.JByte> getBinaryValue1() => - const jni.JArrayType(jni.JByteType()).fromRef(jniAccessors - .callMethodWithArgs(reference, _id_getBinaryValue1, - jni.JniCallType.objectType, []).object); + jni.JArray<jni.JByte> getBinaryValue1() { + return const jni.JArrayType(jni.JByteType()).fromRef(jniAccessors + .callMethodWithArgs(reference, _id_getBinaryValue1, + jni.JniCallType.objectType, []).object); + } static final _id_readBinaryValue = jniAccessors.getMethodIDOf( _classRef, r"readBinaryValue", r"(Ljava/io/OutputStream;)I"); @@ -1736,11 +1915,12 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.1 - int readBinaryValue(jni.JObject out) => jniAccessors.callMethodWithArgs( - reference, - _id_readBinaryValue, - jni.JniCallType.intType, - [out.reference]).integer; + int readBinaryValue( + jni.JObject out, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_readBinaryValue, + jni.JniCallType.intType, [out.reference]).integer; + } static final _id_readBinaryValue1 = jniAccessors.getMethodIDOf( _classRef, @@ -1757,9 +1937,13 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.1 - int readBinaryValue1(jni.JObject bv, jni.JObject out) => - jniAccessors.callMethodWithArgs(reference, _id_readBinaryValue1, - jni.JniCallType.intType, [bv.reference, out.reference]).integer; + int readBinaryValue1( + jni.JObject bv, + jni.JObject out, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_readBinaryValue1, + jni.JniCallType.intType, [bv.reference, out.reference]).integer; + } static final _id_getValueAsInt = jniAccessors.getMethodIDOf(_classRef, r"getValueAsInt", r"()I"); @@ -1779,8 +1963,10 @@ /// otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getValueAsInt() => jniAccessors.callMethodWithArgs( - reference, _id_getValueAsInt, jni.JniCallType.intType, []).integer; + int getValueAsInt() { + return jniAccessors.callMethodWithArgs( + reference, _id_getValueAsInt, jni.JniCallType.intType, []).integer; + } static final _id_getValueAsInt1 = jniAccessors.getMethodIDOf(_classRef, r"getValueAsInt", r"(I)I"); @@ -1800,11 +1986,12 @@ ///@return {@code int} value current token is converted to, if possible; {@code def} otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getValueAsInt1(int def) => jniAccessors.callMethodWithArgs( - reference, - _id_getValueAsInt1, - jni.JniCallType.intType, - [jni.JValueInt(def)]).integer; + int getValueAsInt1( + int def, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_getValueAsInt1, + jni.JniCallType.intType, [jni.JValueInt(def)]).integer; + } static final _id_getValueAsLong = jniAccessors.getMethodIDOf(_classRef, r"getValueAsLong", r"()J"); @@ -1824,8 +2011,10 @@ /// otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getValueAsLong() => jniAccessors.callMethodWithArgs( - reference, _id_getValueAsLong, jni.JniCallType.longType, []).long; + int getValueAsLong() { + return jniAccessors.callMethodWithArgs( + reference, _id_getValueAsLong, jni.JniCallType.longType, []).long; + } static final _id_getValueAsLong1 = jniAccessors.getMethodIDOf(_classRef, r"getValueAsLong", r"(J)J"); @@ -1845,8 +2034,12 @@ ///@return {@code long} value current token is converted to, if possible; {@code def} otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - int getValueAsLong1(int def) => jniAccessors.callMethodWithArgs( - reference, _id_getValueAsLong1, jni.JniCallType.longType, [def]).long; + int getValueAsLong1( + int def, + ) { + return jniAccessors.callMethodWithArgs( + reference, _id_getValueAsLong1, jni.JniCallType.longType, [def]).long; + } static final _id_getValueAsDouble = jniAccessors.getMethodIDOf(_classRef, r"getValueAsDouble", r"()D"); @@ -1866,8 +2059,10 @@ /// otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - double getValueAsDouble() => jniAccessors.callMethodWithArgs(reference, - _id_getValueAsDouble, jni.JniCallType.doubleType, []).doubleFloat; + double getValueAsDouble() { + return jniAccessors.callMethodWithArgs(reference, _id_getValueAsDouble, + jni.JniCallType.doubleType, []).doubleFloat; + } static final _id_getValueAsDouble1 = jniAccessors.getMethodIDOf(_classRef, r"getValueAsDouble", r"(D)D"); @@ -1887,11 +2082,12 @@ ///@return {@code double} value current token is converted to, if possible; {@code def} otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - double getValueAsDouble1(double def) => jniAccessors.callMethodWithArgs( - reference, - _id_getValueAsDouble1, - jni.JniCallType.doubleType, - [def]).doubleFloat; + double getValueAsDouble1( + double def, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_getValueAsDouble1, + jni.JniCallType.doubleType, [def]).doubleFloat; + } static final _id_getValueAsBoolean = jniAccessors.getMethodIDOf(_classRef, r"getValueAsBoolean", r"()Z"); @@ -1911,8 +2107,10 @@ /// otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - bool getValueAsBoolean() => jniAccessors.callMethodWithArgs(reference, - _id_getValueAsBoolean, jni.JniCallType.booleanType, []).boolean; + bool getValueAsBoolean() { + return jniAccessors.callMethodWithArgs(reference, _id_getValueAsBoolean, + jni.JniCallType.booleanType, []).boolean; + } static final _id_getValueAsBoolean1 = jniAccessors.getMethodIDOf(_classRef, r"getValueAsBoolean", r"(Z)Z"); @@ -1932,11 +2130,12 @@ ///@return {@code boolean} value current token is converted to, if possible; {@code def} otherwise ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems - bool getValueAsBoolean1(bool def) => jniAccessors.callMethodWithArgs( - reference, - _id_getValueAsBoolean1, - jni.JniCallType.booleanType, - [def ? 1 : 0]).boolean; + bool getValueAsBoolean1( + bool def, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_getValueAsBoolean1, + jni.JniCallType.booleanType, [def ? 1 : 0]).boolean; + } static final _id_getValueAsString = jniAccessors.getMethodIDOf( _classRef, r"getValueAsString", r"()Ljava/lang/String;"); @@ -1955,9 +2154,12 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.1 - jni.JString getValueAsString() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs(reference, - _id_getValueAsString, jni.JniCallType.objectType, []).object); + jni.JString getValueAsString() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getValueAsString, + jni.JniCallType.objectType, []).object); + } static final _id_getValueAsString1 = jniAccessors.getMethodIDOf(_classRef, r"getValueAsString", r"(Ljava/lang/String;)Ljava/lang/String;"); @@ -1977,12 +2179,15 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.1 - jni.JString getValueAsString1(jni.JString def) => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_getValueAsString1, - jni.JniCallType.objectType, - [def.reference]).object); + jni.JString getValueAsString1( + jni.JString def, + ) { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getValueAsString1, + jni.JniCallType.objectType, + [def.reference]).object); + } static final _id_canReadObjectId = jniAccessors.getMethodIDOf(_classRef, r"canReadObjectId", r"()Z"); @@ -2000,8 +2205,10 @@ ///@return {@code True} if the format being read supports native Object Ids; /// {@code false} if not ///@since 2.3 - bool canReadObjectId() => jniAccessors.callMethodWithArgs( - reference, _id_canReadObjectId, jni.JniCallType.booleanType, []).boolean; + bool canReadObjectId() { + return jniAccessors.callMethodWithArgs(reference, _id_canReadObjectId, + jni.JniCallType.booleanType, []).boolean; + } static final _id_canReadTypeId = jniAccessors.getMethodIDOf(_classRef, r"canReadTypeId", r"()Z"); @@ -2019,8 +2226,10 @@ ///@return {@code True} if the format being read supports native Type Ids; /// {@code false} if not ///@since 2.3 - bool canReadTypeId() => jniAccessors.callMethodWithArgs( - reference, _id_canReadTypeId, jni.JniCallType.booleanType, []).boolean; + bool canReadTypeId() { + return jniAccessors.callMethodWithArgs( + reference, _id_canReadTypeId, jni.JniCallType.booleanType, []).boolean; + } static final _id_getObjectId = jniAccessors.getMethodIDOf( _classRef, r"getObjectId", r"()Ljava/lang/Object;"); @@ -2041,9 +2250,10 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.3 - jni.JObject getObjectId() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getObjectId, jni.JniCallType.objectType, []).object); + jni.JObject getObjectId() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getObjectId, jni.JniCallType.objectType, []).object); + } static final _id_getTypeId = jniAccessors.getMethodIDOf( _classRef, r"getTypeId", r"()Ljava/lang/Object;"); @@ -2064,9 +2274,10 @@ ///@throws IOException for low-level read issues, or /// JsonParseException for decoding problems ///@since 2.3 - jni.JObject getTypeId() => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_getTypeId, jni.JniCallType.objectType, []).object); + jni.JObject getTypeId() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getTypeId, jni.JniCallType.objectType, []).object); + } static final _id_readValueAs = jniAccessors.getMethodIDOf( _classRef, r"readValueAs", r"(Ljava/lang/Class;)Ljava/lang/Object;"); @@ -2099,10 +2310,13 @@ ///@return Java value read from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - T readValueAs<T extends jni.JObject>( - jni.JObjType<T> $T, jni.JObject valueType) => - $T.fromRef(jniAccessors.callMethodWithArgs(reference, _id_readValueAs, - jni.JniCallType.objectType, [valueType.reference]).object); + $T readValueAs<$T extends jni.JObject>( + jni.JObject valueType, { + required jni.JObjType<$T> T, + }) { + return T.fromRef(jniAccessors.callMethodWithArgs(reference, _id_readValueAs, + jni.JniCallType.objectType, [valueType.reference]).object); + } static final _id_readValueAs1 = jniAccessors.getMethodIDOf( _classRef, @@ -2134,10 +2348,16 @@ ///@return Java value read from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - T readValueAs1<T extends jni.JObject>( - jni.JObjType<T> $T, jni.JObject valueTypeRef) => - $T.fromRef(jniAccessors.callMethodWithArgs(reference, _id_readValueAs1, - jni.JniCallType.objectType, [valueTypeRef.reference]).object); + $T readValueAs1<$T extends jni.JObject>( + jni.JObject valueTypeRef, { + required jni.JObjType<$T> T, + }) { + return T.fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_readValueAs1, + jni.JniCallType.objectType, + [valueTypeRef.reference]).object); + } static final _id_readValuesAs = jniAccessors.getMethodIDOf( _classRef, r"readValuesAs", r"(Ljava/lang/Class;)Ljava/util/Iterator;"); @@ -2153,13 +2373,16 @@ ///@return Iterator for reading multiple Java values from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - jni.JObject readValuesAs<T extends jni.JObject>( - jni.JObjType<T> $T, jni.JObject valueType) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_readValuesAs, - jni.JniCallType.objectType, - [valueType.reference]).object); + jni.JObject readValuesAs<$T extends jni.JObject>( + jni.JObject valueType, { + required jni.JObjType<$T> T, + }) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_readValuesAs, + jni.JniCallType.objectType, + [valueType.reference]).object); + } static final _id_readValuesAs1 = jniAccessors.getMethodIDOf( _classRef, @@ -2177,13 +2400,16 @@ ///@return Iterator for reading multiple Java values from content ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - jni.JObject readValuesAs1<T extends jni.JObject>( - jni.JObjType<T> $T, jni.JObject valueTypeRef) => - const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( - reference, - _id_readValuesAs1, - jni.JniCallType.objectType, - [valueTypeRef.reference]).object); + jni.JObject readValuesAs1<$T extends jni.JObject>( + jni.JObject valueTypeRef, { + required jni.JObjType<$T> T, + }) { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_readValuesAs1, + jni.JniCallType.objectType, + [valueTypeRef.reference]).object); + } static final _id_readValueAsTree = jniAccessors.getMethodIDOf( _classRef, r"readValueAsTree", r"()Ljava/lang/Object;"); @@ -2200,9 +2426,12 @@ ///@return root of the document, or null if empty or whitespace. ///@throws IOException if there is either an underlying I/O problem or decoding /// issue at format layer - T readValueAsTree<T extends jni.JObject>(jni.JObjType<T> $T) => - $T.fromRef(jniAccessors.callMethodWithArgs(reference, _id_readValueAsTree, - jni.JniCallType.objectType, []).object); + $T readValueAsTree<$T extends jni.JObject>({ + required jni.JObjType<$T> T, + }) { + return T.fromRef(jniAccessors.callMethodWithArgs( + reference, _id_readValueAsTree, jni.JniCallType.objectType, []).object); + } } class $JsonParserType extends jni.JObjType<JsonParser> { @@ -2213,15 +2442,28 @@ @override JsonParser fromRef(jni.JObjectPtr ref) => JsonParser.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonParserType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonParserType && other is $JsonParserType; + } } /// from: com.fasterxml.jackson.core.JsonParser$Feature /// /// Enumeration that defines all on/off features for parsers. class JsonParser_Feature extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonParser_Feature.fromRef( jni.JObjectPtr ref, @@ -2237,10 +2479,11 @@ /// from: static public com.fasterxml.jackson.core.JsonParser.Feature[] values() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JArray<JsonParser_Feature> values() => - const jni.JArrayType($JsonParser_FeatureType()).fromRef(jniAccessors - .callStaticMethodWithArgs( - _classRef, _id_values, jni.JniCallType.objectType, []).object); + static jni.JArray<JsonParser_Feature> values() { + return const jni.JArrayType($JsonParser_FeatureType()).fromRef(jniAccessors + .callStaticMethodWithArgs( + _classRef, _id_values, jni.JniCallType.objectType, []).object); + } static final _id_valueOf = jniAccessors.getStaticMethodIDOf( _classRef, @@ -2249,10 +2492,13 @@ /// from: static public com.fasterxml.jackson.core.JsonParser.Feature valueOf(java.lang.String name) /// The returned object must be deleted after use, by calling the `delete` method. - static JsonParser_Feature valueOf(jni.JString name) => - const $JsonParser_FeatureType().fromRef(jniAccessors - .callStaticMethodWithArgs(_classRef, _id_valueOf, - jni.JniCallType.objectType, [name.reference]).object); + static JsonParser_Feature valueOf( + jni.JString name, + ) { + return const $JsonParser_FeatureType().fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_valueOf, + jni.JniCallType.objectType, [name.reference]).object); + } static final _id_collectDefaults = jniAccessors.getStaticMethodIDOf(_classRef, r"collectDefaults", r"()I"); @@ -2262,32 +2508,39 @@ /// Method that calculates bit set (flags) of all features that /// are enabled by default. ///@return Bit mask of all features that are enabled by default - static int collectDefaults() => jniAccessors.callStaticMethodWithArgs( - _classRef, _id_collectDefaults, jni.JniCallType.intType, []).integer; + static int collectDefaults() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_collectDefaults, jni.JniCallType.intType, []).integer; + } static final _id_enabledByDefault = jniAccessors.getMethodIDOf(_classRef, r"enabledByDefault", r"()Z"); /// from: public boolean enabledByDefault() - bool enabledByDefault() => jniAccessors.callMethodWithArgs( - reference, _id_enabledByDefault, jni.JniCallType.booleanType, []).boolean; + bool enabledByDefault() { + return jniAccessors.callMethodWithArgs(reference, _id_enabledByDefault, + jni.JniCallType.booleanType, []).boolean; + } static final _id_enabledIn = jniAccessors.getMethodIDOf(_classRef, r"enabledIn", r"(I)Z"); /// from: public boolean enabledIn(int flags) - bool enabledIn(int flags) => jniAccessors.callMethodWithArgs( - reference, - _id_enabledIn, - jni.JniCallType.booleanType, - [jni.JValueInt(flags)]).boolean; + bool enabledIn( + int flags, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_enabledIn, + jni.JniCallType.booleanType, [jni.JValueInt(flags)]).boolean; + } static final _id_getMask = jniAccessors.getMethodIDOf(_classRef, r"getMask", r"()I"); /// from: public int getMask() - int getMask() => jniAccessors.callMethodWithArgs( - reference, _id_getMask, jni.JniCallType.intType, []).integer; + int getMask() { + return jniAccessors.callMethodWithArgs( + reference, _id_getMask, jni.JniCallType.intType, []).integer; + } } class $JsonParser_FeatureType extends jni.JObjType<JsonParser_Feature> { @@ -2299,6 +2552,21 @@ @override JsonParser_Feature fromRef(jni.JObjectPtr ref) => JsonParser_Feature.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonParser_FeatureType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonParser_FeatureType && + other is $JsonParser_FeatureType; + } } /// from: com.fasterxml.jackson.core.JsonParser$NumberType @@ -2306,9 +2574,8 @@ /// Enumeration of possible "native" (optimal) types that can be /// used for numbers. class JsonParser_NumberType extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonParser_NumberType.fromRef( jni.JObjectPtr ref, @@ -2324,10 +2591,11 @@ /// from: static public com.fasterxml.jackson.core.JsonParser.NumberType[] values() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JArray<JsonParser_NumberType> values() => - const jni.JArrayType($JsonParser_NumberTypeType()).fromRef(jniAccessors - .callStaticMethodWithArgs( - _classRef, _id_values, jni.JniCallType.objectType, []).object); + static jni.JArray<JsonParser_NumberType> values() { + return const jni.JArrayType($JsonParser_NumberTypeType()).fromRef( + jniAccessors.callStaticMethodWithArgs( + _classRef, _id_values, jni.JniCallType.objectType, []).object); + } static final _id_valueOf = jniAccessors.getStaticMethodIDOf( _classRef, @@ -2336,10 +2604,13 @@ /// from: static public com.fasterxml.jackson.core.JsonParser.NumberType valueOf(java.lang.String name) /// The returned object must be deleted after use, by calling the `delete` method. - static JsonParser_NumberType valueOf(jni.JString name) => - const $JsonParser_NumberTypeType().fromRef(jniAccessors - .callStaticMethodWithArgs(_classRef, _id_valueOf, - jni.JniCallType.objectType, [name.reference]).object); + static JsonParser_NumberType valueOf( + jni.JString name, + ) { + return const $JsonParser_NumberTypeType().fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_valueOf, + jni.JniCallType.objectType, [name.reference]).object); + } } class $JsonParser_NumberTypeType extends jni.JObjType<JsonParser_NumberType> { @@ -2351,4 +2622,19 @@ @override JsonParser_NumberType fromRef(jni.JObjectPtr ref) => JsonParser_NumberType.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonParser_NumberTypeType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonParser_NumberTypeType && + other is $JsonParser_NumberTypeType; + } }
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart index 6f3e8b4..2a88806 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart
@@ -43,9 +43,8 @@ /// Enumeration for basic token types used for returning results /// of parsing JSON content. class JsonToken extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonToken.fromRef( jni.JObjectPtr ref, @@ -61,10 +60,11 @@ /// from: static public com.fasterxml.jackson.core.JsonToken[] values() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JArray<JsonToken> values() => - const jni.JArrayType($JsonTokenType()).fromRef(jniAccessors - .callStaticMethodWithArgs( - _classRef, _id_values, jni.JniCallType.objectType, []).object); + static jni.JArray<JsonToken> values() { + return const jni.JArrayType($JsonTokenType()).fromRef(jniAccessors + .callStaticMethodWithArgs( + _classRef, _id_values, jni.JniCallType.objectType, []).object); + } static final _id_valueOf = jniAccessors.getStaticMethodIDOf( _classRef, @@ -73,45 +73,55 @@ /// from: static public com.fasterxml.jackson.core.JsonToken valueOf(java.lang.String name) /// The returned object must be deleted after use, by calling the `delete` method. - static JsonToken valueOf(jni.JString name) => - const $JsonTokenType().fromRef(jniAccessors.callStaticMethodWithArgs( - _classRef, - _id_valueOf, - jni.JniCallType.objectType, - [name.reference]).object); + static JsonToken valueOf( + jni.JString name, + ) { + return const $JsonTokenType().fromRef(jniAccessors.callStaticMethodWithArgs( + _classRef, + _id_valueOf, + jni.JniCallType.objectType, + [name.reference]).object); + } static final _id_id = jniAccessors.getMethodIDOf(_classRef, r"id", r"()I"); /// from: public final int id() - int id() => jniAccessors.callMethodWithArgs( - reference, _id_id, jni.JniCallType.intType, []).integer; + int id() { + return jniAccessors.callMethodWithArgs( + reference, _id_id, jni.JniCallType.intType, []).integer; + } static final _id_asString = jniAccessors.getMethodIDOf( _classRef, r"asString", r"()Ljava/lang/String;"); /// from: public final java.lang.String asString() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JString asString() => - const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( - reference, _id_asString, jni.JniCallType.objectType, []).object); + jni.JString asString() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_asString, jni.JniCallType.objectType, []).object); + } static final _id_asCharArray = jniAccessors.getMethodIDOf(_classRef, r"asCharArray", r"()[C"); /// from: public final char[] asCharArray() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JArray<jni.JChar> asCharArray() => const jni.JArrayType(jni.JCharType()) - .fromRef(jniAccessors.callMethodWithArgs( - reference, _id_asCharArray, jni.JniCallType.objectType, []).object); + jni.JArray<jni.JChar> asCharArray() { + return const jni.JArrayType(jni.JCharType()).fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_asCharArray, jni.JniCallType.objectType, []).object); + } static final _id_asByteArray = jniAccessors.getMethodIDOf(_classRef, r"asByteArray", r"()[B"); /// from: public final byte[] asByteArray() /// The returned object must be deleted after use, by calling the `delete` method. - jni.JArray<jni.JByte> asByteArray() => const jni.JArrayType(jni.JByteType()) - .fromRef(jniAccessors.callMethodWithArgs( - reference, _id_asByteArray, jni.JniCallType.objectType, []).object); + jni.JArray<jni.JByte> asByteArray() { + return const jni.JArrayType(jni.JByteType()).fromRef(jniAccessors + .callMethodWithArgs( + reference, _id_asByteArray, jni.JniCallType.objectType, []).object); + } static final _id_isNumeric = jniAccessors.getMethodIDOf(_classRef, r"isNumeric", r"()Z"); @@ -120,8 +130,10 @@ /// /// @return {@code True} if this token is {@code VALUE_NUMBER_INT} or {@code VALUE_NUMBER_FLOAT}, /// {@code false} otherwise - bool isNumeric() => jniAccessors.callMethodWithArgs( - reference, _id_isNumeric, jni.JniCallType.booleanType, []).boolean; + bool isNumeric() { + return jniAccessors.callMethodWithArgs( + reference, _id_isNumeric, jni.JniCallType.booleanType, []).boolean; + } static final _id_isStructStart = jniAccessors.getMethodIDOf(_classRef, r"isStructStart", r"()Z"); @@ -135,8 +147,10 @@ ///@return {@code True} if this token is {@code START_OBJECT} or {@code START_ARRAY}, /// {@code false} otherwise ///@since 2.3 - bool isStructStart() => jniAccessors.callMethodWithArgs( - reference, _id_isStructStart, jni.JniCallType.booleanType, []).boolean; + bool isStructStart() { + return jniAccessors.callMethodWithArgs( + reference, _id_isStructStart, jni.JniCallType.booleanType, []).boolean; + } static final _id_isStructEnd = jniAccessors.getMethodIDOf(_classRef, r"isStructEnd", r"()Z"); @@ -150,8 +164,10 @@ ///@return {@code True} if this token is {@code END_OBJECT} or {@code END_ARRAY}, /// {@code false} otherwise ///@since 2.3 - bool isStructEnd() => jniAccessors.callMethodWithArgs( - reference, _id_isStructEnd, jni.JniCallType.booleanType, []).boolean; + bool isStructEnd() { + return jniAccessors.callMethodWithArgs( + reference, _id_isStructEnd, jni.JniCallType.booleanType, []).boolean; + } static final _id_isScalarValue = jniAccessors.getMethodIDOf(_classRef, r"isScalarValue", r"()Z"); @@ -164,8 +180,10 @@ /// {@code FIELD_NAME}. ///@return {@code True} if this token is a scalar value token (one of /// {@code VALUE_xxx} tokens), {@code false} otherwise - bool isScalarValue() => jniAccessors.callMethodWithArgs( - reference, _id_isScalarValue, jni.JniCallType.booleanType, []).boolean; + bool isScalarValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_isScalarValue, jni.JniCallType.booleanType, []).boolean; + } static final _id_isBoolean = jniAccessors.getMethodIDOf(_classRef, r"isBoolean", r"()Z"); @@ -174,8 +192,10 @@ /// /// @return {@code True} if this token is {@code VALUE_TRUE} or {@code VALUE_FALSE}, /// {@code false} otherwise - bool isBoolean() => jniAccessors.callMethodWithArgs( - reference, _id_isBoolean, jni.JniCallType.booleanType, []).boolean; + bool isBoolean() { + return jniAccessors.callMethodWithArgs( + reference, _id_isBoolean, jni.JniCallType.booleanType, []).boolean; + } } class $JsonTokenType extends jni.JObjType<JsonToken> { @@ -186,4 +206,18 @@ @override JsonToken fromRef(jni.JObjectPtr ref) => JsonToken.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonTokenType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonTokenType && other is $JsonTokenType; + } }
diff --git a/pkgs/jnigen/test/kotlin_test/lib/kotlin.dart b/pkgs/jnigen/test/kotlin_test/lib/kotlin.dart index 5d11a17..094aa46 100644 --- a/pkgs/jnigen/test/kotlin_test/lib/kotlin.dart +++ b/pkgs/jnigen/test/kotlin_test/lib/kotlin.dart
@@ -30,9 +30,8 @@ /// from: com.github.dart_lang.jnigen.SuspendFun class SuspendFun extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; SuspendFun.fromRef( jni.JObjectPtr ref, @@ -46,7 +45,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - SuspendFun() : super.fromRef(_ctor().object); + factory SuspendFun() { + return SuspendFun.fromRef(_ctor().object); + } static final _sayHello = jniLookup< ffi.NativeFunction< @@ -82,7 +83,9 @@ /// from: public final java.lang.Object sayHello(java.lang.String string, kotlin.coroutines.Continuation continuation) /// The returned object must be deleted after use, by calling the `delete` method. - Future<jni.JString> sayHello1(jni.JString string) async { + Future<jni.JString> sayHello1( + jni.JString string, + ) async { final $p = ReceivePort(); final $c = jni.JObject.fromRef(jni.Jni.newPortContinuation($p)); _sayHello1(reference, string.reference, $c.reference).object; @@ -103,4 +106,18 @@ @override SuspendFun fromRef(jni.JObjectPtr ref) => SuspendFun.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($SuspendFunType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $SuspendFunType && other is $SuspendFunType; + } }
diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/MyStack.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/MyStack.java index fc85a3d..c4e2d06 100644 --- a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/MyStack.java +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/MyStack.java
@@ -13,6 +13,38 @@ stack = new Stack<>(); } + public static <T> MyStack<T> fromArray(T[] arr) { + var stack = new MyStack<T>(); + for (int i = 0; i < arr.length; ++i) { + stack.push(arr[i]); + } + return stack; + } + + public static <S> MyStack<S> fromArrayOfArrayOfGrandParents(GrandParent<S>[][] arr) { + // just for testing + var stack = new MyStack<S>(); + stack.push(arr[0][0].value); + return stack; + } + + public static <T> MyStack<T> of() { + return new MyStack<T>(); + } + + public static <T> MyStack<T> of(T obj) { + var stack = new MyStack<T>(); + stack.push(obj); + return stack; + } + + public static <T> MyStack<T> of(T obj, T obj2) { + var stack = new MyStack<T>(); + stack.push(obj); + stack.push(obj2); + return stack; + } + public void push(T item) { stack.push(item); } @@ -20,4 +52,8 @@ public T pop() { return stack.pop(); } + + public int size() { + return stack.size(); + } }
diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringMap.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringMap.java new file mode 100644 index 0000000..05f9365 --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringMap.java
@@ -0,0 +1,7 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.github.dart_lang.jnigen.generics; + +public class StringMap extends StringKeyedMap<String> {}
diff --git a/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart b/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart index aca99d9..c5d1083 100644 --- a/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart +++ b/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart
@@ -30,9 +30,8 @@ /// from: com.github.dart_lang.jnigen.simple_package.Example class Example extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; Example.fromRef( jni.JObjectPtr ref, @@ -89,7 +88,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - Example() : super.fromRef(_ctor().object); + factory Example() { + return Example.fromRef(_ctor().object); + } static final _ctor1 = jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( @@ -98,7 +99,11 @@ /// from: public void <init>(int internal) /// The returned object must be deleted after use, by calling the `delete` method. - Example.ctor1(int internal) : super.fromRef(_ctor1(internal).object); + factory Example.ctor1( + int internal, + ) { + return Example.fromRef(_ctor1(internal).object); + } static final _whichExample = jniLookup< ffi.NativeFunction< @@ -107,7 +112,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public int whichExample() - int whichExample() => _whichExample(reference).integer; + int whichExample() { + return _whichExample(reference).integer; + } static final _getAux = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example__getAux") @@ -115,8 +122,9 @@ /// from: static public com.github.dart_lang.jnigen.simple_package.Example.Aux getAux() /// The returned object must be deleted after use, by calling the `delete` method. - static Example_Aux getAux() => - const $Example_AuxType().fromRef(_getAux().object); + static Example_Aux getAux() { + return const $Example_AuxType().fromRef(_getAux().object); + } static final _addInts = jniLookup< ffi.NativeFunction<jni.JniResult Function(ffi.Int32, ffi.Int32)>>( @@ -124,7 +132,12 @@ .asFunction<jni.JniResult Function(int, int)>(); /// from: static public int addInts(int a, int b) - static int addInts(int a, int b) => _addInts(a, b).integer; + static int addInts( + int a, + int b, + ) { + return _addInts(a, b).integer; + } static final _getArr = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example__getArr") @@ -132,8 +145,9 @@ /// from: static public int[] getArr() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JArray<jni.JInt> getArr() => - const jni.JArrayType(jni.JIntType()).fromRef(_getArr().object); + static jni.JArray<jni.JInt> getArr() { + return const jni.JArrayType(jni.JIntType()).fromRef(_getArr().object); + } static final _addAll = jniLookup< ffi.NativeFunction< @@ -141,7 +155,11 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: static public int addAll(int[] arr) - static int addAll(jni.JArray<jni.JInt> arr) => _addAll(arr.reference).integer; + static int addAll( + jni.JArray<jni.JInt> arr, + ) { + return _addAll(arr.reference).integer; + } static final _getSelf = jniLookup< ffi.NativeFunction< @@ -151,7 +169,9 @@ /// from: public com.github.dart_lang.jnigen.simple_package.Example getSelf() /// The returned object must be deleted after use, by calling the `delete` method. - Example getSelf() => const $ExampleType().fromRef(_getSelf(reference).object); + Example getSelf() { + return const $ExampleType().fromRef(_getSelf(reference).object); + } static final _getNum = jniLookup< ffi.NativeFunction< @@ -159,7 +179,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public int getNum() - int getNum() => _getNum(reference).integer; + int getNum() { + return _getNum(reference).integer; + } static final _setNum = jniLookup< ffi.NativeFunction< @@ -168,7 +190,11 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); /// from: public void setNum(int num) - void setNum(int num) => _setNum(reference, num).check(); + void setNum( + int num, + ) { + return _setNum(reference, num).check(); + } static final _getInternal = jniLookup< ffi.NativeFunction< @@ -177,7 +203,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public int getInternal() - int getInternal() => _getInternal(reference).integer; + int getInternal() { + return _getInternal(reference).integer; + } static final _setInternal = jniLookup< ffi.NativeFunction< @@ -186,7 +214,11 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); /// from: public void setInternal(int internal) - void setInternal(int internal) => _setInternal(reference, internal).check(); + void setInternal( + int internal, + ) { + return _setInternal(reference, internal).check(); + } static final _throwException = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( @@ -194,7 +226,9 @@ .asFunction<jni.JniResult Function()>(); /// from: static public void throwException() - static void throwException() => _throwException().check(); + static void throwException() { + return _throwException().check(); + } } class $ExampleType extends jni.JObjType<Example> { @@ -206,13 +240,26 @@ @override Example fromRef(jni.JObjectPtr ref) => Example.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ExampleType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $ExampleType && other is $ExampleType; + } } /// from: com.github.dart_lang.jnigen.simple_package.Example$Aux class Example_Aux extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; Example_Aux.fromRef( jni.JObjectPtr ref, @@ -249,7 +296,11 @@ /// from: public void <init>(boolean value) /// The returned object must be deleted after use, by calling the `delete` method. - Example_Aux(bool value) : super.fromRef(_ctor(value ? 1 : 0).object); + factory Example_Aux( + bool value, + ) { + return Example_Aux.fromRef(_ctor(value ? 1 : 0).object); + } static final _getValue = jniLookup< ffi.NativeFunction< @@ -258,7 +309,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public boolean getValue() - bool getValue() => _getValue(reference).boolean; + bool getValue() { + return _getValue(reference).boolean; + } static final _setValue = jniLookup< ffi.NativeFunction< @@ -267,7 +320,11 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); /// from: public void setValue(boolean value) - void setValue(bool value) => _setValue(reference, value ? 1 : 0).check(); + void setValue( + bool value, + ) { + return _setValue(reference, value ? 1 : 0).check(); + } } class $Example_AuxType extends jni.JObjType<Example_Aux> { @@ -279,13 +336,26 @@ @override Example_Aux fromRef(jni.JObjectPtr ref) => Example_Aux.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Example_AuxType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $Example_AuxType && other is $Example_AuxType; + } } /// from: com.github.dart_lang.jnigen.pkg2.C2 class C2 extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; C2.fromRef( jni.JObjectPtr ref, @@ -315,7 +385,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - C2() : super.fromRef(_ctor().object); + factory C2() { + return C2.fromRef(_ctor().object); + } } class $C2Type extends jni.JObjType<C2> { @@ -326,13 +398,26 @@ @override C2 fromRef(jni.JObjectPtr ref) => C2.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($C2Type).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $C2Type && other is $C2Type; + } } /// from: com.github.dart_lang.jnigen.pkg2.Example class Example1 extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; Example1.fromRef( jni.JObjectPtr ref, @@ -346,7 +431,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - Example1() : super.fromRef(_ctor().object); + factory Example1() { + return Example1.fromRef(_ctor().object); + } static final _whichExample = jniLookup< ffi.NativeFunction< @@ -355,7 +442,9 @@ .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public int whichExample() - int whichExample() => _whichExample(reference).integer; + int whichExample() { + return _whichExample(reference).integer; + } } class $Example1Type extends jni.JObjType<Example1> { @@ -366,27 +455,40 @@ @override Example1 fromRef(jni.JObjectPtr ref) => Example1.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Example1Type).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $Example1Type && other is $Example1Type; + } } /// from: com.github.dart_lang.jnigen.generics.GrandParent -class GrandParent<T extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; +class GrandParent<$T extends jni.JObject> extends jni.JObject { @override - jni.JObjType get $type => _$type ??= type($T); + late final jni.JObjType $type = type(T); - final jni.JObjType<T> $T; + final jni.JObjType<$T> T; GrandParent.fromRef( - this.$T, + this.T, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $GrandParentType<T> type<T extends jni.JObject>( - jni.JObjType<T> $T, + static $GrandParentType<$T> type<$T extends jni.JObject>( + jni.JObjType<$T> T, ) { return $GrandParentType( - $T, + T, ); } @@ -409,11 +511,11 @@ /// from: public T value /// The returned object must be deleted after use, by calling the `delete` method. - T get value => $T.fromRef(_get_value(reference).object); + $T get value => T.fromRef(_get_value(reference).object); /// from: public T value /// The returned object must be deleted after use, by calling the `delete` method. - set value(T value) => _set_value(reference, value.reference); + set value($T value) => _set_value(reference, value.reference); static final _ctor = jniLookup< ffi.NativeFunction< @@ -423,7 +525,15 @@ /// from: public void <init>(T value) /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent(this.$T, T value) : super.fromRef(_ctor(value.reference).object); + factory GrandParent( + $T value, { + jni.JObjType<$T>? T, + }) { + T ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$T>; + return GrandParent.fromRef(T, _ctor(value.reference).object); + } static final _stringParent = jniLookup< ffi.NativeFunction< @@ -433,9 +543,10 @@ /// from: public com.github.dart_lang.jnigen.generics.GrandParent<T>.Parent<java.lang.String> stringParent() /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_Parent<jni.JObject, jni.JString> stringParent() => - const $GrandParent_ParentType(jni.JObjectType(), jni.JStringType()) - .fromRef(_stringParent(reference).object); + GrandParent_Parent<jni.JObject, jni.JString> stringParent() { + return const $GrandParent_ParentType(jni.JObjectType(), jni.JStringType()) + .fromRef(_stringParent(reference).object); + } static final _varParent = jniLookup< ffi.NativeFunction< @@ -447,10 +558,16 @@ /// from: public com.github.dart_lang.jnigen.generics.GrandParent<T>.Parent<S> varParent(S nestedValue) /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_Parent<jni.JObject, S> varParent<S extends jni.JObject>( - jni.JObjType<S> $S, S nestedValue) => - $GrandParent_ParentType(const jni.JObjectType(), $S) - .fromRef(_varParent(reference, nestedValue.reference).object); + GrandParent_Parent<jni.JObject, $S> varParent<$S extends jni.JObject>( + $S nestedValue, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + nestedValue.$type, + ]) as jni.JObjType<$S>; + return $GrandParent_ParentType(const jni.JObjectType(), S) + .fromRef(_varParent(reference, nestedValue.reference).object); + } static final _stringStaticParent = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( @@ -459,9 +576,10 @@ /// from: static public com.github.dart_lang.jnigen.generics.GrandParent.StaticParent<java.lang.String> stringStaticParent() /// The returned object must be deleted after use, by calling the `delete` method. - static GrandParent_StaticParent<jni.JString> stringStaticParent() => - const $GrandParent_StaticParentType(jni.JStringType()) - .fromRef(_stringStaticParent().object); + static GrandParent_StaticParent<jni.JString> stringStaticParent() { + return const $GrandParent_StaticParentType(jni.JStringType()) + .fromRef(_stringStaticParent().object); + } static final _varStaticParent = jniLookup< ffi.NativeFunction< @@ -471,10 +589,16 @@ /// from: static public com.github.dart_lang.jnigen.generics.GrandParent.StaticParent<S> varStaticParent(S value) /// The returned object must be deleted after use, by calling the `delete` method. - static GrandParent_StaticParent<S> varStaticParent<S extends jni.JObject>( - jni.JObjType<S> $S, S value) => - $GrandParent_StaticParentType($S) - .fromRef(_varStaticParent(value.reference).object); + static GrandParent_StaticParent<$S> varStaticParent<$S extends jni.JObject>( + $S value, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$S>; + return $GrandParent_StaticParentType(S) + .fromRef(_varStaticParent(value.reference).object); + } static final _staticParentWithSameType = jniLookup< ffi.NativeFunction< @@ -484,51 +608,67 @@ /// from: public com.github.dart_lang.jnigen.generics.GrandParent.StaticParent<T> staticParentWithSameType() /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_StaticParent<T> staticParentWithSameType() => - $GrandParent_StaticParentType($T) - .fromRef(_staticParentWithSameType(reference).object); + GrandParent_StaticParent<$T> staticParentWithSameType() { + return $GrandParent_StaticParentType(T) + .fromRef(_staticParentWithSameType(reference).object); + } } -class $GrandParentType<T extends jni.JObject> - extends jni.JObjType<GrandParent<T>> { - final jni.JObjType<T> $T; +class $GrandParentType<$T extends jni.JObject> + extends jni.JObjType<GrandParent<$T>> { + final jni.JObjType<$T> T; const $GrandParentType( - this.$T, + this.T, ); @override String get signature => r"Lcom/github/dart_lang/jnigen/generics/GrandParent;"; @override - GrandParent<T> fromRef(jni.JObjectPtr ref) => GrandParent.fromRef($T, ref); + GrandParent<$T> fromRef(jni.JObjectPtr ref) => GrandParent.fromRef(T, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($GrandParentType, T); + + @override + bool operator ==(Object other) { + return other.runtimeType == $GrandParentType && + other is $GrandParentType && + T == other.T; + } } /// from: com.github.dart_lang.jnigen.generics.GrandParent$Parent -class GrandParent_Parent<T extends jni.JObject, S extends jni.JObject> +class GrandParent_Parent<$T extends jni.JObject, $S extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type($T, $S); + late final jni.JObjType $type = type(T, S); - final jni.JObjType<T> $T; - final jni.JObjType<S> $S; + final jni.JObjType<$T> T; + final jni.JObjType<$S> S; GrandParent_Parent.fromRef( - this.$T, - this.$S, + this.T, + this.S, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $GrandParent_ParentType<T, S> - type<T extends jni.JObject, S extends jni.JObject>( - jni.JObjType<T> $T, - jni.JObjType<S> $S, + static $GrandParent_ParentType<$T, $S> + type<$T extends jni.JObject, $S extends jni.JObject>( + jni.JObjType<$T> T, + jni.JObjType<$S> S, ) { return $GrandParent_ParentType( - $T, - $S, + T, + S, ); } @@ -552,11 +692,11 @@ /// from: public T parentValue /// The returned object must be deleted after use, by calling the `delete` method. - T get parentValue => $T.fromRef(_get_parentValue(reference).object); + $T get parentValue => T.fromRef(_get_parentValue(reference).object); /// from: public T parentValue /// The returned object must be deleted after use, by calling the `delete` method. - set parentValue(T value) => _set_parentValue(reference, value.reference); + set parentValue($T value) => _set_parentValue(reference, value.reference); static final _get_value = jniLookup< ffi.NativeFunction< @@ -577,11 +717,11 @@ /// from: public S value /// The returned object must be deleted after use, by calling the `delete` method. - S get value => $S.fromRef(_get_value(reference).object); + $S get value => S.fromRef(_get_value(reference).object); /// from: public S value /// The returned object must be deleted after use, by calling the `delete` method. - set value(S value) => _set_value(reference, value.reference); + set value($S value) => _set_value(reference, value.reference); static final _ctor = jniLookup< ffi.NativeFunction< @@ -593,18 +733,31 @@ /// from: public void <init>(T parentValue, S value) /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_Parent(this.$T, this.$S, T parentValue, S value) - : super.fromRef(_ctor(parentValue.reference, value.reference).object); + factory GrandParent_Parent( + $T parentValue, + $S value, { + jni.JObjType<$T>? T, + jni.JObjType<$S>? S, + }) { + T ??= jni.lowestCommonSuperType([ + parentValue.$type, + ]) as jni.JObjType<$T>; + S ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$S>; + return GrandParent_Parent.fromRef( + T, S, _ctor(parentValue.reference, value.reference).object); + } } -class $GrandParent_ParentType<T extends jni.JObject, S extends jni.JObject> - extends jni.JObjType<GrandParent_Parent<T, S>> { - final jni.JObjType<T> $T; - final jni.JObjType<S> $S; +class $GrandParent_ParentType<$T extends jni.JObject, $S extends jni.JObject> + extends jni.JObjType<GrandParent_Parent<$T, $S>> { + final jni.JObjType<$T> T; + final jni.JObjType<$S> S; const $GrandParent_ParentType( - this.$T, - this.$S, + this.T, + this.S, ); @override @@ -612,39 +765,55 @@ r"Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;"; @override - GrandParent_Parent<T, S> fromRef(jni.JObjectPtr ref) => - GrandParent_Parent.fromRef($T, $S, ref); + GrandParent_Parent<$T, $S> fromRef(jni.JObjectPtr ref) => + GrandParent_Parent.fromRef(T, S, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($GrandParent_ParentType, T, S); + + @override + bool operator ==(Object other) { + return other.runtimeType == $GrandParent_ParentType && + other is $GrandParent_ParentType && + T == other.T && + S == other.S; + } } /// from: com.github.dart_lang.jnigen.generics.GrandParent$Parent$Child -class GrandParent_Parent_Child<T extends jni.JObject, S extends jni.JObject, - U extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; +class GrandParent_Parent_Child<$T extends jni.JObject, $S extends jni.JObject, + $U extends jni.JObject> extends jni.JObject { @override - jni.JObjType get $type => _$type ??= type($T, $S, $U); + late final jni.JObjType $type = type(T, S, U); - final jni.JObjType<T> $T; - final jni.JObjType<S> $S; - final jni.JObjType<U> $U; + final jni.JObjType<$T> T; + final jni.JObjType<$S> S; + final jni.JObjType<$U> U; GrandParent_Parent_Child.fromRef( - this.$T, - this.$S, - this.$U, + this.T, + this.S, + this.U, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $GrandParent_Parent_ChildType<T, S, U> - type<T extends jni.JObject, S extends jni.JObject, U extends jni.JObject>( - jni.JObjType<T> $T, - jni.JObjType<S> $S, - jni.JObjType<U> $U, + static $GrandParent_Parent_ChildType<$T, $S, $U> type<$T extends jni.JObject, + $S extends jni.JObject, $U extends jni.JObject>( + jni.JObjType<$T> T, + jni.JObjType<$S> S, + jni.JObjType<$U> U, ) { return $GrandParent_Parent_ChildType( - $T, - $S, - $U, + T, + S, + U, ); } @@ -668,11 +837,11 @@ /// from: public T grandParentValue /// The returned object must be deleted after use, by calling the `delete` method. - T get grandParentValue => $T.fromRef(_get_grandParentValue(reference).object); + $T get grandParentValue => T.fromRef(_get_grandParentValue(reference).object); /// from: public T grandParentValue /// The returned object must be deleted after use, by calling the `delete` method. - set grandParentValue(T value) => + set grandParentValue($T value) => _set_grandParentValue(reference, value.reference); static final _get_parentValue = jniLookup< @@ -695,11 +864,11 @@ /// from: public S parentValue /// The returned object must be deleted after use, by calling the `delete` method. - S get parentValue => $S.fromRef(_get_parentValue(reference).object); + $S get parentValue => S.fromRef(_get_parentValue(reference).object); /// from: public S parentValue /// The returned object must be deleted after use, by calling the `delete` method. - set parentValue(S value) => _set_parentValue(reference, value.reference); + set parentValue($S value) => _set_parentValue(reference, value.reference); static final _get_value = jniLookup< ffi.NativeFunction< @@ -721,11 +890,11 @@ /// from: public U value /// The returned object must be deleted after use, by calling the `delete` method. - U get value => $U.fromRef(_get_value(reference).object); + $U get value => U.fromRef(_get_value(reference).object); /// from: public U value /// The returned object must be deleted after use, by calling the `delete` method. - set value(U value) => _set_value(reference, value.reference); + set value($U value) => _set_value(reference, value.reference); static final _ctor = jniLookup< ffi.NativeFunction< @@ -739,24 +908,44 @@ /// from: public void <init>(T grandParentValue, S parentValue, U value) /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_Parent_Child( - this.$T, this.$S, this.$U, T grandParentValue, S parentValue, U value) - : super.fromRef(_ctor(grandParentValue.reference, parentValue.reference, + factory GrandParent_Parent_Child( + $T grandParentValue, + $S parentValue, + $U value, { + jni.JObjType<$T>? T, + jni.JObjType<$S>? S, + jni.JObjType<$U>? U, + }) { + T ??= jni.lowestCommonSuperType([ + grandParentValue.$type, + ]) as jni.JObjType<$T>; + S ??= jni.lowestCommonSuperType([ + parentValue.$type, + ]) as jni.JObjType<$S>; + U ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$U>; + return GrandParent_Parent_Child.fromRef( + T, + S, + U, + _ctor(grandParentValue.reference, parentValue.reference, value.reference) .object); + } } -class $GrandParent_Parent_ChildType<T extends jni.JObject, - S extends jni.JObject, U extends jni.JObject> - extends jni.JObjType<GrandParent_Parent_Child<T, S, U>> { - final jni.JObjType<T> $T; - final jni.JObjType<S> $S; - final jni.JObjType<U> $U; +class $GrandParent_Parent_ChildType<$T extends jni.JObject, + $S extends jni.JObject, $U extends jni.JObject> + extends jni.JObjType<GrandParent_Parent_Child<$T, $S, $U>> { + final jni.JObjType<$T> T; + final jni.JObjType<$S> S; + final jni.JObjType<$U> U; const $GrandParent_Parent_ChildType( - this.$T, - this.$S, - this.$U, + this.T, + this.S, + this.U, ); @override @@ -764,29 +953,46 @@ r"Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent$Child;"; @override - GrandParent_Parent_Child<T, S, U> fromRef(jni.JObjectPtr ref) => - GrandParent_Parent_Child.fromRef($T, $S, $U, ref); + GrandParent_Parent_Child<$T, $S, $U> fromRef(jni.JObjectPtr ref) => + GrandParent_Parent_Child.fromRef(T, S, U, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($GrandParent_Parent_ChildType, T, S, U); + + @override + bool operator ==(Object other) { + return other.runtimeType == $GrandParent_Parent_ChildType && + other is $GrandParent_Parent_ChildType && + T == other.T && + S == other.S && + U == other.U; + } } /// from: com.github.dart_lang.jnigen.generics.GrandParent$StaticParent -class GrandParent_StaticParent<S extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; +class GrandParent_StaticParent<$S extends jni.JObject> extends jni.JObject { @override - jni.JObjType get $type => _$type ??= type($S); + late final jni.JObjType $type = type(S); - final jni.JObjType<S> $S; + final jni.JObjType<$S> S; GrandParent_StaticParent.fromRef( - this.$S, + this.S, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $GrandParent_StaticParentType<S> type<S extends jni.JObject>( - jni.JObjType<S> $S, + static $GrandParent_StaticParentType<$S> type<$S extends jni.JObject>( + jni.JObjType<$S> S, ) { return $GrandParent_StaticParentType( - $S, + S, ); } @@ -810,11 +1016,11 @@ /// from: public S value /// The returned object must be deleted after use, by calling the `delete` method. - S get value => $S.fromRef(_get_value(reference).object); + $S get value => S.fromRef(_get_value(reference).object); /// from: public S value /// The returned object must be deleted after use, by calling the `delete` method. - set value(S value) => _set_value(reference, value.reference); + set value($S value) => _set_value(reference, value.reference); static final _ctor = jniLookup< ffi.NativeFunction< @@ -824,16 +1030,23 @@ /// from: public void <init>(S value) /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_StaticParent(this.$S, S value) - : super.fromRef(_ctor(value.reference).object); + factory GrandParent_StaticParent( + $S value, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$S>; + return GrandParent_StaticParent.fromRef(S, _ctor(value.reference).object); + } } -class $GrandParent_StaticParentType<S extends jni.JObject> - extends jni.JObjType<GrandParent_StaticParent<S>> { - final jni.JObjType<S> $S; +class $GrandParent_StaticParentType<$S extends jni.JObject> + extends jni.JObjType<GrandParent_StaticParent<$S>> { + final jni.JObjType<$S> S; const $GrandParent_StaticParentType( - this.$S, + this.S, ); @override @@ -841,35 +1054,50 @@ r"Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"; @override - GrandParent_StaticParent<S> fromRef(jni.JObjectPtr ref) => - GrandParent_StaticParent.fromRef($S, ref); + GrandParent_StaticParent<$S> fromRef(jni.JObjectPtr ref) => + GrandParent_StaticParent.fromRef(S, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($GrandParent_StaticParentType, S); + + @override + bool operator ==(Object other) { + return other.runtimeType == $GrandParent_StaticParentType && + other is $GrandParent_StaticParentType && + S == other.S; + } } /// from: com.github.dart_lang.jnigen.generics.GrandParent$StaticParent$Child -class GrandParent_StaticParent_Child<S extends jni.JObject, - U extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; +class GrandParent_StaticParent_Child<$S extends jni.JObject, + $U extends jni.JObject> extends jni.JObject { @override - jni.JObjType get $type => _$type ??= type($S, $U); + late final jni.JObjType $type = type(S, U); - final jni.JObjType<S> $S; - final jni.JObjType<U> $U; + final jni.JObjType<$S> S; + final jni.JObjType<$U> U; GrandParent_StaticParent_Child.fromRef( - this.$S, - this.$U, + this.S, + this.U, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $GrandParent_StaticParent_ChildType<S, U> - type<S extends jni.JObject, U extends jni.JObject>( - jni.JObjType<S> $S, - jni.JObjType<U> $U, + static $GrandParent_StaticParent_ChildType<$S, $U> + type<$S extends jni.JObject, $U extends jni.JObject>( + jni.JObjType<$S> S, + jni.JObjType<$U> U, ) { return $GrandParent_StaticParent_ChildType( - $S, - $U, + S, + U, ); } @@ -893,11 +1121,11 @@ /// from: public S parentValue /// The returned object must be deleted after use, by calling the `delete` method. - S get parentValue => $S.fromRef(_get_parentValue(reference).object); + $S get parentValue => S.fromRef(_get_parentValue(reference).object); /// from: public S parentValue /// The returned object must be deleted after use, by calling the `delete` method. - set parentValue(S value) => _set_parentValue(reference, value.reference); + set parentValue($S value) => _set_parentValue(reference, value.reference); static final _get_value = jniLookup< ffi.NativeFunction< @@ -919,11 +1147,11 @@ /// from: public U value /// The returned object must be deleted after use, by calling the `delete` method. - U get value => $U.fromRef(_get_value(reference).object); + $U get value => U.fromRef(_get_value(reference).object); /// from: public U value /// The returned object must be deleted after use, by calling the `delete` method. - set value(U value) => _set_value(reference, value.reference); + set value($U value) => _set_value(reference, value.reference); static final _ctor = jniLookup< ffi.NativeFunction< @@ -936,19 +1164,32 @@ /// from: public void <init>(S parentValue, U value) /// The returned object must be deleted after use, by calling the `delete` method. - GrandParent_StaticParent_Child(this.$S, this.$U, S parentValue, U value) - : super.fromRef(_ctor(parentValue.reference, value.reference).object); + factory GrandParent_StaticParent_Child( + $S parentValue, + $U value, { + jni.JObjType<$S>? S, + jni.JObjType<$U>? U, + }) { + S ??= jni.lowestCommonSuperType([ + parentValue.$type, + ]) as jni.JObjType<$S>; + U ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$U>; + return GrandParent_StaticParent_Child.fromRef( + S, U, _ctor(parentValue.reference, value.reference).object); + } } -class $GrandParent_StaticParent_ChildType<S extends jni.JObject, - U extends jni.JObject> - extends jni.JObjType<GrandParent_StaticParent_Child<S, U>> { - final jni.JObjType<S> $S; - final jni.JObjType<U> $U; +class $GrandParent_StaticParent_ChildType<$S extends jni.JObject, + $U extends jni.JObject> + extends jni.JObjType<GrandParent_StaticParent_Child<$S, $U>> { + final jni.JObjType<$S> S; + final jni.JObjType<$U> U; const $GrandParent_StaticParent_ChildType( - this.$S, - this.$U, + this.S, + this.U, ); @override @@ -956,33 +1197,51 @@ r"Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child;"; @override - GrandParent_StaticParent_Child<S, U> fromRef(jni.JObjectPtr ref) => - GrandParent_StaticParent_Child.fromRef($S, $U, ref); + GrandParent_StaticParent_Child<$S, $U> fromRef(jni.JObjectPtr ref) => + GrandParent_StaticParent_Child.fromRef(S, U, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($GrandParent_StaticParent_ChildType, S, U); + + @override + bool operator ==(Object other) { + return other.runtimeType == $GrandParent_StaticParent_ChildType && + other is $GrandParent_StaticParent_ChildType && + S == other.S && + U == other.U; + } } /// from: com.github.dart_lang.jnigen.generics.MyMap -class MyMap<K extends jni.JObject, V extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; +class MyMap<$K extends jni.JObject, $V extends jni.JObject> + extends jni.JObject { @override - jni.JObjType get $type => _$type ??= type($K, $V); + late final jni.JObjType $type = type(K, V); - final jni.JObjType<K> $K; - final jni.JObjType<V> $V; + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; MyMap.fromRef( - this.$K, - this.$V, + this.K, + this.V, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $MyMapType<K, V> type<K extends jni.JObject, V extends jni.JObject>( - jni.JObjType<K> $K, - jni.JObjType<V> $V, + static $MyMapType<$K, $V> + type<$K extends jni.JObject, $V extends jni.JObject>( + jni.JObjType<$K> K, + jni.JObjType<$V> V, ) { return $MyMapType( - $K, - $V, + K, + V, ); } @@ -992,7 +1251,12 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - MyMap(this.$K, this.$V) : super.fromRef(_ctor().object); + factory MyMap({ + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return MyMap.fromRef(K, V, _ctor().object); + } static final _get0 = jniLookup< ffi.NativeFunction< @@ -1004,7 +1268,11 @@ /// from: public V get(K key) /// The returned object must be deleted after use, by calling the `delete` method. - V get0(K key) => $V.fromRef(_get0(reference, key.reference).object); + $V get0( + $K key, + ) { + return V.fromRef(_get0(reference, key.reference).object); + } static final _put = jniLookup< ffi.NativeFunction< @@ -1016,8 +1284,12 @@ /// from: public V put(K key, V value) /// The returned object must be deleted after use, by calling the `delete` method. - V put(K key, V value) => - $V.fromRef(_put(reference, key.reference, value.reference).object); + $V put( + $K key, + $V value, + ) { + return V.fromRef(_put(reference, key.reference, value.reference).object); + } static final _entryStack = jniLookup< ffi.NativeFunction< @@ -1027,54 +1299,71 @@ /// from: public com.github.dart_lang.jnigen.generics.MyStack<com.github.dart_lang.jnigen.generics.MyMap<K,V>.MyEntry> entryStack() /// The returned object must be deleted after use, by calling the `delete` method. - MyStack<MyMap_MyEntry<jni.JObject, jni.JObject>> entryStack() => - const $MyStackType( - $MyMap_MyEntryType(jni.JObjectType(), jni.JObjectType())) - .fromRef(_entryStack(reference).object); + MyStack<MyMap_MyEntry<jni.JObject, jni.JObject>> entryStack() { + return const $MyStackType( + $MyMap_MyEntryType(jni.JObjectType(), jni.JObjectType())) + .fromRef(_entryStack(reference).object); + } } -class $MyMapType<K extends jni.JObject, V extends jni.JObject> - extends jni.JObjType<MyMap<K, V>> { - final jni.JObjType<K> $K; - final jni.JObjType<V> $V; +class $MyMapType<$K extends jni.JObject, $V extends jni.JObject> + extends jni.JObjType<MyMap<$K, $V>> { + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; const $MyMapType( - this.$K, - this.$V, + this.K, + this.V, ); @override String get signature => r"Lcom/github/dart_lang/jnigen/generics/MyMap;"; @override - MyMap<K, V> fromRef(jni.JObjectPtr ref) => MyMap.fromRef($K, $V, ref); + MyMap<$K, $V> fromRef(jni.JObjectPtr ref) => MyMap.fromRef(K, V, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($MyMapType, K, V); + + @override + bool operator ==(Object other) { + return other.runtimeType == $MyMapType && + other is $MyMapType && + K == other.K && + V == other.V; + } } /// from: com.github.dart_lang.jnigen.generics.MyMap$MyEntry -class MyMap_MyEntry<K extends jni.JObject, V extends jni.JObject> +class MyMap_MyEntry<$K extends jni.JObject, $V extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type($K, $V); + late final jni.JObjType $type = type(K, V); - final jni.JObjType<K> $K; - final jni.JObjType<V> $V; + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; MyMap_MyEntry.fromRef( - this.$K, - this.$V, + this.K, + this.V, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $MyMap_MyEntryType<K, V> - type<K extends jni.JObject, V extends jni.JObject>( - jni.JObjType<K> $K, - jni.JObjType<V> $V, + static $MyMap_MyEntryType<$K, $V> + type<$K extends jni.JObject, $V extends jni.JObject>( + jni.JObjType<$K> K, + jni.JObjType<$V> V, ) { return $MyMap_MyEntryType( - $K, - $V, + K, + V, ); } @@ -1097,11 +1386,11 @@ /// from: public K key /// The returned object must be deleted after use, by calling the `delete` method. - K get key => $K.fromRef(_get_key(reference).object); + $K get key => K.fromRef(_get_key(reference).object); /// from: public K key /// The returned object must be deleted after use, by calling the `delete` method. - set key(K value) => _set_key(reference, value.reference); + set key($K value) => _set_key(reference, value.reference); static final _get_value = jniLookup< ffi.NativeFunction< @@ -1122,11 +1411,11 @@ /// from: public V value /// The returned object must be deleted after use, by calling the `delete` method. - V get value => $V.fromRef(_get_value(reference).object); + $V get value => V.fromRef(_get_value(reference).object); /// from: public V value /// The returned object must be deleted after use, by calling the `delete` method. - set value(V value) => _set_value(reference, value.reference); + set value($V value) => _set_value(reference, value.reference); static final _ctor = jniLookup< ffi.NativeFunction< @@ -1138,18 +1427,31 @@ /// from: public void <init>(K key, V value) /// The returned object must be deleted after use, by calling the `delete` method. - MyMap_MyEntry(this.$K, this.$V, K key, V value) - : super.fromRef(_ctor(key.reference, value.reference).object); + factory MyMap_MyEntry( + $K key, + $V value, { + jni.JObjType<$K>? K, + jni.JObjType<$V>? V, + }) { + K ??= jni.lowestCommonSuperType([ + key.$type, + ]) as jni.JObjType<$K>; + V ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$V>; + return MyMap_MyEntry.fromRef( + K, V, _ctor(key.reference, value.reference).object); + } } -class $MyMap_MyEntryType<K extends jni.JObject, V extends jni.JObject> - extends jni.JObjType<MyMap_MyEntry<K, V>> { - final jni.JObjType<K> $K; - final jni.JObjType<V> $V; +class $MyMap_MyEntryType<$K extends jni.JObject, $V extends jni.JObject> + extends jni.JObjType<MyMap_MyEntry<$K, $V>> { + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; const $MyMap_MyEntryType( - this.$K, - this.$V, + this.K, + this.V, ); @override @@ -1157,29 +1459,45 @@ r"Lcom/github/dart_lang/jnigen/generics/MyMap$MyEntry;"; @override - MyMap_MyEntry<K, V> fromRef(jni.JObjectPtr ref) => - MyMap_MyEntry.fromRef($K, $V, ref); + MyMap_MyEntry<$K, $V> fromRef(jni.JObjectPtr ref) => + MyMap_MyEntry.fromRef(K, V, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($MyMap_MyEntryType, K, V); + + @override + bool operator ==(Object other) { + return other.runtimeType == $MyMap_MyEntryType && + other is $MyMap_MyEntryType && + K == other.K && + V == other.V; + } } /// from: com.github.dart_lang.jnigen.generics.MyStack -class MyStack<T extends jni.JObject> extends jni.JObject { - late final jni.JObjType? _$type; +class MyStack<$T extends jni.JObject> extends jni.JObject { @override - jni.JObjType get $type => _$type ??= type($T); + late final jni.JObjType $type = type(T); - final jni.JObjType<T> $T; + final jni.JObjType<$T> T; MyStack.fromRef( - this.$T, + this.T, jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static $MyStackType<T> type<T extends jni.JObject>( - jni.JObjType<T> $T, + static $MyStackType<$T> type<$T extends jni.JObject>( + jni.JObjType<$T> T, ) { return $MyStackType( - $T, + T, ); } @@ -1189,7 +1507,102 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - MyStack(this.$T) : super.fromRef(_ctor().object); + factory MyStack({ + required jni.JObjType<$T> T, + }) { + return MyStack.fromRef(T, _ctor().object); + } + + static final _fromArray = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("MyStack__fromArray") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.github.dart_lang.jnigen.generics.MyStack<T> fromArray(T[] arr) + /// The returned object must be deleted after use, by calling the `delete` method. + static MyStack<$T> fromArray<$T extends jni.JObject>( + jni.JArray<$T> arr, { + jni.JObjType<$T>? T, + }) { + T ??= jni.lowestCommonSuperType([ + ((arr.$type as jni.JArrayType).elementType as jni.JObjType), + ]) as jni.JObjType<$T>; + return $MyStackType(T).fromRef(_fromArray(arr.reference).object); + } + + static final _fromArrayOfArrayOfGrandParents = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "MyStack__fromArrayOfArrayOfGrandParents") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.github.dart_lang.jnigen.generics.MyStack<S> fromArrayOfArrayOfGrandParents(com.github.dart_lang.jnigen.generics.GrandParent<S>[][] arr) + /// The returned object must be deleted after use, by calling the `delete` method. + static MyStack<$S> fromArrayOfArrayOfGrandParents<$S extends jni.JObject>( + jni.JArray<jni.JArray<GrandParent<$S>>> arr, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + (((((arr.$type as jni.JArrayType).elementType as jni.JObjType) + as jni.JArrayType) + .elementType as jni.JObjType) as $GrandParentType) + .T, + ]) as jni.JObjType<$S>; + return $MyStackType(S) + .fromRef(_fromArrayOfArrayOfGrandParents(arr.reference).object); + } + + static final _of = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("MyStack__of") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.github.dart_lang.jnigen.generics.MyStack<T> of() + /// The returned object must be deleted after use, by calling the `delete` method. + static MyStack<$T> of<$T extends jni.JObject>({ + required jni.JObjType<$T> T, + }) { + return $MyStackType(T).fromRef(_of().object); + } + + static final _of1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>("MyStack__of1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.github.dart_lang.jnigen.generics.MyStack<T> of(T obj) + /// The returned object must be deleted after use, by calling the `delete` method. + static MyStack<$T> of1<$T extends jni.JObject>( + $T obj, { + jni.JObjType<$T>? T, + }) { + T ??= jni.lowestCommonSuperType([ + obj.$type, + ]) as jni.JObjType<$T>; + return $MyStackType(T).fromRef(_of1(obj.reference).object); + } + + static final _of2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("MyStack__of2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.github.dart_lang.jnigen.generics.MyStack<T> of(T obj, T obj2) + /// The returned object must be deleted after use, by calling the `delete` method. + static MyStack<$T> of2<$T extends jni.JObject>( + $T obj, + $T obj2, { + jni.JObjType<$T>? T, + }) { + T ??= jni.lowestCommonSuperType([ + obj2.$type, + obj.$type, + ]) as jni.JObjType<$T>; + return $MyStackType(T).fromRef(_of2(obj.reference, obj2.reference).object); + } static final _push = jniLookup< ffi.NativeFunction< @@ -1200,7 +1613,11 @@ ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); /// from: public void push(T item) - void push(T item) => _push(reference, item.reference).check(); + void push( + $T item, + ) { + return _push(reference, item.reference).check(); + } static final _pop = jniLookup< ffi.NativeFunction< @@ -1209,42 +1626,69 @@ /// from: public T pop() /// The returned object must be deleted after use, by calling the `delete` method. - T pop() => $T.fromRef(_pop(reference).object); + $T pop() { + return T.fromRef(_pop(reference).object); + } + + static final _size = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>("MyStack__size") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int size() + int size() { + return _size(reference).integer; + } } -class $MyStackType<T extends jni.JObject> extends jni.JObjType<MyStack<T>> { - final jni.JObjType<T> $T; +class $MyStackType<$T extends jni.JObject> extends jni.JObjType<MyStack<$T>> { + final jni.JObjType<$T> T; const $MyStackType( - this.$T, + this.T, ); @override String get signature => r"Lcom/github/dart_lang/jnigen/generics/MyStack;"; @override - MyStack<T> fromRef(jni.JObjectPtr ref) => MyStack.fromRef($T, ref); + MyStack<$T> fromRef(jni.JObjectPtr ref) => MyStack.fromRef(T, ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => Object.hash($MyStackType, T); + + @override + bool operator ==(Object other) { + return other.runtimeType == $MyStackType && + other is $MyStackType && + T == other.T; + } } /// from: com.github.dart_lang.jnigen.generics.StringKeyedMap -class StringKeyedMap<V extends jni.JObject> extends MyMap<jni.JString, V> { - late final jni.JObjType? _$type; +class StringKeyedMap<$V extends jni.JObject> extends MyMap<jni.JString, $V> { @override - jni.JObjType get $type => _$type ??= type($V); + late final jni.JObjType $type = type(V); - final jni.JObjType<V> $V; + final jni.JObjType<$V> V; StringKeyedMap.fromRef( - this.$V, + this.V, jni.JObjectPtr ref, - ) : super.fromRef(const jni.JStringType(), $V, ref); + ) : super.fromRef(const jni.JStringType(), V, ref); /// The type which includes information such as the signature of this class. - static $StringKeyedMapType<V> type<V extends jni.JObject>( - jni.JObjType<V> $V, + static $StringKeyedMapType<$V> type<$V extends jni.JObject>( + jni.JObjType<$V> V, ) { return $StringKeyedMapType( - $V, + V, ); } @@ -1254,16 +1698,19 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - StringKeyedMap(this.$V) - : super.fromRef(const jni.JStringType(), $V, _ctor().object); + factory StringKeyedMap({ + required jni.JObjType<$V> V, + }) { + return StringKeyedMap.fromRef(V, _ctor().object); + } } -class $StringKeyedMapType<V extends jni.JObject> - extends jni.JObjType<StringKeyedMap<V>> { - final jni.JObjType<V> $V; +class $StringKeyedMapType<$V extends jni.JObject> + extends jni.JObjType<StringKeyedMap<$V>> { + final jni.JObjType<$V> V; const $StringKeyedMapType( - this.$V, + this.V, ); @override @@ -1271,15 +1718,76 @@ r"Lcom/github/dart_lang/jnigen/generics/StringKeyedMap;"; @override - StringKeyedMap<V> fromRef(jni.JObjectPtr ref) => - StringKeyedMap.fromRef($V, ref); + StringKeyedMap<$V> fromRef(jni.JObjectPtr ref) => + StringKeyedMap.fromRef(V, ref); + + @override + jni.JObjType get superType => $MyMapType(const jni.JStringType(), V); + + @override + final superCount = 2; + + @override + int get hashCode => Object.hash($StringKeyedMapType, V); + + @override + bool operator ==(Object other) { + return other.runtimeType == $StringKeyedMapType && + other is $StringKeyedMapType && + V == other.V; + } +} + +/// from: com.github.dart_lang.jnigen.generics.StringMap +class StringMap extends StringKeyedMap<jni.JString> { + @override + late final jni.JObjType $type = type; + + StringMap.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(const jni.JStringType(), ref); + + /// The type which includes information such as the signature of this class. + static const type = $StringMapType(); + static final _ctor = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("StringMap__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory StringMap() { + return StringMap.fromRef(_ctor().object); + } +} + +class $StringMapType extends jni.JObjType<StringMap> { + const $StringMapType(); + + @override + String get signature => r"Lcom/github/dart_lang/jnigen/generics/StringMap;"; + + @override + StringMap fromRef(jni.JObjectPtr ref) => StringMap.fromRef(ref); + + @override + jni.JObjType get superType => const $StringKeyedMapType(jni.JStringType()); + + @override + final superCount = 3; + + @override + int get hashCode => ($StringMapType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $StringMapType && other is $StringMapType; + } } /// from: com.github.dart_lang.jnigen.generics.StringStack class StringStack extends MyStack<jni.JString> { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; StringStack.fromRef( jni.JObjectPtr ref, @@ -1293,7 +1801,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - StringStack() : super.fromRef(const jni.JStringType(), _ctor().object); + factory StringStack() { + return StringStack.fromRef(_ctor().object); + } } class $StringStackType extends jni.JObjType<StringStack> { @@ -1304,27 +1814,40 @@ @override StringStack fromRef(jni.JObjectPtr ref) => StringStack.fromRef(ref); + + @override + jni.JObjType get superType => const $MyStackType(jni.JStringType()); + + @override + final superCount = 2; + + @override + int get hashCode => ($StringStackType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $StringStackType && other is $StringStackType; + } } /// from: com.github.dart_lang.jnigen.generics.StringValuedMap -class StringValuedMap<K extends jni.JObject> extends MyMap<K, jni.JString> { - late final jni.JObjType? _$type; +class StringValuedMap<$K extends jni.JObject> extends MyMap<$K, jni.JString> { @override - jni.JObjType get $type => _$type ??= type($K); + late final jni.JObjType $type = type(K); - final jni.JObjType<K> $K; + final jni.JObjType<$K> K; StringValuedMap.fromRef( - this.$K, + this.K, jni.JObjectPtr ref, - ) : super.fromRef($K, const jni.JStringType(), ref); + ) : super.fromRef(K, const jni.JStringType(), ref); /// The type which includes information such as the signature of this class. - static $StringValuedMapType<K> type<K extends jni.JObject>( - jni.JObjType<K> $K, + static $StringValuedMapType<$K> type<$K extends jni.JObject>( + jni.JObjType<$K> K, ) { return $StringValuedMapType( - $K, + K, ); } @@ -1334,16 +1857,19 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - StringValuedMap(this.$K) - : super.fromRef($K, const jni.JStringType(), _ctor().object); + factory StringValuedMap({ + required jni.JObjType<$K> K, + }) { + return StringValuedMap.fromRef(K, _ctor().object); + } } -class $StringValuedMapType<K extends jni.JObject> - extends jni.JObjType<StringValuedMap<K>> { - final jni.JObjType<K> $K; +class $StringValuedMapType<$K extends jni.JObject> + extends jni.JObjType<StringValuedMap<$K>> { + final jni.JObjType<$K> K; const $StringValuedMapType( - this.$K, + this.K, ); @override @@ -1351,15 +1877,30 @@ r"Lcom/github/dart_lang/jnigen/generics/StringValuedMap;"; @override - StringValuedMap<K> fromRef(jni.JObjectPtr ref) => - StringValuedMap.fromRef($K, ref); + StringValuedMap<$K> fromRef(jni.JObjectPtr ref) => + StringValuedMap.fromRef(K, ref); + + @override + jni.JObjType get superType => $MyMapType(K, const jni.JStringType()); + + @override + final superCount = 2; + + @override + int get hashCode => Object.hash($StringValuedMapType, K); + + @override + bool operator ==(Object other) { + return other.runtimeType == $StringValuedMapType && + other is $StringValuedMapType && + K == other.K; + } } /// from: com.github.dart_lang.jnigen.annotations.JsonSerializable$Case class JsonSerializable_Case extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; JsonSerializable_Case.fromRef( jni.JObjectPtr ref, @@ -1374,9 +1915,10 @@ /// from: static public com.github.dart_lang.jnigen.annotations.JsonSerializable.Case[] values() /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JArray<JsonSerializable_Case> values() => - const jni.JArrayType($JsonSerializable_CaseType()) - .fromRef(_values().object); + static jni.JArray<JsonSerializable_Case> values() { + return const jni.JArrayType($JsonSerializable_CaseType()) + .fromRef(_values().object); + } static final _valueOf = jniLookup< ffi.NativeFunction< @@ -1386,9 +1928,12 @@ /// from: static public com.github.dart_lang.jnigen.annotations.JsonSerializable.Case valueOf(java.lang.String name) /// The returned object must be deleted after use, by calling the `delete` method. - static JsonSerializable_Case valueOf(jni.JString name) => - const $JsonSerializable_CaseType() - .fromRef(_valueOf(name.reference).object); + static JsonSerializable_Case valueOf( + jni.JString name, + ) { + return const $JsonSerializable_CaseType() + .fromRef(_valueOf(name.reference).object); + } } class $JsonSerializable_CaseType extends jni.JObjType<JsonSerializable_Case> { @@ -1401,13 +1946,27 @@ @override JsonSerializable_Case fromRef(jni.JObjectPtr ref) => JsonSerializable_Case.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($JsonSerializable_CaseType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $JsonSerializable_CaseType && + other is $JsonSerializable_CaseType; + } } /// from: com.github.dart_lang.jnigen.annotations.MyDataClass class MyDataClass extends jni.JObject { - late final jni.JObjType? _$type; @override - jni.JObjType get $type => _$type ??= type; + late final jni.JObjType $type = type; MyDataClass.fromRef( jni.JObjectPtr ref, @@ -1421,7 +1980,9 @@ /// from: public void <init>() /// The returned object must be deleted after use, by calling the `delete` method. - MyDataClass() : super.fromRef(_ctor().object); + factory MyDataClass() { + return MyDataClass.fromRef(_ctor().object); + } } class $MyDataClassType extends jni.JObjType<MyDataClass> { @@ -1433,4 +1994,18 @@ @override MyDataClass fromRef(jni.JObjectPtr ref) => MyDataClass.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($MyDataClassType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $MyDataClassType && other is $MyDataClassType; + } }
diff --git a/pkgs/jnigen/test/simple_package_test/src/simple_package.c b/pkgs/jnigen/test/simple_package_test/src/simple_package.c index e5937df..0e85ae9 100644 --- a/pkgs/jnigen/test/simple_package_test/src/simple_package.c +++ b/pkgs/jnigen/test/simple_package_test/src/simple_package.c
@@ -1102,6 +1102,97 @@ .exception = check_exception()}; } +jmethodID _m_MyStack__fromArray = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__fromArray(jobject arr) { + load_env(); + load_class_gr(&_c_MyStack, "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_MyStack, &_m_MyStack__fromArray, "fromArray", + "([Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;"); + if (_m_MyStack__fromArray == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_MyStack, _m_MyStack__fromArray, arr); + return (JniResult){.result = {.l = to_global_ref(_result)}, + .exception = check_exception()}; +} + +jmethodID _m_MyStack__fromArrayOfArrayOfGrandParents = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__fromArrayOfArrayOfGrandParents(jobject arr) { + load_env(); + load_class_gr(&_c_MyStack, "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_MyStack, &_m_MyStack__fromArrayOfArrayOfGrandParents, + "fromArrayOfArrayOfGrandParents", + "([[Lcom/github/dart_lang/jnigen/generics/GrandParent;)Lcom/github/" + "dart_lang/jnigen/generics/MyStack;"); + if (_m_MyStack__fromArrayOfArrayOfGrandParents == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_MyStack, _m_MyStack__fromArrayOfArrayOfGrandParents, arr); + return (JniResult){.result = {.l = to_global_ref(_result)}, + .exception = check_exception()}; +} + +jmethodID _m_MyStack__of = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__of() { + load_env(); + load_class_gr(&_c_MyStack, "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_MyStack, &_m_MyStack__of, "of", + "()Lcom/github/dart_lang/jnigen/generics/MyStack;"); + if (_m_MyStack__of == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_MyStack, _m_MyStack__of); + return (JniResult){.result = {.l = to_global_ref(_result)}, + .exception = check_exception()}; +} + +jmethodID _m_MyStack__of1 = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__of1(jobject obj) { + load_env(); + load_class_gr(&_c_MyStack, "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_MyStack, &_m_MyStack__of1, "of", + "(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;"); + if (_m_MyStack__of1 == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_MyStack, + _m_MyStack__of1, obj); + return (JniResult){.result = {.l = to_global_ref(_result)}, + .exception = check_exception()}; +} + +jmethodID _m_MyStack__of2 = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__of2(jobject obj, jobject obj2) { + load_env(); + load_class_gr(&_c_MyStack, "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_MyStack, &_m_MyStack__of2, "of", + "(Ljava/lang/Object;Ljava/lang/Object;)Lcom/github/" + "dart_lang/jnigen/generics/MyStack;"); + if (_m_MyStack__of2 == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_MyStack, _m_MyStack__of2, obj, obj2); + return (JniResult){.result = {.l = to_global_ref(_result)}, + .exception = check_exception()}; +} + jmethodID _m_MyStack__push = NULL; FFI_PLUGIN_EXPORT JniResult MyStack__push(jobject self_, jobject item) { @@ -1131,6 +1222,20 @@ .exception = check_exception()}; } +jmethodID _m_MyStack__size = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__size(jobject self_) { + load_env(); + load_class_gr(&_c_MyStack, "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyStack, &_m_MyStack__size, "size", "()I"); + if (_m_MyStack__size == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod(jniEnv, self_, _m_MyStack__size); + return (JniResult){.result = {.i = _result}, .exception = check_exception()}; +} + // com.github.dart_lang.jnigen.generics.StringKeyedMap jclass _c_StringKeyedMap = NULL; @@ -1151,6 +1256,26 @@ .exception = check_exception()}; } +// com.github.dart_lang.jnigen.generics.StringMap +jclass _c_StringMap = NULL; + +jmethodID _m_StringMap__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult StringMap__ctor() { + load_env(); + load_class_gr(&_c_StringMap, + "com/github/dart_lang/jnigen/generics/StringMap"); + if (_c_StringMap == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + load_method(_c_StringMap, &_m_StringMap__ctor, "<init>", "()V"); + if (_m_StringMap__ctor == NULL) + return (JniResult){.result = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_StringMap, _m_StringMap__ctor); + return (JniResult){.result = {.l = to_global_ref(_result)}, + .exception = check_exception()}; +} + // com.github.dart_lang.jnigen.generics.StringStack jclass _c_StringStack = NULL;