[jnigen] Stress tests and a few runtime fixes (https://github.com/dart-lang/jnigen/issues/264) * Generate and compare both types of bindings * Add load tests * Add test cases against exception throwing * add to_global_ref_result function to dartjni.h * Fix field getter double call in certain cases
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 035466b..aa8b684 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml
@@ -45,11 +45,14 @@ - id: install name: Install dependencies run: dart pub get + - name: install dependencies for android test runner + run: flutter pub get + working-directory: ./pkgs/jnigen/android_test_runner - name: Check formatting run: dart format --output=none --set-exit-if-changed . if: always() && steps.install.outcome == 'success' - name: Analyze code - run: dart analyze --fatal-infos + run: flutter analyze --fatal-infos if: always() && steps.install.outcome == 'success' test_jnigen: @@ -94,6 +97,8 @@ working-directory: ./pkgs/jnigen/java - name: Build summarizer run: dart run jnigen:setup + - name: Generate runtime tests + run: dart run tool/generate_runtime_tests.dart - name: Run VM tests run: dart test --test-randomize-ordering-seed random - name: Install coverage @@ -247,6 +252,8 @@ working-directory: ./pkgs/jnigen/example/notification_plugin/example - name: Build summarizer run: dart run jnigen:setup + - name: Generate runtime tests + run: dart run tool/generate_runtime_tests.dart - name: Run tests run: dart test --test-randomize-ordering-seed random @@ -294,8 +301,12 @@ java-version: '11' - run: git config --global core.autocrlf true - run: dart pub get - - run: dart run jnigen:setup - - run: dart test --test-randomize-ordering-seed random + - name: Build summarizer + run: dart run jnigen:setup + - name: Generate runtime tests + run: dart run tool/generate_runtime_tests.dart + - name: Run tests + run: dart test --test-randomize-ordering-seed random build_jni_example_linux: runs-on: ubuntu-latest
diff --git a/pkgs/jni/bin/setup.dart b/pkgs/jni/bin/setup.dart index 3f5bb79..12ee6f9 100644 --- a/pkgs/jni/bin/setup.dart +++ b/pkgs/jni/bin/setup.dart
@@ -35,7 +35,7 @@ final cmd = "$exec ${args.join(" ")}"; stderr.writeln("+ [$workingDir] $cmd"); - int exitCode; + int status; if (options.verbose) { final process = await Process.start( exec, args, @@ -44,13 +44,17 @@ // without `runInShell`, sometimes cmake doesn't run on windows. runInShell: true, ); - exitCode = await process.exitCode; + status = await process.exitCode; + if (status != 0) { + exitCode = status; + } } else { // ProcessStartMode.normal sometimes hangs on windows. No idea why. final process = await Process.run(exec, args, runInShell: true, workingDirectory: workingDir); - exitCode = process.exitCode; - if (exitCode != 0) { + status = process.exitCode; + if (status != 0) { + exitCode = status; var out = process.stdout; var err = process.stderr; if (stdout.supportsAnsiEscapes) { @@ -61,8 +65,8 @@ stderr.writeln(err); } } - if (exitCode != 0) { - stderr.writeln("Command exited with $exitCode."); + if (status != 0) { + stderr.writeln('Command exited with status code $status'); } }
diff --git a/pkgs/jni/dart_test.yaml b/pkgs/jni/dart_test.yaml new file mode 100644 index 0000000..361ada4 --- /dev/null +++ b/pkgs/jni/dart_test.yaml
@@ -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. + +tags: + load_test: + timeout: 10x
diff --git a/pkgs/jni/example/integration_test/on_device_jni_test.dart b/pkgs/jni/example/integration_test/on_device_jni_test.dart index 769ae6b..27be719 100644 --- a/pkgs/jni/example/integration_test/on_device_jni_test.dart +++ b/pkgs/jni/example/integration_test/on_device_jni_test.dart
@@ -9,6 +9,7 @@ import '../../test/jobject_test.dart' as jobject_test; import '../../test/jarray_test.dart' as jarray_test; import '../../test/type_test.dart' as type_test; +import '../../test/load_test.dart' as load_test; void integrationTestRunner(String description, void Function() testCallback) { testWidgets(description, (widgetTester) async => testCallback()); @@ -21,6 +22,7 @@ jobject_test.run, jarray_test.run, type_test.run, + load_test.run, ]; for (var testSuite in testSuites) { testSuite(testRunner: integrationTestRunner);
diff --git a/pkgs/jni/lib/src/jarray.dart b/pkgs/jni/lib/src/jarray.dart index 8b0aead..c095da7 100644 --- a/pkgs/jni/lib/src/jarray.dart +++ b/pkgs/jni/lib/src/jarray.dart
@@ -56,14 +56,14 @@ final clazz = (type as JObjType).getClass(); final array = JArray<E>.fromRef( type, - _accessors.newObjectArray(length, clazz.reference, nullptr).checkedRef, + _accessors.newObjectArray(length, clazz.reference, nullptr).object, ); clazz.delete(); return array; } return JArray.fromRef( type, - _accessors.newPrimitiveArray(length, type._type).checkedRef, + _accessors.newPrimitiveArray(length, type._type).object, ); } @@ -76,9 +76,7 @@ final clazz = fill.getClass(); final array = JArray<E>.fromRef( fill.$type as JObjType<E>, - _accessors - .newObjectArray(length, clazz.reference, fill.reference) - .checkedRef, + _accessors.newObjectArray(length, clazz.reference, fill.reference).object, ); clazz.delete(); return array;
diff --git a/pkgs/jni/lib/src/third_party/global_env_extensions.dart b/pkgs/jni/lib/src/third_party/global_env_extensions.dart index 2d2a028..2fe4001 100644 --- a/pkgs/jni/lib/src/third_party/global_env_extensions.dart +++ b/pkgs/jni/lib/src/third_party/global_env_extensions.dart
@@ -1467,14 +1467,14 @@ _newObject(cls, ctor, args); late final _newPrimitiveArray = ptr.ref.newPrimitiveArray - .asFunction<JniPointerResult Function(int length, int type)>(); - JniPointerResult newPrimitiveArray(int length, int type) => + .asFunction<JniResult Function(int length, int type)>(); + JniResult newPrimitiveArray(int length, int type) => _newPrimitiveArray(length, type); late final _newObjectArray = ptr.ref.newObjectArray.asFunction< - JniPointerResult Function( + JniResult Function( int length, JClassPtr elementClass, JObjectPtr initialElement)>(); - JniPointerResult newObjectArray( + JniResult newObjectArray( int length, JClassPtr elementClass, JObjectPtr initialElement) => _newObjectArray(length, elementClass, initialElement);
diff --git a/pkgs/jni/lib/src/third_party/jni_bindings_generated.dart b/pkgs/jni/lib/src/third_party/jni_bindings_generated.dart index 6d54cda..7cb2bdb 100644 --- a/pkgs/jni/lib/src/third_party/jni_bindings_generated.dart +++ b/pkgs/jni/lib/src/third_party/jni_bindings_generated.dart
@@ -343,12 +343,12 @@ external ffi.Pointer< ffi.NativeFunction< - JniPointerResult Function(JSizeMarker length, ffi.Int type)>> + JniResult Function(JSizeMarker length, ffi.Int type)>> newPrimitiveArray; external ffi.Pointer< ffi.NativeFunction< - JniPointerResult Function(JSizeMarker length, JClassPtr elementClass, + JniResult Function(JSizeMarker length, JClassPtr elementClass, JObjectPtr initialElement)>> newObjectArray; external ffi.Pointer<
diff --git a/pkgs/jni/src/dartjni.c b/pkgs/jni/src/dartjni.c index 7346fef..19a32eb 100644 --- a/pkgs/jni/src/dartjni.c +++ b/pkgs/jni/src/dartjni.c
@@ -200,10 +200,7 @@ return result; } -typedef void* (*MemberGetter)(JNIEnv* env, - jclass* clazz, - char* name, - char* sig); +typedef void* (*MemberGetter)(JNIEnv* env, jclass clazz, char* name, char* sig); static inline JniPointerResult _getId(MemberGetter getter, jclass cls, @@ -264,15 +261,17 @@ result.d = (*jniEnv)->CallDoubleMethodA(jniEnv, obj, fieldID, args); break; case objectType: - result.l = to_global_ref( - (*jniEnv)->CallObjectMethodA(jniEnv, obj, fieldID, args)); + result.l = (*jniEnv)->CallObjectMethodA(jniEnv, obj, fieldID, args); break; case voidType: (*jniEnv)->CallVoidMethodA(jniEnv, obj, fieldID, args); break; } - JniResult jniResult = {.value = result, .exception = NULL}; - jniResult.exception = check_exception(); + jthrowable exception = check_exception(); + if (callType == objectType && exception == NULL) { + result.l = to_global_ref(result.l); + } + JniResult jniResult = {.value = result, .exception = exception}; return jniResult; } @@ -311,15 +310,18 @@ (*jniEnv)->CallStaticDoubleMethodA(jniEnv, cls, methodID, args); break; case objectType: - result.l = to_global_ref( - (*jniEnv)->CallStaticObjectMethodA(jniEnv, cls, methodID, args)); + result.l = + (*jniEnv)->CallStaticObjectMethodA(jniEnv, cls, methodID, args); break; case voidType: (*jniEnv)->CallStaticVoidMethodA(jniEnv, cls, methodID, args); break; } - JniResult jniResult = {.value = result, .exception = NULL}; - jniResult.exception = check_exception(); + jthrowable exception = check_exception(); + if (callType == objectType && exception == NULL) { + result.l = to_global_ref(result.l); + } + JniResult jniResult = {.value = result, .exception = exception}; return jniResult; } @@ -352,14 +354,17 @@ result.d = (*jniEnv)->GetDoubleField(jniEnv, obj, fieldID); break; case objectType: - result.l = to_global_ref((*jniEnv)->GetObjectField(jniEnv, obj, fieldID)); + result.l = (*jniEnv)->GetObjectField(jniEnv, obj, fieldID); break; case voidType: // This error should have been handled in Dart. break; } - JniResult jniResult = {.value = result, .exception = NULL}; - jniResult.exception = check_exception(); + jthrowable exception = check_exception(); + if (callType == objectType && exception == NULL) { + result.l = to_global_ref(result.l); + } + JniResult jniResult = {.value = result, .exception = exception}; return jniResult; } @@ -393,8 +398,7 @@ result.d = (*jniEnv)->GetStaticDoubleField(jniEnv, cls, fieldID); break; case objectType: - result.l = - to_global_ref((*jniEnv)->GetStaticObjectField(jniEnv, cls, fieldID)); + result.l = (*jniEnv)->GetStaticObjectField(jniEnv, cls, fieldID); break; case voidType: // This error should have been handled in dart. @@ -402,47 +406,47 @@ // or throw exception in Dart using Dart's C API. break; } - JniResult jniResult = {.value = result, .exception = NULL}; - jniResult.exception = check_exception(); + jthrowable exception = check_exception(); + if (callType == objectType && exception == NULL) { + result.l = to_global_ref(result.l); + } + JniResult jniResult = {.value = result, .exception = exception}; return jniResult; } JniResult newObject(jclass cls, jmethodID ctor, jvalue* args) { attach_thread(); - JniResult jniResult; - jniResult.value.l = - to_global_ref((*jniEnv)->NewObjectA(jniEnv, cls, ctor, args)); - jniResult.exception = check_exception(); - return jniResult; + jobject result = (*jniEnv)->NewObjectA(jniEnv, cls, ctor, args); + return to_global_ref_result(result); } -JniPointerResult newPrimitiveArray(jsize length, int type) { +JniResult newPrimitiveArray(jsize length, int type) { attach_thread(); - void* pointer; + jarray array; switch (type) { case booleanType: - pointer = (*jniEnv)->NewBooleanArray(jniEnv, length); + array = (*jniEnv)->NewBooleanArray(jniEnv, length); break; case byteType: - pointer = (*jniEnv)->NewByteArray(jniEnv, length); + array = (*jniEnv)->NewByteArray(jniEnv, length); break; case shortType: - pointer = (*jniEnv)->NewShortArray(jniEnv, length); + array = (*jniEnv)->NewShortArray(jniEnv, length); break; case charType: - pointer = (*jniEnv)->NewCharArray(jniEnv, length); + array = (*jniEnv)->NewCharArray(jniEnv, length); break; case intType: - pointer = (*jniEnv)->NewIntArray(jniEnv, length); + array = (*jniEnv)->NewIntArray(jniEnv, length); break; case longType: - pointer = (*jniEnv)->NewLongArray(jniEnv, length); + array = (*jniEnv)->NewLongArray(jniEnv, length); break; case floatType: - pointer = (*jniEnv)->NewFloatArray(jniEnv, length); + array = (*jniEnv)->NewFloatArray(jniEnv, length); break; case doubleType: - pointer = (*jniEnv)->NewDoubleArray(jniEnv, length); + array = (*jniEnv)->NewDoubleArray(jniEnv, length); break; case objectType: case voidType: @@ -451,21 +455,16 @@ // or throw exception in Dart using Dart's C API. break; } - JniPointerResult result = {.value = to_global_ref(pointer), - .exception = NULL}; - result.exception = check_exception(); - return result; + return to_global_ref_result(array); } -JniPointerResult newObjectArray(jsize length, - jclass elementClass, - jobject initialElement) { +JniResult newObjectArray(jsize length, + jclass elementClass, + jobject initialElement) { attach_thread(); - jarray array = to_global_ref( - (*jniEnv)->NewObjectArray(jniEnv, length, elementClass, initialElement)); - JniPointerResult result = {.value = array, .exception = NULL}; - result.exception = check_exception(); - return result; + jarray array = + (*jniEnv)->NewObjectArray(jniEnv, length, elementClass, initialElement); + return to_global_ref_result(array); } JniResult getArrayElement(jarray array, int index, int type) { @@ -498,17 +497,19 @@ (*jniEnv)->GetDoubleArrayRegion(jniEnv, array, index, 1, &value.d); break; case objectType: - value.l = - to_global_ref((*jniEnv)->GetObjectArrayElement(jniEnv, array, index)); + value.l = (*jniEnv)->GetObjectArrayElement(jniEnv, array, index); case voidType: // This error should have been handled in dart. // is there a way to mark this as unreachable? // or throw exception in Dart using Dart's C API. break; } - result.value = value; - result.exception = check_exception(); - return result; + jthrowable exception = check_exception(); + if (type == objectType && exception == NULL) { + value.l = to_global_ref(value.l); + } + JniResult jniResult = {.value = value, .exception = exception}; + return jniResult; } JniExceptionDetails getExceptionDetails(jthrowable exception) { @@ -595,6 +596,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PortContinuation, _m_PortContinuation__ctor, j); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + jthrowable exception = check_exception(); + if (exception == NULL) { + _result = to_global_ref(_result); + } + return (JniResult){.value = {.l = _result}, .exception = check_exception()}; }
diff --git a/pkgs/jni/src/dartjni.h b/pkgs/jni/src/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jni/src/dartjni.h +++ b/pkgs/jni/src/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jni/test/load_test.dart b/pkgs/jni/test/load_test.dart new file mode 100644 index 0000000..162b3e9 --- /dev/null +++ b/pkgs/jni/test/load_test.dart
@@ -0,0 +1,134 @@ +// Copyright (c) 2022, 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. + +@Tags(['load_test']) + +import 'dart:io'; +import 'dart:ffi'; +import 'dart:math'; + +import 'package:ffi/ffi.dart'; +import 'package:test/test.dart'; + +import 'package:jni/jni.dart'; + +import 'test_util/test_util.dart'; + +const maxLongInJava = 9223372036854775807; + +/// Taken from +/// https://github.com/dart-lang/ffigen/blob/master/test/native_objc_test/automated_ref_count_test.dart +final executeInternalCommand = DynamicLibrary.process().lookupFunction< + Void Function(Pointer<Char>, Pointer<Void>), + void Function(Pointer<Char>, Pointer<Void>)>('Dart_ExecuteInternalCommand'); + +void doGC() { + final gcNow = "gc-now".toNativeUtf8(); + executeInternalCommand(gcNow.cast(), nullptr); + calloc.free(gcNow); +} + +void main() { + if (!Platform.isAndroid) { + checkDylibIsUpToDate(); + Jni.spawnIfNotExists(dylibDir: "build/jni_libs", jvmOptions: ["-Xmx128m"]); + } + run(testRunner: test); +} + +const k4 = 4 * 1024; +const k64 = 64 * 1024; +const k256 = 256 * 1024; + +const secureRandomSeedBound = 4294967296; + +JObject getSystemOut() => Jni.retrieveStaticField<JObject>( + 'System', + 'out', + 'Ljava/io/PrintStream;', + ); + +final random = Random.secure(); + +JObject newRandom() => Jni.newInstance( + "java/util/Random", + "(J)V", + [random.nextInt(secureRandomSeedBound)], + ); + +void run({required TestRunnerCallback testRunner}) { + testRunner('Test 4K refs can be created in a row', () { + final list = <JObject>[]; + for (int i = 0; i < k4; i++) { + list.add(newRandom()); + } + for (final jobject in list) { + jobject.delete(); + } + }); + + testRunner('Create and delete 256K references in a loop using arena', () { + for (int i = 0; i < k256; i++) { + using((arena) { + final random = newRandom()..deletedIn(arena); + // The actual expect here does not matter. I am just being paranoid + // against assigning to `_` because compiler may optimize it. (It has + // side effect of calling FFI but still.) + expect(random.reference, isNot(nullptr)); + }); + } + }); + + testRunner('Create & delete 256K references in a loop (explicit delete)', () { + for (int i = 0; i < k256; i++) { + final random = newRandom(); + expect(random.reference, isNot(nullptr)); + random.delete(); + } + }); + + testRunner('Create and delete 64K references, in batches of 256', () { + for (int i = 0; i < 64 * 4; i++) { + using((arena) { + for (int i = 0; i < 256; i++) { + final r = newRandom()..deletedIn(arena); + expect(r.reference, isNot(nullptr)); + } + }); + } + }); + + // We don't have a direct way to check if something creates JNI references. + // So we are checking if we can run this for large number of times. + testRunner('Verify a call returning primitive can be run any times', () { + final random = newRandom(); + final nextInt = random.getMethodID("nextInt", "()I"); + for (int i = 0; i < k256; i++) { + final rInt = random.callMethod<int>(nextInt, []); + expect(rInt, isA<int>()); + } + }); + + void testRefValidityAfterGC(int delayInSeconds) { + testRunner('Validate reference after GC & ${delayInSeconds}s sleep', () { + final random = newRandom(); + doGC(); + sleep(Duration(seconds: delayInSeconds)); + expect( + random.callMethodByName<int>("nextInt", "()I", []), + isA<int>(), + ); + expect( + Jni.env.GetObjectRefType(random.reference), + equals(JObjectRefType.JNIGlobalRefType), + ); + }); + } + + // Dart_ExecuteInternalCommand doesn't exist in Android. + if (!Platform.isAndroid) { + testRefValidityAfterGC(1); + testRefValidityAfterGC(10); + } +}
diff --git a/pkgs/jnigen/android_test_runner/.gitignore b/pkgs/jnigen/android_test_runner/.gitignore new file mode 100644 index 0000000..24476c5 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/.gitignore
@@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release
diff --git a/pkgs/jnigen/android_test_runner/.metadata b/pkgs/jnigen/android_test_runner/.metadata new file mode 100644 index 0000000..957ea81 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/.metadata
@@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: f72efea43c3013323d1b95cff571f3c1caa37583 + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f72efea43c3013323d1b95cff571f3c1caa37583 + base_revision: f72efea43c3013323d1b95cff571f3c1caa37583 + - platform: android + create_revision: f72efea43c3013323d1b95cff571f3c1caa37583 + base_revision: f72efea43c3013323d1b95cff571f3c1caa37583 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/pkgs/jnigen/android_test_runner/README.md b/pkgs/jnigen/android_test_runner/README.md new file mode 100644 index 0000000..cd85e19 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/README.md
@@ -0,0 +1,17 @@ +## What's this? + +This is Flutter app project which serves as a skeleton for running binding runtime tests on android, using Flutter's integration testing mechanism. + +## How to run tests? + +Generate runtime test files, by running the following in parent (jnigen) directory. + +```bash +dart run tool/generate_runtime_tests.dart +``` + +This will generate integration_test/runtime_test.dart in this directory, along with other runtime tests for `jnigen`. This can be run with regular integration test mechanism. + +```bash +flutter test integration_test/ +``` \ No newline at end of file
diff --git a/pkgs/jnigen/android_test_runner/analysis_options.yaml b/pkgs/jnigen/android_test_runner/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/pkgs/jnigen/android_test_runner/analysis_options.yaml
@@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options
diff --git a/pkgs/jnigen/android_test_runner/android/.gitignore b/pkgs/jnigen/android_test_runner/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/.gitignore
@@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks
diff --git a/pkgs/jnigen/android_test_runner/android/app/.gitignore b/pkgs/jnigen/android_test_runner/android/app/.gitignore new file mode 100644 index 0000000..df2fa17 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/.gitignore
@@ -0,0 +1 @@ +.cxx \ No newline at end of file
diff --git a/pkgs/jnigen/android_test_runner/android/app/CMakeLists.txt b/pkgs/jnigen/android_test_runner/android/app/CMakeLists.txt new file mode 100644 index 0000000..7bc2474 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/CMakeLists.txt
@@ -0,0 +1,10 @@ +## Parent CMake for Android native build target. This will build +## all C bindings from tests. + +cmake_minimum_required(VERSION 3.10) + +project(simple_package VERSION 0.0.1 LANGUAGES C) + +add_subdirectory(../../../test/jackson_core_test/third_party/c_based/c_bindings jackson_core_test_build) +add_subdirectory(../../../test/simple_package_test/c_based/c_bindings simple_package_test_build) +add_subdirectory(../../../test/kotlin_test/c_based/c_bindings kotlin_test_build)
diff --git a/pkgs/jnigen/android_test_runner/android/app/build.gradle b/pkgs/jnigen/android_test_runner/android/app/build.gradle new file mode 100644 index 0000000..e0c777f --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/build.gradle
@@ -0,0 +1,79 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + main.java.srcDirs += '../../../test/simple_package_test/java' + main.java.srcDirs += '../../../test/kotlin_test/kotlin/src/main' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.github.dart_lang.jnigen.android_integration_test" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } + externalNativeBuild { + cmake { + path 'CMakeLists.txt' + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "com.fasterxml.jackson.core:jackson-core:2.13.4" +}
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/debug/AndroidManifest.xml b/pkgs/jnigen/android_test_runner/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..fc7efb6 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,8 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.github.dart_lang.jnigen.android_integration_test"> + <!-- The INTERNET permission is required for development. Specifically, + the Flutter tool needs it to communicate with the running application + to allow setting breakpoints, to provide hot reload, etc. + --> + <uses-permission android:name="android.permission.INTERNET"/> +</manifest>
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/AndroidManifest.xml b/pkgs/jnigen/android_test_runner/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..84209fb --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,34 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.github.dart_lang.jnigen.android_integration_test"> + <application + android:label="android_integration_test" + android:name="${applicationName}" + android:icon="@mipmap/ic_launcher"> + <activity + android:name=".MainActivity" + android:exported="true" + android:launchMode="singleTop" + android:theme="@style/LaunchTheme" + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" + android:hardwareAccelerated="true" + android:windowSoftInputMode="adjustResize"> + <!-- Specifies an Android theme to apply to this Activity as soon as + the Android process has started. This theme is visible to the user + while the Flutter UI initializes. After that, this theme continues + to determine the Window background behind the Flutter UI. --> + <meta-data + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + <!-- Don't delete the meta-data below. + This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> + <meta-data + android:name="flutterEmbedding" + android:value="2" /> + </application> +</manifest>
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/kotlin/com/github/dart_lang/jnigen/android_integration_test/MainActivity.kt b/pkgs/jnigen/android_test_runner/android/app/src/main/kotlin/com/github/dart_lang/jnigen/android_integration_test/MainActivity.kt new file mode 100644 index 0000000..5197ccc --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/kotlin/com/github/dart_lang/jnigen/android_integration_test/MainActivity.kt
@@ -0,0 +1,6 @@ +package com.github.dart_lang.jnigen.android_integration_test + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +}
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/drawable-v21/launch_background.xml b/pkgs/jnigen/android_test_runner/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Modify this file to customize your launch splash screen --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="?android:colorBackground" /> + + <!-- You can insert your own image assets here --> + <!-- <item> + <bitmap + android:gravity="center" + android:src="@mipmap/launch_image" /> + </item> --> +</layer-list>
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/drawable/launch_background.xml b/pkgs/jnigen/android_test_runner/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Modify this file to customize your launch splash screen --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@android:color/white" /> + + <!-- You can insert your own image assets here --> + <!-- <item> + <bitmap + android:gravity="center" + android:src="@mipmap/launch_image" /> + </item> --> +</layer-list>
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differ
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differ
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differ
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differ
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differ
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/values-night/styles.xml b/pkgs/jnigen/android_test_runner/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> + <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> + <!-- Show a splash screen on the activity. Automatically removed when + the Flutter engine draws its first frame --> + <item name="android:windowBackground">@drawable/launch_background</item> + </style> + <!-- Theme applied to the Android Window as soon as the process has started. + This theme determines the color of the Android Window while your + Flutter UI initializes, as well as behind your Flutter UI while its + running. + + This Theme is only used starting with V2 of Flutter's Android embedding. --> + <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> + <item name="android:windowBackground">?android:colorBackground</item> + </style> +</resources>
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/main/res/values/styles.xml b/pkgs/jnigen/android_test_runner/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> + <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> + <!-- Show a splash screen on the activity. Automatically removed when + the Flutter engine draws its first frame --> + <item name="android:windowBackground">@drawable/launch_background</item> + </style> + <!-- Theme applied to the Android Window as soon as the process has started. + This theme determines the color of the Android Window while your + Flutter UI initializes, as well as behind your Flutter UI while its + running. + + This Theme is only used starting with V2 of Flutter's Android embedding. --> + <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> + <item name="android:windowBackground">?android:colorBackground</item> + </style> +</resources>
diff --git a/pkgs/jnigen/android_test_runner/android/app/src/profile/AndroidManifest.xml b/pkgs/jnigen/android_test_runner/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..fc7efb6 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/app/src/profile/AndroidManifest.xml
@@ -0,0 +1,8 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.github.dart_lang.jnigen.android_integration_test"> + <!-- The INTERNET permission is required for development. Specifically, + the Flutter tool needs it to communicate with the running application + to allow setting breakpoints, to provide hot reload, etc. + --> + <uses-permission android:name="android.permission.INTERNET"/> +</manifest>
diff --git a/pkgs/jnigen/android_test_runner/android/build.gradle b/pkgs/jnigen/android_test_runner/android/build.gradle new file mode 100644 index 0000000..58a8c74 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/build.gradle
@@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.2.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +}
diff --git a/pkgs/jnigen/android_test_runner/android/gradle.properties b/pkgs/jnigen/android_test_runner/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/gradle.properties
@@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true
diff --git a/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..3c472b9 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
diff --git a/pkgs/jnigen/android_test_runner/android/settings.gradle b/pkgs/jnigen/android_test_runner/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/pkgs/jnigen/android_test_runner/android/settings.gradle
@@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/pkgs/jnigen/android_test_runner/integration_test/.gitignore b/pkgs/jnigen/android_test_runner/integration_test/.gitignore new file mode 100644 index 0000000..af7c365 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/integration_test/.gitignore
@@ -0,0 +1 @@ +runtime_test.dart \ No newline at end of file
diff --git a/pkgs/jnigen/android_test_runner/lib/main.dart b/pkgs/jnigen/android_test_runner/lib/main.dart new file mode 100644 index 0000000..8e88928 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/lib/main.dart
@@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: const MyHomePage(), + ); + } +} + +class MyHomePage extends StatelessWidget { + const MyHomePage({super.key}); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("Integration test runner"), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const <Widget>[ + Text( + 'This app should be run as flutter integration test', + ), + ], + ), + ), + ); + } +}
diff --git a/pkgs/jnigen/android_test_runner/pubspec.yaml b/pkgs/jnigen/android_test_runner/pubspec.yaml new file mode 100644 index 0000000..a457e77 --- /dev/null +++ b/pkgs/jnigen/android_test_runner/pubspec.yaml
@@ -0,0 +1,94 @@ +name: android_integration_test +description: jnigen integration test runner for android +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=2.19.6 <3.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + jni: + path: ../../jni/ + ffi: any + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + test: any + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages
diff --git a/pkgs/jnigen/dart_test.yaml b/pkgs/jnigen/dart_test.yaml index 0fb13bc..fdd1587 100644 --- a/pkgs/jnigen/dart_test.yaml +++ b/pkgs/jnigen/dart_test.yaml
@@ -10,3 +10,5 @@ timeout: 2x summarizer_test: timeout: 1x + runtime_test: + timeout: 1x
diff --git a/pkgs/jnigen/example/in_app_java/src/android_utils/android_utils.c b/pkgs/jnigen/example/in_app_java/src/android_utils/android_utils.c index 0fef652..6cf0cf2 100644 --- a/pkgs/jnigen/example/in_app_java/src/android_utils/android_utils.c +++ b/pkgs/jnigen/example/in_app_java/src/android_utils/android_utils.c
@@ -55,8 +55,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_EmojiCompat, _m_EmojiCompat__init, context); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__init1 = NULL; @@ -74,8 +73,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_EmojiCompat, _m_EmojiCompat__init1, context, defaultFactory); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__init2 = NULL; @@ -92,8 +90,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_EmojiCompat, _m_EmojiCompat__init2, config); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__isConfigured = NULL; @@ -126,8 +123,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_EmojiCompat, _m_EmojiCompat__reset, config); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__reset1 = NULL; @@ -144,8 +140,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_EmojiCompat, _m_EmojiCompat__reset1, emojiCompat); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__skipDefaultConfigurationLookup = NULL; @@ -179,8 +174,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_EmojiCompat, _m_EmojiCompat__get0); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__load = NULL; @@ -426,8 +420,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat__process, charSequence); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__process1 = NULL; @@ -446,8 +439,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat__process1, charSequence, start, end); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__process2 = NULL; @@ -468,8 +460,7 @@ jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_EmojiCompat__process2, charSequence, start, end, maxEmojiCount); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__process3 = NULL; @@ -491,8 +482,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat__process3, charSequence, start, end, maxEmojiCount, replaceStrategy); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__getAssetSignature = NULL; @@ -508,8 +498,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat__getAssetSignature); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat__updateEditorInfo = NULL; @@ -546,8 +535,7 @@ jobject _result = (*jniEnv)->NewObject(jniEnv, _c_EmojiCompat_Config, _m_EmojiCompat_Config__ctor, metadataLoader); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__registerInitCallback = NULL; @@ -568,8 +556,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__registerInitCallback, initCallback); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__unregisterInitCallback = NULL; @@ -591,8 +578,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__unregisterInitCallback, initCallback); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setReplaceAll = NULL; @@ -609,8 +595,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setReplaceAll, replaceAll); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setUseEmojiAsDefaultStyle = NULL; @@ -632,8 +617,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setUseEmojiAsDefaultStyle, useEmojiAsDefaultStyle); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setUseEmojiAsDefaultStyle1 = NULL; @@ -656,8 +640,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setUseEmojiAsDefaultStyle1, useEmojiAsDefaultStyle, emojiAsDefaultStyleExceptions); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setEmojiSpanIndicatorEnabled = NULL; @@ -679,8 +662,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setEmojiSpanIndicatorEnabled, emojiSpanIndicatorEnabled); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setEmojiSpanIndicatorColor = NULL; @@ -700,8 +682,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setEmojiSpanIndicatorColor, color); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setMetadataLoadStrategy = NULL; @@ -721,8 +702,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setMetadataLoadStrategy, strategy); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setSpanFactory = NULL; @@ -741,8 +721,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setSpanFactory, factory); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__setGlyphChecker = NULL; @@ -762,8 +741,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__setGlyphChecker, glyphChecker); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_Config__getMetadataRepoLoader = NULL; @@ -782,8 +760,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_Config__getMetadataRepoLoader); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.EmojiCompat$MetadataRepoLoaderCallback @@ -806,8 +783,7 @@ jobject _result = (*jniEnv)->NewObject(jniEnv, _c_EmojiCompat_MetadataRepoLoaderCallback, _m_EmojiCompat_MetadataRepoLoaderCallback__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_MetadataRepoLoaderCallback__onLoaded = NULL; @@ -919,8 +895,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_EmojiCompat_InitCallback, _m_EmojiCompat_InitCallback__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_InitCallback__onInitialized = NULL; @@ -977,8 +952,7 @@ jobject _result = (*jniEnv)->NewObject(jniEnv, _c_EmojiCompat_DefaultSpanFactory, _m_EmojiCompat_DefaultSpanFactory__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_EmojiCompat_DefaultSpanFactory__createSpan = NULL; @@ -998,8 +972,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_DefaultSpanFactory__createSpan, rasterizer); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.EmojiCompat$SpanFactory @@ -1022,8 +995,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_EmojiCompat_SpanFactory__createSpan, rasterizer); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.DefaultEmojiCompatConfig @@ -1046,8 +1018,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_DefaultEmojiCompatConfig, _m_DefaultEmojiCompatConfig__create, context); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API28 @@ -1076,8 +1047,7 @@ jobject _result = (*jniEnv)->NewObject( jniEnv, _c_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID @@ -1109,8 +1079,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API28__getSigningSignatures1, packageManager, providerPackage); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper_API19 @@ -1139,8 +1108,7 @@ jobject _result = (*jniEnv)->NewObject( jniEnv, _c_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID @@ -1173,8 +1141,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19__queryIntentContentProviders, packageManager, intent, flags); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID @@ -1204,8 +1171,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper_API19__getProviderInfo, resolveInfo); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigHelper @@ -1230,8 +1196,7 @@ jobject _result = (*jniEnv)->NewObject( jniEnv, _c_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID @@ -1263,8 +1228,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper__getSigningSignatures, packageManager, providerPackage); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID @@ -1297,8 +1261,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper__queryIntentContentProviders, packageManager, intent, flags); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID @@ -1328,8 +1291,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigHelper__getProviderInfo, resolveInfo); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // androidx.emoji2.text.DefaultEmojiCompatConfig$DefaultEmojiCompatConfigFactory @@ -1359,8 +1321,7 @@ jniEnv, _c_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory__ctor, helper); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory__create = @@ -1388,8 +1349,7 @@ jniEnv, self_, _m_DefaultEmojiCompatConfig_DefaultEmojiCompatConfigFactory__create, context); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } // android.os.Build @@ -1406,8 +1366,7 @@ if (_m_Build__ctor == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Build, _m_Build__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_Build__getSerial = NULL; @@ -1423,8 +1382,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_Build, _m_Build__getSerial); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_Build__getFingerprintedPartitions = NULL; @@ -1440,8 +1398,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_Build, _m_Build__getFingerprintedPartitions); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_Build__getRadioVersion = NULL; @@ -1457,8 +1414,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_Build, _m_Build__getRadioVersion); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jfieldID _f_Build__BOARD = NULL; @@ -1469,9 +1425,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__BOARD, "BOARD", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__BOARD)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__BOARD); + return to_global_ref_result(_result); } jfieldID _f_Build__BOOTLOADER = NULL; @@ -1483,9 +1439,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__BOOTLOADER, "BOOTLOADER", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__BOOTLOADER)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__BOOTLOADER); + return to_global_ref_result(_result); } jfieldID _f_Build__BRAND = NULL; @@ -1496,9 +1452,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__BRAND, "BRAND", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__BRAND)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__BRAND); + return to_global_ref_result(_result); } jfieldID _f_Build__CPU_ABI = NULL; @@ -1510,9 +1466,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__CPU_ABI, "CPU_ABI", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__CPU_ABI)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__CPU_ABI); + return to_global_ref_result(_result); } jfieldID _f_Build__CPU_ABI2 = NULL; @@ -1524,9 +1480,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__CPU_ABI2, "CPU_ABI2", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__CPU_ABI2)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__CPU_ABI2); + return to_global_ref_result(_result); } jfieldID _f_Build__DEVICE = NULL; @@ -1538,9 +1494,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__DEVICE, "DEVICE", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__DEVICE)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__DEVICE); + return to_global_ref_result(_result); } jfieldID _f_Build__DISPLAY = NULL; @@ -1552,9 +1508,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__DISPLAY, "DISPLAY", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__DISPLAY)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__DISPLAY); + return to_global_ref_result(_result); } jfieldID _f_Build__FINGERPRINT = NULL; @@ -1566,9 +1522,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__FINGERPRINT, "FINGERPRINT", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__FINGERPRINT)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__FINGERPRINT); + return to_global_ref_result(_result); } jfieldID _f_Build__HARDWARE = NULL; @@ -1580,9 +1536,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__HARDWARE, "HARDWARE", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__HARDWARE)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__HARDWARE); + return to_global_ref_result(_result); } jfieldID _f_Build__HOST = NULL; @@ -1593,9 +1549,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__HOST, "HOST", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__HOST)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__HOST); + return to_global_ref_result(_result); } jfieldID _f_Build__ID = NULL; @@ -1606,9 +1562,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__ID, "ID", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__ID)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__ID); + return to_global_ref_result(_result); } jfieldID _f_Build__MANUFACTURER = NULL; @@ -1620,9 +1576,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__MANUFACTURER, "MANUFACTURER", "Ljava/lang/String;"); - jobject _result = to_global_ref((*jniEnv)->GetStaticObjectField( - jniEnv, _c_Build, _f_Build__MANUFACTURER)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__MANUFACTURER); + return to_global_ref_result(_result); } jfieldID _f_Build__MODEL = NULL; @@ -1633,9 +1589,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__MODEL, "MODEL", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__MODEL)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__MODEL); + return to_global_ref_result(_result); } jfieldID _f_Build__ODM_SKU = NULL; @@ -1647,9 +1603,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__ODM_SKU, "ODM_SKU", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__ODM_SKU)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__ODM_SKU); + return to_global_ref_result(_result); } jfieldID _f_Build__PRODUCT = NULL; @@ -1661,9 +1617,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__PRODUCT, "PRODUCT", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__PRODUCT)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__PRODUCT); + return to_global_ref_result(_result); } jfieldID _f_Build__RADIO = NULL; @@ -1674,9 +1630,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__RADIO, "RADIO", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__RADIO)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__RADIO); + return to_global_ref_result(_result); } jfieldID _f_Build__SERIAL = NULL; @@ -1688,9 +1644,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SERIAL, "SERIAL", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__SERIAL)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__SERIAL); + return to_global_ref_result(_result); } jfieldID _f_Build__SKU = NULL; @@ -1701,9 +1657,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SKU, "SKU", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__SKU)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__SKU); + return to_global_ref_result(_result); } jfieldID _f_Build__SOC_MANUFACTURER = NULL; @@ -1715,9 +1671,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SOC_MANUFACTURER, "SOC_MANUFACTURER", "Ljava/lang/String;"); - jobject _result = to_global_ref((*jniEnv)->GetStaticObjectField( - jniEnv, _c_Build, _f_Build__SOC_MANUFACTURER)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, + _f_Build__SOC_MANUFACTURER); + return to_global_ref_result(_result); } jfieldID _f_Build__SOC_MODEL = NULL; @@ -1729,9 +1685,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SOC_MODEL, "SOC_MODEL", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__SOC_MODEL)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__SOC_MODEL); + return to_global_ref_result(_result); } jfieldID _f_Build__SUPPORTED_32_BIT_ABIS = NULL; @@ -1743,9 +1699,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SUPPORTED_32_BIT_ABIS, "SUPPORTED_32_BIT_ABIS", "[Ljava/lang/String;"); - jobject _result = to_global_ref((*jniEnv)->GetStaticObjectField( - jniEnv, _c_Build, _f_Build__SUPPORTED_32_BIT_ABIS)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = (*jniEnv)->GetStaticObjectField( + jniEnv, _c_Build, _f_Build__SUPPORTED_32_BIT_ABIS); + return to_global_ref_result(_result); } jfieldID _f_Build__SUPPORTED_64_BIT_ABIS = NULL; @@ -1757,9 +1713,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SUPPORTED_64_BIT_ABIS, "SUPPORTED_64_BIT_ABIS", "[Ljava/lang/String;"); - jobject _result = to_global_ref((*jniEnv)->GetStaticObjectField( - jniEnv, _c_Build, _f_Build__SUPPORTED_64_BIT_ABIS)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = (*jniEnv)->GetStaticObjectField( + jniEnv, _c_Build, _f_Build__SUPPORTED_64_BIT_ABIS); + return to_global_ref_result(_result); } jfieldID _f_Build__SUPPORTED_ABIS = NULL; @@ -1771,9 +1727,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__SUPPORTED_ABIS, "SUPPORTED_ABIS", "[Ljava/lang/String;"); - jobject _result = to_global_ref((*jniEnv)->GetStaticObjectField( - jniEnv, _c_Build, _f_Build__SUPPORTED_ABIS)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, + _f_Build__SUPPORTED_ABIS); + return to_global_ref_result(_result); } jfieldID _f_Build__TAGS = NULL; @@ -1784,9 +1740,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__TAGS, "TAGS", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__TAGS)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__TAGS); + return to_global_ref_result(_result); } jfieldID _f_Build__TIME = NULL; @@ -1810,9 +1766,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__TYPE, "TYPE", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__TYPE)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__TYPE); + return to_global_ref_result(_result); } jfieldID _f_Build__USER = NULL; @@ -1823,9 +1779,9 @@ if (_c_Build == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_static_field(_c_Build, &_f_Build__USER, "USER", "Ljava/lang/String;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__USER)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Build, _f_Build__USER); + return to_global_ref_result(_result); } // java.util.HashMap @@ -1843,8 +1799,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_HashMap, _m_HashMap__ctor, i, f); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__ctor1 = NULL; @@ -1859,8 +1814,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_HashMap, _m_HashMap__ctor1, i); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__ctor2 = NULL; @@ -1874,8 +1828,7 @@ if (_m_HashMap__ctor2 == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_HashMap, _m_HashMap__ctor2); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__ctor3 = NULL; @@ -1890,8 +1843,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_HashMap, _m_HashMap__ctor3, map); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__size = NULL; @@ -1936,8 +1888,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__get0, object); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__containsKey = NULL; @@ -1969,8 +1920,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__put, object, object1); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__putAll = NULL; @@ -2000,8 +1950,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__remove, object); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__clear = NULL; @@ -2046,8 +1995,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__keySet); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__values = NULL; @@ -2063,8 +2011,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__values); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__entrySet = NULL; @@ -2080,8 +2027,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__entrySet); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__getOrDefault = NULL; @@ -2099,8 +2045,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__getOrDefault, object, object1); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__putIfAbsent = NULL; @@ -2116,8 +2061,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__putIfAbsent, object, object1); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__remove1 = NULL; @@ -2168,8 +2112,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__replace1, object, object1); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__computeIfAbsent = NULL; @@ -2188,8 +2131,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__computeIfAbsent, object, function); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__computeIfPresent = NULL; @@ -2208,8 +2150,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__computeIfPresent, object, biFunction); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__compute = NULL; @@ -2226,8 +2167,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__compute, object, biFunction); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__merge = NULL; @@ -2247,8 +2187,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_HashMap__merge, object, object1, biFunction); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_HashMap__forEach = NULL; @@ -2293,6 +2232,5 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_HashMap__clone); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); }
diff --git a/pkgs/jnigen/example/in_app_java/src/android_utils/dartjni.h b/pkgs/jnigen/example/in_app_java/src/android_utils/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/example/in_app_java/src/android_utils/dartjni.h +++ b/pkgs/jnigen/example/in_app_java/src/android_utils/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/example/kotlin_plugin/src/dartjni.h b/pkgs/jnigen/example/kotlin_plugin/src/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/example/kotlin_plugin/src/dartjni.h +++ b/pkgs/jnigen/example/kotlin_plugin/src/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/example/kotlin_plugin/src/kotlin_plugin_bindings.c b/pkgs/jnigen/example/kotlin_plugin/src/kotlin_plugin_bindings.c index d93599c..fd8b22b 100644 --- a/pkgs/jnigen/example/kotlin_plugin/src/kotlin_plugin_bindings.c +++ b/pkgs/jnigen/example/kotlin_plugin/src/kotlin_plugin_bindings.c
@@ -29,8 +29,7 @@ if (_m_Example__ctor == NULL) return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_Example__thinkBeforeAnswering = NULL; @@ -47,6 +46,5 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_Example__thinkBeforeAnswering, continuation); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); }
diff --git a/pkgs/jnigen/example/notification_plugin/src/dartjni.h b/pkgs/jnigen/example/notification_plugin/src/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/example/notification_plugin/src/dartjni.h +++ b/pkgs/jnigen/example/notification_plugin/src/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/example/notification_plugin/src/notification_plugin.c b/pkgs/jnigen/example/notification_plugin/src/notification_plugin.c index 8eb077c..387fe0c 100644 --- a/pkgs/jnigen/example/notification_plugin/src/notification_plugin.c +++ b/pkgs/jnigen/example/notification_plugin/src/notification_plugin.c
@@ -35,8 +35,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Notifications, _m_Notifications__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_Notifications__showNotification = NULL;
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 ee03391..59c7919 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
@@ -88,11 +88,11 @@ static final _set_charactersByArticle = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_PDFTextStripper__charactersByArticle") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: protected java.util.ArrayList<java.util.List<org.apache.pdfbox.text.TextPosition>> charactersByArticle /// The returned object must be deleted after use, by calling the `delete` method. @@ -128,7 +128,7 @@ /// /// Most PDFs won't have any beads, so charactersByArticle will contain a single entry. set charactersByArticle(jni.JObject value) => - _set_charactersByArticle(reference, value.reference); + _set_charactersByArticle(reference, value.reference).check(); static final _get_document = jniLookup< ffi.NativeFunction< @@ -142,10 +142,10 @@ static final _set_document = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_PDFTextStripper__document") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: protected org.apache.pdfbox.pdmodel.PDDocument document /// The returned object must be deleted after use, by calling the `delete` method. @@ -155,7 +155,7 @@ /// from: protected org.apache.pdfbox.pdmodel.PDDocument document /// The returned object must be deleted after use, by calling the `delete` method. set document(pddocument_.PDDocument value) => - _set_document(reference, value.reference); + _set_document(reference, value.reference).check(); static final _get_output = jniLookup< ffi.NativeFunction< @@ -169,10 +169,10 @@ static final _set_output = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_PDFTextStripper__output") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: protected java.io.Writer output /// The returned object must be deleted after use, by calling the `delete` method. @@ -181,7 +181,8 @@ /// from: protected java.io.Writer output /// The returned object must be deleted after use, by calling the `delete` method. - set output(jni.JObject value) => _set_output(reference, value.reference); + set output(jni.JObject value) => + _set_output(reference, value.reference).check(); static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( "PDFTextStripper__ctor")
diff --git a/pkgs/jnigen/example/pdfbox_plugin/src/third_party/dartjni.h b/pkgs/jnigen/example/pdfbox_plugin/src/third_party/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/src/third_party/dartjni.h +++ b/pkgs/jnigen/example/pdfbox_plugin/src/third_party/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/example/pdfbox_plugin/src/third_party/pdfbox_plugin.c b/pkgs/jnigen/example/pdfbox_plugin/src/third_party/pdfbox_plugin.c index 0ce1442..86a8161 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/src/third_party/pdfbox_plugin.c +++ b/pkgs/jnigen/example/pdfbox_plugin/src/third_party/pdfbox_plugin.c
@@ -48,8 +48,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDDocument, _m_PDDocument__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__ctor1 = NULL; @@ -65,8 +64,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDDocument, _m_PDDocument__ctor1, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__ctor2 = NULL; @@ -82,8 +80,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDDocument, _m_PDDocument__ctor2, doc); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__ctor3 = NULL; @@ -100,8 +97,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDDocument, _m_PDDocument__ctor3, doc, source); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__ctor4 = NULL; @@ -119,8 +115,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject( jniEnv, _c_PDDocument, _m_PDDocument__ctor4, doc, source, permission); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__addPage = NULL; @@ -283,8 +278,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__importPage, page); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getDocument = NULL; @@ -300,8 +294,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_PDDocument__getDocument); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getDocumentInformation = NULL; @@ -318,8 +311,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getDocumentInformation); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__setDocumentInformation = NULL; @@ -353,8 +345,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getDocumentCatalog); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__isEncrypted = NULL; @@ -385,8 +376,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_PDDocument__getEncryption); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__setEncryptionDictionary = NULL; @@ -422,8 +412,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getLastSignatureDictionary); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getSignatureFields = NULL; @@ -439,8 +428,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getSignatureFields); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getSignatureDictionaries = NULL; @@ -456,8 +444,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getSignatureDictionaries); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__registerTrueTypeFontForClosing = NULL; @@ -491,8 +478,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load, file); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load1 = NULL; @@ -510,8 +496,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load1, file, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load2 = NULL; @@ -528,8 +513,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load2, file, password); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load3 = NULL; @@ -550,8 +534,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load3, file, password, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load4 = NULL; @@ -573,8 +556,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load4, file, password, keyStore, alias); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load5 = NULL; @@ -598,8 +580,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load5, file, password, keyStore, alias, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load6 = NULL; @@ -616,8 +597,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load6, input); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load7 = NULL; @@ -635,8 +615,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load7, input, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load8 = NULL; @@ -653,8 +632,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load8, input, password); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load9 = NULL; @@ -676,8 +654,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load9, input, password, keyStore, alias); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load10 = NULL; @@ -698,8 +675,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load10, input, password, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load11 = NULL; @@ -723,8 +699,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load11, input, password, keyStore, alias, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load12 = NULL; @@ -740,8 +715,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load12, input); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load13 = NULL; @@ -758,8 +732,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load13, input, password); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load14 = NULL; @@ -780,8 +753,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load14, input, password, keyStore, alias); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__load15 = NULL; @@ -804,8 +776,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDDocument, _m_PDDocument__load15, input, password, keyStore, alias, memUsageSetting); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__save = NULL; @@ -903,8 +874,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__saveIncrementalForExternalSigning, output); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getPage = NULL; @@ -920,8 +890,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getPage, pageIndex); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getPages = NULL; @@ -937,8 +906,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_PDDocument__getPages); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__getNumberOfPages = NULL; @@ -1000,8 +968,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getCurrentAccessPermission); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__isAllSecurityToBeRemoved = NULL; @@ -1051,8 +1018,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_PDDocument__getDocumentId); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__setDocumentId = NULL; @@ -1114,8 +1080,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocument__getResourceCache); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocument__setResourceCache = NULL; @@ -1152,8 +1117,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDDocumentInformation, _m_PDDocumentInformation__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__ctor1 = NULL; @@ -1170,8 +1134,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDDocumentInformation, _m_PDDocumentInformation__ctor1, dic); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__getCOSObject = NULL; @@ -1188,8 +1151,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getCOSObject); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__getPropertyStringValue = NULL; @@ -1210,8 +1172,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getPropertyStringValue, propertyKey); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__getTitle = NULL; @@ -1228,8 +1189,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getTitle); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setTitle = NULL; @@ -1263,8 +1223,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getAuthor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setAuthor = NULL; @@ -1298,8 +1257,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getSubject); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setSubject = NULL; @@ -1333,8 +1291,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getKeywords); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setKeywords = NULL; @@ -1368,8 +1325,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getCreator); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setCreator = NULL; @@ -1403,8 +1359,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getProducer); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setProducer = NULL; @@ -1439,8 +1394,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getCreationDate); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setCreationDate = NULL; @@ -1476,8 +1430,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getModificationDate); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setModificationDate = NULL; @@ -1513,8 +1466,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getTrapped); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__getMetadataKeys = NULL; @@ -1532,8 +1484,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getMetadataKeys); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__getCustomMetadataValue = NULL; @@ -1554,8 +1505,7 @@ jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDDocumentInformation__getCustomMetadataValue, fieldName); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDDocumentInformation__setCustomMetadataValue = NULL; @@ -1613,8 +1563,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_PDFTextStripper, _m_PDFTextStripper__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__getText = NULL; @@ -1631,8 +1580,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getText, doc); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__writeText = NULL; @@ -2023,8 +1971,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getLineSeparator); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__getWordSeparator = NULL; @@ -2041,8 +1988,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getWordSeparator); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setWordSeparator = NULL; @@ -2111,8 +2057,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_PDFTextStripper__getOutput); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__getCharactersByArticle = NULL; @@ -2129,8 +2074,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getCharactersByArticle); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setSuppressDuplicateOverlappingText = NULL; @@ -2207,8 +2151,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getEndBookmark); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setEndBookmark = NULL; @@ -2246,8 +2189,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getStartBookmark); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setStartBookmark = NULL; @@ -2499,8 +2441,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getParagraphStart); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setParagraphStart = NULL; @@ -2534,8 +2475,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getParagraphEnd); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setParagraphEnd = NULL; @@ -2569,8 +2509,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getPageStart); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setPageStart = NULL; @@ -2604,8 +2543,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_PDFTextStripper__getPageEnd); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setPageEnd = NULL; @@ -2639,8 +2577,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getArticleStart); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setArticleStart = NULL; @@ -2675,8 +2612,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getArticleEnd); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__setArticleEnd = NULL; @@ -2812,8 +2748,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_PDFTextStripper__getListItemPatterns); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_PDFTextStripper__matchPattern = NULL; @@ -2832,8 +2767,7 @@ jobject _result = (*jniEnv)->CallStaticObjectMethod( jniEnv, _c_PDFTextStripper, _m_PDFTextStripper__matchPattern, string, patterns); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jfieldID _f_PDFTextStripper__LINE_SEPARATOR = NULL; @@ -2846,9 +2780,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_field(_c_PDFTextStripper, &_f_PDFTextStripper__LINE_SEPARATOR, "LINE_SEPARATOR", "Ljava/lang/String;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_PDFTextStripper__LINE_SEPARATOR)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_PDFTextStripper__LINE_SEPARATOR); + return to_global_ref_result(_result); } jfieldID _f_PDFTextStripper__charactersByArticle = NULL; @@ -2861,9 +2795,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_field(_c_PDFTextStripper, &_f_PDFTextStripper__charactersByArticle, "charactersByArticle", "Ljava/util/ArrayList;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_PDFTextStripper__charactersByArticle)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_PDFTextStripper__charactersByArticle); + return to_global_ref_result(_result); } FFI_PLUGIN_EXPORT @@ -2891,9 +2825,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_field(_c_PDFTextStripper, &_f_PDFTextStripper__document, "document", "Lorg/apache/pdfbox/pdmodel/PDDocument;"); - jobject _result = to_global_ref( - (*jniEnv)->GetObjectField(jniEnv, self_, _f_PDFTextStripper__document)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_PDFTextStripper__document); + return to_global_ref_result(_result); } FFI_PLUGIN_EXPORT @@ -2919,9 +2853,9 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; load_field(_c_PDFTextStripper, &_f_PDFTextStripper__output, "output", "Ljava/io/Writer;"); - jobject _result = to_global_ref( - (*jniEnv)->GetObjectField(jniEnv, self_, _f_PDFTextStripper__output)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_PDFTextStripper__output); + return to_global_ref_result(_result); } FFI_PLUGIN_EXPORT
diff --git a/pkgs/jnigen/lib/src/bindings/c_bindings.dart b/pkgs/jnigen/lib/src/bindings/c_bindings.dart index 2e87e3d..4f1cad5 100644 --- a/pkgs/jnigen/lib/src/bindings/c_bindings.dart +++ b/pkgs/jnigen/lib/src/bindings/c_bindings.dart
@@ -63,7 +63,7 @@ case "byte": return "int8_t"; case "char": - return "char"; + return "uint16_t"; case "double": return "double"; case "float": @@ -163,16 +163,20 @@ '$objectArgument, $fieldVar, value);\n' '${indent}return $ifError;'; } else { - var getterExpr = '(*jniEnv)->Get$ifStaticCall${callType}Field(jniEnv, ' + final getterExpr = + '(*jniEnv)->Get$ifStaticCall${callType}Field(jniEnv, ' '$objectArgument, $fieldVar)'; - if (f.type.kind != Kind.primitive) { - getterExpr = 'to_global_ref($getterExpr)'; - } final cResultType = getCType(f.type.name); final unionField = getJValueField(f.type); + final String returnExpr; + if (f.type.kind != Kind.primitive) { + returnExpr = 'to_global_ref_result(_result)'; + } else { + returnExpr = '(JniResult){.value = ' + '{.$unionField = _result}, .exception = check_exception()}'; + } accessorStatements = '$indent$cResultType _result = $getterExpr;\n' - '${indent}return (JniResult){.value = ' - '{.$unionField = _result}, .exception = check_exception()};'; + '${indent}return $returnExpr;'; } s.write(''' @@ -256,8 +260,7 @@ String valuePart; String unionField; if (cReturnType == 'jobject' || m.isCtor) { - unionField = 'l'; - valuePart = 'to_global_ref(_result)'; + return '${indent}return to_global_ref_result(_result);'; } else if (cReturnType == 'void') { // in case of void return, just write 0 in result part of JniResult unionField = 'j';
diff --git a/pkgs/jnigen/lib/src/bindings/dart_generator.dart b/pkgs/jnigen/lib/src/bindings/dart_generator.dart index b238548..c221529 100644 --- a/pkgs/jnigen/lib/src/bindings/dart_generator.dart +++ b/pkgs/jnigen/lib/src/bindings/dart_generator.dart
@@ -23,7 +23,6 @@ const _jPointer = '$_jni.JObjectPtr'; const _jArray = '$_jni.JArray'; const _jObject = '$_jni.JObject'; -const _jThrowable = '$_jni.JThrowablePtr'; const _jResult = '$_jni.JniResult'; const _jCallType = '$_jni.JniCallType'; @@ -803,9 +802,9 @@ final dartSig = node.type.accept(const _TypeSig(isFfi: false)); s.write(''' static final _set_$name = - $_lookup<$_ffi.NativeFunction<$_jThrowable Function($ifRef$ffiSig)>>( + $_lookup<$_ffi.NativeFunction<$_jResult Function($ifRef$ffiSig)>>( "set_$cName") - .asFunction<$_jThrowable Function($ifRef$dartSig)>(); + .asFunction<$_jResult Function($ifRef$dartSig)>(); '''); } @@ -822,7 +821,7 @@ final name = node.finalName; final self = node.isStatic ? '' : '$_selfPointer, '; final toNativeSuffix = node.type.accept(const _ToNativeSuffix()); - return '_set_$name(${self}value$toNativeSuffix)'; + return '_set_$name(${self}value$toNativeSuffix).check()'; } void writeDartOnlyAccessor(Field node) {
diff --git a/pkgs/jnigen/lib/src/config/config_types.dart b/pkgs/jnigen/lib/src/config/config_types.dart index 39c198f..6030436 100644 --- a/pkgs/jnigen/lib/src/config/config_types.dart +++ b/pkgs/jnigen/lib/src/config/config_types.dart
@@ -156,6 +156,16 @@ enum BindingsType { cBased, dartOnly } +extension GetConfigString on BindingsType { + static const _configStrings = { + BindingsType.cBased: 'c_based', + BindingsType.dartOnly: 'dart_only', + }; + String getConfigString() { + return _configStrings[this]!; + } +} + BindingsType getBindingsType(String? name, BindingsType defaultVal) { const values = { 'c_based': BindingsType.cBased,
diff --git a/pkgs/jnigen/test/.gitignore b/pkgs/jnigen/test/.gitignore index 6468101..36f1ec5 100644 --- a/pkgs/jnigen/test/.gitignore +++ b/pkgs/jnigen/test/.gitignore
@@ -1,2 +1,4 @@ # TODO(#166): Remove this. -!jni.jar \ No newline at end of file +!jni.jar +runtime_test_registrant_dartonly_generated.dart +generated_runtime_test.dart \ No newline at end of file
diff --git a/pkgs/jnigen/test/README.md b/pkgs/jnigen/test/README.md index 0911337..e3ada83 100644 --- a/pkgs/jnigen/test/README.md +++ b/pkgs/jnigen/test/README.md
@@ -1,11 +1,13 @@ -Some notes about tests in this directory: +## How to run tests? +#### One-time setup: +``` +dart run jnigen:setup +``` -* [jackson_core_test](jackson_core_test/) is an end-to-end test which generates bindings for `jackson_core` library using the whole jnigen pipeline and compares the generated bindings with expected bindings. [simple_package_test](simple_package_test/) is similar but instead of using a Java library from maven, uses a stub java class. -* [bindings_test.dart](bindings_test.dart) runs the generated bindings to make sure they work. There are only a few tests here right now. -* [test_util/](test_util/) directory contains some code common to both `jackson_core_test` and `simple_package_test`. (Especially the functions `generateAndCompareBindings` and `generateAndAnalyzeBindings`). -* [yaml_config_test.dart](yaml_config_test.dart) runs the same `jackson_core` configuration but through YAML and makes sure it generates the same bindings. -* The other files contain unit tests for some error-prone components. +#### Running tests +```sh +dart run tool/generate_runtime_tests.dart ## Regenerates runtime test files +dart test +``` Note: Tests fail if summarizer is not previously built and 2 tests try to build it concurrently. We have to address it using a lock file and exponential backoff (#43). Temporarily, run `dart run jnigen:setup` before running tests for the first time. - -TODO(#62): Add some unit & integration tests in the java portion.
diff --git a/pkgs/jnigen/test/bindings_test.dart b/pkgs/jnigen/test/bindings_test.dart deleted file mode 100644 index 7d98863..0000000 --- a/pkgs/jnigen/test/bindings_test.dart +++ /dev/null
@@ -1,447 +0,0 @@ -// Copyright (c) 2022, 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. - -// Tests on generated code. -// -// Both the simple java example & jackson core classes example have tests in -// same file, because the test runner will reuse the process, which leads to -// reuse of the old JVM with old classpath if we have separate tests with -// different classpaths. - -import 'dart:io'; - -import 'package:jni/jni.dart'; -import 'package:path/path.dart' hide equals; -import 'package:test/test.dart'; - -// ignore_for_file: avoid_relative_lib_imports -import 'kotlin_test/lib/kotlin.dart'; -import 'simple_package_test/lib/simple_package.dart'; -import 'jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart'; - -import 'test_util/test_util.dart'; - -final simplePackageTest = join('test', 'simple_package_test'); -final jacksonCoreTest = join('test', 'jackson_core_test'); -final kotlinTest = join('test', 'kotlin_test'); -final jniJar = join(kotlinTest, 'jni.jar'); - -final simplePackageTestJava = join(simplePackageTest, 'java'); -final kotlinTestKotlin = join(kotlinTest, 'kotlin'); - -Future<void> setupDylibsAndClasses() async { - await runCommand('dart', [ - 'run', - 'jni:setup', - '-p', - 'jni', - '-s', - join(simplePackageTest, 'src'), - ]); - final group = join('com', 'github', 'dart_lang', 'jnigen'); - await runCommand( - 'javac', - [ - join(group, 'simple_package', 'Example.java'), - join(group, 'generics', 'MyMap.java'), - join(group, 'generics', 'MyStack.java'), - join(group, 'generics', 'GrandParent.java'), - 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'), - join(group, 'pkg2', 'Example.java'), - ], - workingDirectory: simplePackageTestJava); - await runCommand('dart', [ - 'run', - 'jnigen:download_maven_jars', - '--config', - join(jacksonCoreTest, 'jnigen.yaml') - ]); - - final jacksonJars = await getJarPaths(join(jacksonCoreTest, 'third_party')); - - await runCommand('dart', [ - 'run', - 'jni:setup', - '-p', - 'jni', - '-s', - join(kotlinTest, 'src'), - ]); - await runCommand( - 'mvn', - ['package'], - workingDirectory: kotlinTestKotlin, - runInShell: true, - ); - // Jar including Kotlin runtime and dependencies. - final kotlinTestJar = - join(kotlinTestKotlin, 'target', 'kotlin_test-jar-with-dependencies.jar'); - - if (!Platform.isAndroid) { - Jni.spawn(dylibDir: join('build', 'jni_libs'), classPath: [ - jniJar, - simplePackageTestJava, - ...jacksonJars, - kotlinTestJar, - ]); - } - - Jni.initDLApi(); -} - -void main() async { - await checkLocallyBuiltDependencies(); - setUpAll(setupDylibsAndClasses); - - test('static final fields', () { - expect(Example.ON, equals(1)); - expect(Example.OFF, equals(0)); - }); - - test('static & instance fields', () { - expect(Example.num, equals(121)); - final aux = Example.aux; - expect(aux.value, equals(true)); - aux.delete(); - expect(C2.CONSTANT, equals(12)); - }); - - test('static methods', () { - expect(Example.addInts(10, 15), equals(25)); - }); - - test('static methods arrays', () { - final array = Example.getArr(); - expect(array[0], 1); - expect(array[1], 2); - expect(array[2], 3); - expect(Example.addAll(array), 6); - array[0] = 4; - expect(Example.addAll(array), 9); - }); - - test('instance methods', () { - final ex = Example(); - expect(ex.getNum(), equals(Example.num)); - final aux = Example.getAux(); - expect(aux.getValue(), equals(true)); - aux.setValue(false); - expect(aux.getValue(), equals(false)); - aux.setValue(true); - aux.delete(); - ex.delete(); - }); - - test('array of the class', () { - final ex1 = Example(); - final ex2 = Example(); - ex1.setInternal(1); - ex2.setInternal(2); - final array = JArray(Example.type, 2); - array[0] = ex1; - array[1] = ex2; - expect(array[0].getInternal(), 1); - expect(array[1].getInternal(), 2); - array.delete(); - ex1.delete(); - ex2.delete(); - }); - - test("Check bindings for same-named classes", () { - expect(Example().whichExample(), 0); - expect(Example1().whichExample(), 1); - }); - - test('simple json parsing test', () { - final json = JString.fromString('[1, true, false, 2, 4]'); - JsonFactory factory; - factory = JsonFactory(); - final parser = factory.createParser6(json); - final values = <bool>[]; - while (!parser.isClosed()) { - final next = parser.nextToken(); - if (next.isNull) continue; - values.add(next.isNumeric()); - next.delete(); - } - expect(values, equals([false, true, false, false, true, true, false])); - Jni.deleteAll([factory, parser, json]); - }); - test("parsing invalid JSON throws JniException", () { - using((arena) { - final factory = JsonFactory()..deletedIn(arena); - final erroneous = factory - .createParser6("<html>".toJString()..deletedIn(arena)) - ..deletedIn(arena); - expect(() => erroneous.nextToken(), throwsA(isA<JniException>())); - }); - }); - test('exceptions', () { - 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(T: JString.type)..deletedIn(arena); - stack.push('Hello'.toJString()..deletedIn(arena)); - stack.push('World'.toJString()..deletedIn(arena)); - expect(stack.pop().toDartString(deleteOriginal: true), 'World'); - expect(stack.pop().toDartString(deleteOriginal: true), 'Hello'); - }); - }); - test('MyMap<K, V>', () { - using((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); - map.put('World'.toJString()..deletedIn(arena), worldExample); - expect( - (map.get0('Hello'.toJString()..deletedIn(arena))..deletedIn(arena)) - .getInternal(), - 1, - ); - expect( - (map.get0('World'.toJString()..deletedIn(arena))..deletedIn(arena)) - .getInternal(), - 2, - ); - expect( - ((map.entryStack()..deletedIn(arena)).pop()..deletedIn(arena)) - .key - .castTo(JString.type, deleteOriginal: true) - .toDartString(deleteOriginal: true), - anyOf('Hello', 'World'), - ); - }); - }); - group('classes extending generics', () { - test('StringStack', () { - using((arena) { - final stringStack = StringStack()..deletedIn(arena); - stringStack.push('Hello'.toJString()..deletedIn(arena)); - expect(stringStack.pop().toDartString(deleteOriginal: true), 'Hello'); - }); - }); - test('StringKeyedMap', () { - using((arena) { - final map = StringKeyedMap(V: Example.type)..deletedIn(arena); - final example = Example()..deletedIn(arena); - map.put('Hello'.toJString()..deletedIn(arena), example); - expect( - (map.get0('Hello'.toJString()..deletedIn(arena))..deletedIn(arena)) - .getInternal(), - 0, - ); - }); - }); - test('StringValuedMap', () { - using((arena) { - final map = StringValuedMap(K: Example.type)..deletedIn(arena); - final example = Example()..deletedIn(arena); - map.put(example, 'Hello'.toJString()..deletedIn(arena)); - expect( - map.get0(example).toDartString(deleteOriginal: true), - 'Hello', - ); - }); - }); - 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(T: JString.type, "!".toJString()..deletedIn(arena)) - ..deletedIn(arena); - expect( - grandParent.value.toDartString(deleteOriginal: true), - "!", - ); - - final strStaticParent = GrandParent.stringStaticParent() - ..deletedIn(arena); - expect( - strStaticParent.value.toDartString(deleteOriginal: true), - "Hello", - ); - - final exampleStaticParent = GrandParent.varStaticParent( - S: Example.type, Example()..deletedIn(arena)) - ..deletedIn(arena); - expect( - (exampleStaticParent.value..deletedIn(arena)).getInternal(), - 0, - ); - - final strParent = grandParent.stringParent()..deletedIn(arena); - expect( - strParent.parentValue - .castTo(JString.type, deleteOriginal: true) - .toDartString(deleteOriginal: true), - "!", - ); - expect( - strParent.value.toDartString(deleteOriginal: true), - "Hello", - ); - - final exampleParent = grandParent.varParent( - S: Example.type, Example()..deletedIn(arena)) - ..deletedIn(arena); - expect( - exampleParent.parentValue - .castTo(JString.type, deleteOriginal: true) - .toDartString(deleteOriginal: true), - "!", - ); - expect( - (exampleParent.value..deletedIn(arena)).getInternal(), - 0, - ); - // TODO(#139): test constructing Child, currently does not work due - // to a problem with C-bindings. - }); - }); - }); - 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 { - final suspendFun = SuspendFun()..deletedIn(arena); - final hello = await suspendFun.sayHello(); - expect(hello.toDartString(deleteOriginal: true), "Hello!"); - const name = "Bob"; - final helloBob = - await suspendFun.sayHello1(name.toJString()..deletedIn(arena)); - expect(helloBob.toDartString(deleteOriginal: true), "Hello $name!"); - }); - }); - }); -}
diff --git a/pkgs/jnigen/test/config_test.dart b/pkgs/jnigen/test/config_test.dart index 2faa528..97fbb3d 100644 --- a/pkgs/jnigen/test/config_test.dart +++ b/pkgs/jnigen/test/config_test.dart
@@ -15,10 +15,10 @@ const packageTests = 'test'; final jacksonCoreTests = absolute(packageTests, 'jackson_core_test'); final thirdParty = absolute(jacksonCoreTests, 'third_party'); -final lib = absolute(thirdParty, 'lib'); -final src = absolute(thirdParty, 'src'); -final testLib = absolute(thirdParty, 'test_', 'lib'); -final testSrc = absolute(thirdParty, 'test_', 'src'); +final lib = absolute(thirdParty, 'c_based', 'dart_bindings'); +final src = absolute(thirdParty, 'c_based', 'c_bindings'); +final testLib = absolute(thirdParty, 'test_', 'c_based', 'dart_bindings'); +final testSrc = absolute(thirdParty, 'test_', 'c_based', 'c_bindings'); /// Compares 2 [Config] objects using [expect] to give useful errors when /// two fields are not equal. @@ -104,7 +104,13 @@ ]); test('compare configuration values', () { - expectConfigsAreEqual(config, getConfig(root: join(thirdParty, 'test_'))); + expectConfigsAreEqual( + config, + getConfig( + root: join(thirdParty, 'test_'), + bindingsType: BindingsType.cBased, + ), + ); }); group('Test for config error checking', () {
diff --git a/pkgs/jnigen/test/jackson_core_test/generate.dart b/pkgs/jnigen/test/jackson_core_test/generate.dart index c804e57..7077bfa 100644 --- a/pkgs/jnigen/test/jackson_core_test/generate.dart +++ b/pkgs/jnigen/test/jackson_core_test/generate.dart
@@ -28,9 +28,14 @@ final thirdPartyDir = join('test', testName, 'third_party'); const deps = ['com.fasterxml.jackson.core:jackson-core:2.13.4']; -Config getConfig( - {String? root, bool generateFullVersion = false, bool useAsm = false}) { +Config getConfig({ + String? root, + bool generateFullVersion = false, + bool useAsm = false, + BindingsType bindingsType = BindingsType.dartOnly, +}) { final rootDir = root ?? thirdPartyDir; + final bindingTypeDir = bindingsType.getConfigString(); final config = Config( mavenDownloads: MavenDownloads( sourceDeps: deps, @@ -42,9 +47,17 @@ ), preamble: jacksonPreamble, outputConfig: OutputConfig( - bindingsType: BindingsType.dartOnly, + bindingsType: bindingsType, + // Have to be judicious here, and ensure null when bindings type is + // dart-only, because config-test is also using this. + cConfig: bindingsType == BindingsType.cBased + ? CCodeOutputConfig( + libraryName: 'jackson_core', + path: Uri.directory(join(rootDir, bindingTypeDir, 'c_bindings')), + ) + : null, dartConfig: DartCodeOutputConfig( - path: Uri.directory(join(rootDir, 'lib')), + path: Uri.directory(join(rootDir, bindingTypeDir, 'dart_bindings')), ), ), classes: (generateFullVersion) @@ -71,4 +84,7 @@ return config; } -void main() async => await generateJniBindings(getConfig()); +void main() async { + await generateJniBindings(getConfig(bindingsType: BindingsType.cBased)); + await generateJniBindings(getConfig(bindingsType: BindingsType.dartOnly)); +}
diff --git a/pkgs/jnigen/test/jackson_core_test/generated_files_test.dart b/pkgs/jnigen/test/jackson_core_test/generated_files_test.dart index 9129612..818e5d0 100644 --- a/pkgs/jnigen/test/jackson_core_test/generated_files_test.dart +++ b/pkgs/jnigen/test/jackson_core_test/generated_files_test.dart
@@ -2,7 +2,6 @@ // 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:path/path.dart' hide equals; import 'package:test/test.dart'; import 'package:jnigen/jnigen.dart'; @@ -13,12 +12,11 @@ void main() async { await checkLocallyBuiltDependencies(); - test("compare generated bindings for jackson_core", () async { - final lib = join(thirdPartyDir, 'lib'); - final src = join(thirdPartyDir, 'src'); - await generateAndCompareBindings(getConfig(), lib, src); - }, timeout: const Timeout.factor(2)); - + generateAndCompareBothModes( + 'Generate and compare bindings for jackson_core library', + getConfig(bindingsType: BindingsType.cBased), + getConfig(bindingsType: BindingsType.dartOnly), + ); test( 'generate and analyze bindings for complete library, ' 'not just required classes', () async {
diff --git a/pkgs/jnigen/test/jackson_core_test/jnigen.yaml b/pkgs/jnigen/test/jackson_core_test/jnigen.yaml index 54c90ba..6041671 100644 --- a/pkgs/jnigen/test/jackson_core_test/jnigen.yaml +++ b/pkgs/jnigen/test/jackson_core_test/jnigen.yaml
@@ -5,9 +5,12 @@ jar_dir: third_party/jar/ output: - bindings_type: dart_only + bindings_type: c_based + c: + library_name: jackson_core + path: third_party/c_based/c_bindings/ dart: - path: third_party/lib/ + path: third_party/c_based/dart_bindings/ classes: - 'com.fasterxml.jackson.core.JsonFactory' @@ -21,7 +24,6 @@ - 'com.fasterxml.jackson.core.base.ParserMinimalBase#CHAR_NULL' - 'com.fasterxml.jackson.core.io.UTF32Reader#NC' - preamble: | // Generated from jackson-core which is licensed under the Apache License 2.0. // The following copyright from the original authors applies.
diff --git a/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart b/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart new file mode 100644 index 0000000..32687fb --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/runtime_test_registrant.dart
@@ -0,0 +1,42 @@ +// Copyright (c) 2022, 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:test/test.dart'; +import 'package:jni/jni.dart'; + +import '../test_util/callback_types.dart'; + +import 'third_party/c_based/dart_bindings/com/fasterxml/jackson/core/_package.dart'; + +// This file doesn't define main, because only one JVM has to be spawned with +// all classpaths, it's managed at a different file which calls these tests. + +void registerTests(String groupName, TestRunnerCallback test) { + group(groupName, () { + test('simple json parsing test', () { + final json = JString.fromString('[1, true, false, 2, 4]'); + JsonFactory factory; + factory = JsonFactory(); + final parser = factory.createParser6(json); + final values = <bool>[]; + while (!parser.isClosed()) { + final next = parser.nextToken(); + if (next.isNull) continue; + values.add(next.isNumeric()); + next.delete(); + } + expect(values, equals([false, true, false, false, true, true, false])); + Jni.deleteAll([factory, parser, json]); + }); + test("parsing invalid JSON throws JniException", () { + using((arena) { + final factory = JsonFactory()..deletedIn(arena); + final erroneous = factory + .createParser6("<html>".toJString()..deletedIn(arena)) + ..deletedIn(arena); + expect(() => erroneous.nextToken(), throwsA(isA<JniException>())); + }); + }); + }); +}
diff --git a/pkgs/jnigen/test/kotlin_test/src/.clang-format b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/.clang-format similarity index 100% copy from pkgs/jnigen/test/kotlin_test/src/.clang-format copy to pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/.clang-format
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/CMakeLists.txt b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/CMakeLists.txt new file mode 100644 index 0000000..db216f5 --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/CMakeLists.txt
@@ -0,0 +1,32 @@ +# jni_native_build (Build with jni:setup. Do not delete this line.) + +# The Flutter tooling requires that developers have CMake 3.10 or later +# installed. You should not increase this version, as doing so will cause +# the plugin to fail to compile for some customers of the plugin. +cmake_minimum_required(VERSION 3.10) + +project(jackson_core VERSION 0.0.1 LANGUAGES C) + +add_library(jackson_core SHARED + "./jackson_core.c" +) + +set_target_properties(jackson_core PROPERTIES + OUTPUT_NAME "jackson_core" +) + +target_compile_definitions(jackson_core PUBLIC DART_SHARED_LIB) + +if(WIN32) + set_target_properties(${TARGET_NAME} PROPERTIES + LINK_FLAGS "/DELAYLOAD:jvm.dll") +endif() + +if (ANDROID) + target_link_libraries(jackson_core log) +else() + find_package(Java REQUIRED) + find_package(JNI REQUIRED) + include_directories(${JNI_INCLUDE_DIRS}) + target_link_libraries(jackson_core ${JNI_LIBRARIES}) +endif()
diff --git a/pkgs/jnigen/test/kotlin_test/src/dartjni.h b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/dartjni.h similarity index 94% rename from pkgs/jnigen/test/kotlin_test/src/dartjni.h rename to pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/test/kotlin_test/src/dartjni.h +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/jackson_core.c b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/jackson_core.c new file mode 100644 index 0000000..74bf137 --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/jackson_core.c
@@ -0,0 +1,3729 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +#include <stdint.h> +#include "dartjni.h" +#include "jni.h" + +thread_local JNIEnv* jniEnv; +JniContext* jni; + +JniContext* (*context_getter)(void); +JNIEnv* (*env_getter)(void); + +void setJniGetters(JniContext* (*cg)(void), JNIEnv* (*eg)(void)) { + context_getter = cg; + env_getter = eg; +} + +// com.fasterxml.jackson.core.JsonFactory +jclass _c_JsonFactory = NULL; + +jmethodID _m_JsonFactory__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__ctor() { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__ctor, "<init>", "()V"); + if (_m_JsonFactory__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_JsonFactory, _m_JsonFactory__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__ctor1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__ctor1(jobject oc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__ctor1, "<init>", + "(Lcom/fasterxml/jackson/core/ObjectCodec;)V"); + if (_m_JsonFactory__ctor1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_JsonFactory, _m_JsonFactory__ctor1, oc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__ctor2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__ctor2(jobject src, jobject codec) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__ctor2, "<init>", + "(Lcom/fasterxml/jackson/core/JsonFactory;Lcom/fasterxml/jackson/" + "core/ObjectCodec;)V"); + if (_m_JsonFactory__ctor2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_JsonFactory, + _m_JsonFactory__ctor2, src, codec); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__ctor3 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__ctor3(jobject b) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__ctor3, "<init>", + "(Lcom/fasterxml/jackson/core/JsonFactoryBuilder;)V"); + if (_m_JsonFactory__ctor3 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_JsonFactory, _m_JsonFactory__ctor3, b); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__ctor4 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__ctor4(jobject b, uint8_t bogus) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__ctor4, "<init>", + "(Lcom/fasterxml/jackson/core/TSFBuilder;Z)V"); + if (_m_JsonFactory__ctor4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_JsonFactory, + _m_JsonFactory__ctor4, b, bogus); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__rebuild = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__rebuild(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__rebuild, "rebuild", + "()Lcom/fasterxml/jackson/core/TSFBuilder;"); + if (_m_JsonFactory__rebuild == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__rebuild); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__builder = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__builder() { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonFactory, &_m_JsonFactory__builder, "builder", + "()Lcom/fasterxml/jackson/core/TSFBuilder;"); + if (_m_JsonFactory__builder == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_JsonFactory, + _m_JsonFactory__builder); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__copy = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__copy(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__copy, "copy", + "()Lcom/fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__copy == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__copy); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__readResolve = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__readResolve(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__readResolve, "readResolve", + "()Ljava/lang/Object;"); + if (_m_JsonFactory__readResolve == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__readResolve); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__requiresPropertyOrdering = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__requiresPropertyOrdering(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__requiresPropertyOrdering, + "requiresPropertyOrdering", "()Z"); + if (_m_JsonFactory__requiresPropertyOrdering == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory__requiresPropertyOrdering); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__canHandleBinaryNatively = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__canHandleBinaryNatively(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__canHandleBinaryNatively, + "canHandleBinaryNatively", "()Z"); + if (_m_JsonFactory__canHandleBinaryNatively == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory__canHandleBinaryNatively); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__canUseCharArrays = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__canUseCharArrays(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__canUseCharArrays, + "canUseCharArrays", "()Z"); + if (_m_JsonFactory__canUseCharArrays == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory__canUseCharArrays); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__canParseAsync = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__canParseAsync(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__canParseAsync, "canParseAsync", + "()Z"); + if (_m_JsonFactory__canParseAsync == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod(jniEnv, self_, + _m_JsonFactory__canParseAsync); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getFormatReadFeatureType = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getFormatReadFeatureType(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getFormatReadFeatureType, + "getFormatReadFeatureType", "()Ljava/lang/Class;"); + if (_m_JsonFactory__getFormatReadFeatureType == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__getFormatReadFeatureType); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__getFormatWriteFeatureType = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getFormatWriteFeatureType(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getFormatWriteFeatureType, + "getFormatWriteFeatureType", "()Ljava/lang/Class;"); + if (_m_JsonFactory__getFormatWriteFeatureType == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__getFormatWriteFeatureType); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__canUseSchema = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__canUseSchema(jobject self_, jobject schema) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__canUseSchema, "canUseSchema", + "(Lcom/fasterxml/jackson/core/FormatSchema;)Z"); + if (_m_JsonFactory__canUseSchema == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory__canUseSchema, schema); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getFormatName = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getFormatName(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getFormatName, "getFormatName", + "()Ljava/lang/String;"); + if (_m_JsonFactory__getFormatName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__getFormatName); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__hasFormat = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__hasFormat(jobject self_, jobject acc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__hasFormat, "hasFormat", + "(Lcom/fasterxml/jackson/core/format/InputAccessor;)Lcom/" + "fasterxml/jackson/core/format/MatchStrength;"); + if (_m_JsonFactory__hasFormat == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonFactory__hasFormat, acc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__requiresCustomCodec = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__requiresCustomCodec(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__requiresCustomCodec, + "requiresCustomCodec", "()Z"); + if (_m_JsonFactory__requiresCustomCodec == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory__requiresCustomCodec); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__hasJSONFormat = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__hasJSONFormat(jobject self_, jobject acc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__hasJSONFormat, "hasJSONFormat", + "(Lcom/fasterxml/jackson/core/format/InputAccessor;)Lcom/" + "fasterxml/jackson/core/format/MatchStrength;"); + if (_m_JsonFactory__hasJSONFormat == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__hasJSONFormat, acc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__version = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__version(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__version, "version", + "()Lcom/fasterxml/jackson/core/Version;"); + if (_m_JsonFactory__version == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__version); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__configure = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__configure(jobject self_, jobject f, uint8_t state) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__configure, "configure", + "(Lcom/fasterxml/jackson/core/JsonFactory$Feature;Z)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__configure == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__configure, f, state); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__enable = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__enable(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__enable, "enable", + "(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__enable == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__enable, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__disable = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__disable(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__disable, "disable", + "(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__disable == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__disable, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__isEnabled = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__isEnabled(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__isEnabled, "isEnabled", + "(Lcom/fasterxml/jackson/core/JsonFactory$Feature;)Z"); + if (_m_JsonFactory__isEnabled == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonFactory__isEnabled, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getParserFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getParserFeatures(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getParserFeatures, + "getParserFeatures", "()I"); + if (_m_JsonFactory__getParserFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod(jniEnv, self_, + _m_JsonFactory__getParserFeatures); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getGeneratorFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getGeneratorFeatures(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getGeneratorFeatures, + "getGeneratorFeatures", "()I"); + if (_m_JsonFactory__getGeneratorFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonFactory__getGeneratorFeatures); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getFormatParserFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getFormatParserFeatures(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getFormatParserFeatures, + "getFormatParserFeatures", "()I"); + if (_m_JsonFactory__getFormatParserFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonFactory__getFormatParserFeatures); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getFormatGeneratorFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getFormatGeneratorFeatures(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getFormatGeneratorFeatures, + "getFormatGeneratorFeatures", "()I"); + if (_m_JsonFactory__getFormatGeneratorFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonFactory__getFormatGeneratorFeatures); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__configure1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__configure1(jobject self_, jobject f, uint8_t state) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__configure1, "configure", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;Z)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__configure1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__configure1, f, state); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__enable1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__enable1(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__enable1, "enable", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/" + "jackson/core/JsonFactory;"); + if (_m_JsonFactory__enable1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__enable1, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__disable1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__disable1(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__disable1, "disable", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/" + "jackson/core/JsonFactory;"); + if (_m_JsonFactory__disable1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__disable1, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__isEnabled1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__isEnabled1(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__isEnabled1, "isEnabled", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Z"); + if (_m_JsonFactory__isEnabled1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod(jniEnv, self_, + _m_JsonFactory__isEnabled1, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__isEnabled2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__isEnabled2(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__isEnabled2, "isEnabled", + "(Lcom/fasterxml/jackson/core/StreamReadFeature;)Z"); + if (_m_JsonFactory__isEnabled2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod(jniEnv, self_, + _m_JsonFactory__isEnabled2, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getInputDecorator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getInputDecorator(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getInputDecorator, + "getInputDecorator", + "()Lcom/fasterxml/jackson/core/io/InputDecorator;"); + if (_m_JsonFactory__getInputDecorator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__getInputDecorator); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__setInputDecorator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__setInputDecorator(jobject self_, jobject d) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__setInputDecorator, + "setInputDecorator", + "(Lcom/fasterxml/jackson/core/io/InputDecorator;)Lcom/fasterxml/" + "jackson/core/JsonFactory;"); + if (_m_JsonFactory__setInputDecorator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__setInputDecorator, d); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__configure2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__configure2(jobject self_, jobject f, uint8_t state) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__configure2, "configure", + "(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;Z)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__configure2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__configure2, f, state); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__enable2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__enable2(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__enable2, "enable", + "(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__enable2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__enable2, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__disable2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__disable2(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__disable2, "disable", + "(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__disable2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__disable2, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__isEnabled3 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__isEnabled3(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__isEnabled3, "isEnabled", + "(Lcom/fasterxml/jackson/core/JsonGenerator$Feature;)Z"); + if (_m_JsonFactory__isEnabled3 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod(jniEnv, self_, + _m_JsonFactory__isEnabled3, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__isEnabled4 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__isEnabled4(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__isEnabled4, "isEnabled", + "(Lcom/fasterxml/jackson/core/StreamWriteFeature;)Z"); + if (_m_JsonFactory__isEnabled4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod(jniEnv, self_, + _m_JsonFactory__isEnabled4, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory__getCharacterEscapes = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getCharacterEscapes(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getCharacterEscapes, + "getCharacterEscapes", + "()Lcom/fasterxml/jackson/core/io/CharacterEscapes;"); + if (_m_JsonFactory__getCharacterEscapes == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__getCharacterEscapes); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__setCharacterEscapes = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__setCharacterEscapes(jobject self_, jobject esc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__setCharacterEscapes, + "setCharacterEscapes", + "(Lcom/fasterxml/jackson/core/io/CharacterEscapes;)Lcom/" + "fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__setCharacterEscapes == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__setCharacterEscapes, esc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__getOutputDecorator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getOutputDecorator(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getOutputDecorator, + "getOutputDecorator", + "()Lcom/fasterxml/jackson/core/io/OutputDecorator;"); + if (_m_JsonFactory__getOutputDecorator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__getOutputDecorator); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__setOutputDecorator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__setOutputDecorator(jobject self_, jobject d) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__setOutputDecorator, + "setOutputDecorator", + "(Lcom/fasterxml/jackson/core/io/OutputDecorator;)Lcom/fasterxml/" + "jackson/core/JsonFactory;"); + if (_m_JsonFactory__setOutputDecorator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__setOutputDecorator, d); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__setRootValueSeparator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__setRootValueSeparator(jobject self_, jobject sep) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__setRootValueSeparator, + "setRootValueSeparator", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonFactory;"); + if (_m_JsonFactory__setRootValueSeparator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__setRootValueSeparator, sep); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__getRootValueSeparator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getRootValueSeparator(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getRootValueSeparator, + "getRootValueSeparator", "()Ljava/lang/String;"); + if (_m_JsonFactory__getRootValueSeparator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__getRootValueSeparator); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__setCodec = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__setCodec(jobject self_, jobject oc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__setCodec, "setCodec", + "(Lcom/fasterxml/jackson/core/ObjectCodec;)Lcom/fasterxml/" + "jackson/core/JsonFactory;"); + if (_m_JsonFactory__setCodec == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__setCodec, oc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__getCodec = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__getCodec(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__getCodec, "getCodec", + "()Lcom/fasterxml/jackson/core/ObjectCodec;"); + if (_m_JsonFactory__getCodec == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonFactory__getCodec); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser, "createParser", + "(Ljava/io/File;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser1(jobject self_, jobject url) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser1, "createParser", + "(Ljava/net/URL;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser1, url); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser2(jobject self_, jobject in) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser2, "createParser", + "(Ljava/io/InputStream;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser2, in); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser3 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser3(jobject self_, jobject r) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser3, "createParser", + "(Ljava/io/Reader;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser3 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser3, r); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser4 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser4(jobject self_, jobject data) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser4, "createParser", + "([B)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser4, data); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser5 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser5(jobject self_, + jobject data, + int32_t offset, + int32_t len) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser5, "createParser", + "([BII)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser5 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser5, data, offset, len); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser6 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser6(jobject self_, jobject content) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser6, "createParser", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser6 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser6, content); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser7 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser7(jobject self_, jobject content) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser7, "createParser", + "([C)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser7 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser7, content); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser8 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser8(jobject self_, + jobject content, + int32_t offset, + int32_t len) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser8, "createParser", + "([CII)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser8 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser8, content, offset, len); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createParser9 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createParser9(jobject self_, jobject in) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createParser9, "createParser", + "(Ljava/io/DataInput;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createParser9 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createParser9, in); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createNonBlockingByteArrayParser = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createNonBlockingByteArrayParser(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createNonBlockingByteArrayParser, + "createNonBlockingByteArrayParser", + "()Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createNonBlockingByteArrayParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createNonBlockingByteArrayParser); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createGenerator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createGenerator(jobject self_, + jobject out, + jobject enc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createGenerator, + "createGenerator", + "(Ljava/io/OutputStream;Lcom/fasterxml/jackson/core/" + "JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createGenerator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createGenerator, out, enc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createGenerator1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createGenerator1(jobject self_, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_JsonFactory, &_m_JsonFactory__createGenerator1, "createGenerator", + "(Ljava/io/OutputStream;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createGenerator1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createGenerator1, out); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createGenerator2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createGenerator2(jobject self_, jobject w) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createGenerator2, + "createGenerator", + "(Ljava/io/Writer;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createGenerator2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createGenerator2, w); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createGenerator3 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createGenerator3(jobject self_, jobject f, jobject enc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createGenerator3, + "createGenerator", + "(Ljava/io/File;Lcom/fasterxml/jackson/core/JsonEncoding;)Lcom/" + "fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createGenerator3 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createGenerator3, f, enc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createGenerator4 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createGenerator4(jobject self_, + jobject out, + jobject enc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createGenerator4, + "createGenerator", + "(Ljava/io/DataOutput;Lcom/fasterxml/jackson/core/" + "JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createGenerator4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createGenerator4, out, enc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createGenerator5 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createGenerator5(jobject self_, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_JsonFactory, &_m_JsonFactory__createGenerator5, "createGenerator", + "(Ljava/io/DataOutput;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createGenerator5 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createGenerator5, out); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser, + "createJsonParser", + "(Ljava/io/File;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser1(jobject self_, jobject url) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser1, + "createJsonParser", + "(Ljava/net/URL;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser1, url); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser2(jobject self_, jobject in) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser2, + "createJsonParser", + "(Ljava/io/InputStream;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser2, in); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser3 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser3(jobject self_, jobject r) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser3, + "createJsonParser", + "(Ljava/io/Reader;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser3 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser3, r); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser4 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser4(jobject self_, jobject data) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser4, + "createJsonParser", + "([B)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser4, data); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser5 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser5(jobject self_, + jobject data, + int32_t offset, + int32_t len) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser5, + "createJsonParser", + "([BII)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser5 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser5, data, offset, len); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonParser6 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonParser6(jobject self_, jobject content) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonParser6, + "createJsonParser", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonFactory__createJsonParser6 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonParser6, content); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonGenerator = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonGenerator(jobject self_, + jobject out, + jobject enc) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonGenerator, + "createJsonGenerator", + "(Ljava/io/OutputStream;Lcom/fasterxml/jackson/core/" + "JsonEncoding;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createJsonGenerator == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonGenerator, out, enc); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonGenerator1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonGenerator1(jobject self_, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory, &_m_JsonFactory__createJsonGenerator1, + "createJsonGenerator", + "(Ljava/io/Writer;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createJsonGenerator1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonGenerator1, out); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory__createJsonGenerator2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory__createJsonGenerator2(jobject self_, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_JsonFactory, &_m_JsonFactory__createJsonGenerator2, + "createJsonGenerator", + "(Ljava/io/OutputStream;)Lcom/fasterxml/jackson/core/JsonGenerator;"); + if (_m_JsonFactory__createJsonGenerator2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonFactory__createJsonGenerator2, out); + return to_global_ref_result(_result); +} + +jfieldID _f_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS = NULL; +FFI_PLUGIN_EXPORT +JniResult get_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS() { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_JsonFactory, + &_f_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS, + "DEFAULT_FACTORY_FEATURE_FLAGS", "I"); + int32_t _result = (*jniEnv)->GetStaticIntField( + jniEnv, _c_JsonFactory, _f_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jfieldID _f_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS = NULL; +FFI_PLUGIN_EXPORT +JniResult get_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS() { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_JsonFactory, + &_f_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS, + "DEFAULT_PARSER_FEATURE_FLAGS", "I"); + int32_t _result = (*jniEnv)->GetStaticIntField( + jniEnv, _c_JsonFactory, _f_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jfieldID _f_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS = NULL; +FFI_PLUGIN_EXPORT +JniResult get_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS() { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_JsonFactory, + &_f_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS, + "DEFAULT_GENERATOR_FEATURE_FLAGS", "I"); + int32_t _result = (*jniEnv)->GetStaticIntField( + jniEnv, _c_JsonFactory, _f_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jfieldID _f_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR = NULL; +FFI_PLUGIN_EXPORT +JniResult get_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR() { + load_env(); + load_class_global_ref(&_c_JsonFactory, + "com/fasterxml/jackson/core/JsonFactory"); + if (_c_JsonFactory == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_JsonFactory, + &_f_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR, + "DEFAULT_ROOT_VALUE_SEPARATOR", + "Lcom/fasterxml/jackson/core/SerializableString;"); + jobject _result = (*jniEnv)->GetStaticObjectField( + jniEnv, _c_JsonFactory, _f_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR); + return to_global_ref_result(_result); +} + +// com.fasterxml.jackson.core.JsonFactory$Feature +jclass _c_JsonFactory_Feature = NULL; + +jmethodID _m_JsonFactory_Feature__values = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory_Feature__values() { + load_env(); + load_class_global_ref(&_c_JsonFactory_Feature, + "com/fasterxml/jackson/core/JsonFactory$Feature"); + if (_c_JsonFactory_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonFactory_Feature, &_m_JsonFactory_Feature__values, + "values", + "()[Lcom/fasterxml/jackson/core/JsonFactory$Feature;"); + if (_m_JsonFactory_Feature__values == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonFactory_Feature, _m_JsonFactory_Feature__values); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory_Feature__valueOf = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory_Feature__valueOf(jobject name) { + load_env(); + load_class_global_ref(&_c_JsonFactory_Feature, + "com/fasterxml/jackson/core/JsonFactory$Feature"); + if (_c_JsonFactory_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_JsonFactory_Feature, &_m_JsonFactory_Feature__valueOf, "valueOf", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonFactory$Feature;"); + if (_m_JsonFactory_Feature__valueOf == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonFactory_Feature, _m_JsonFactory_Feature__valueOf, name); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonFactory_Feature__collectDefaults = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory_Feature__collectDefaults() { + load_env(); + load_class_global_ref(&_c_JsonFactory_Feature, + "com/fasterxml/jackson/core/JsonFactory$Feature"); + if (_c_JsonFactory_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonFactory_Feature, + &_m_JsonFactory_Feature__collectDefaults, + "collectDefaults", "()I"); + if (_m_JsonFactory_Feature__collectDefaults == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod( + jniEnv, _c_JsonFactory_Feature, _m_JsonFactory_Feature__collectDefaults); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory_Feature__enabledByDefault = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory_Feature__enabledByDefault(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory_Feature, + "com/fasterxml/jackson/core/JsonFactory$Feature"); + if (_c_JsonFactory_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory_Feature, &_m_JsonFactory_Feature__enabledByDefault, + "enabledByDefault", "()Z"); + if (_m_JsonFactory_Feature__enabledByDefault == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory_Feature__enabledByDefault); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory_Feature__enabledIn = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory_Feature__enabledIn(jobject self_, int32_t flags) { + load_env(); + load_class_global_ref(&_c_JsonFactory_Feature, + "com/fasterxml/jackson/core/JsonFactory$Feature"); + if (_c_JsonFactory_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory_Feature, &_m_JsonFactory_Feature__enabledIn, + "enabledIn", "(I)Z"); + if (_m_JsonFactory_Feature__enabledIn == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonFactory_Feature__enabledIn, flags); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonFactory_Feature__getMask = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonFactory_Feature__getMask(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonFactory_Feature, + "com/fasterxml/jackson/core/JsonFactory$Feature"); + if (_c_JsonFactory_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonFactory_Feature, &_m_JsonFactory_Feature__getMask, + "getMask", "()I"); + if (_m_JsonFactory_Feature__getMask == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonFactory_Feature__getMask); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +// com.fasterxml.jackson.core.JsonParser +jclass _c_JsonParser = NULL; + +jmethodID _m_JsonParser__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__ctor() { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__ctor, "<init>", "()V"); + if (_m_JsonParser__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_JsonParser, _m_JsonParser__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__ctor1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__ctor1(int32_t features) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__ctor1, "<init>", "(I)V"); + if (_m_JsonParser__ctor1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_JsonParser, + _m_JsonParser__ctor1, features); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getCodec = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getCodec(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getCodec, "getCodec", + "()Lcom/fasterxml/jackson/core/ObjectCodec;"); + if (_m_JsonParser__getCodec == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getCodec); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__setCodec = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setCodec(jobject self_, jobject oc) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setCodec, "setCodec", + "(Lcom/fasterxml/jackson/core/ObjectCodec;)V"); + if (_m_JsonParser__setCodec == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__setCodec, oc); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getInputSource = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getInputSource(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getInputSource, "getInputSource", + "()Ljava/lang/Object;"); + if (_m_JsonParser__getInputSource == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getInputSource); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__setRequestPayloadOnError = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setRequestPayloadOnError(jobject self_, jobject payload) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setRequestPayloadOnError, + "setRequestPayloadOnError", + "(Lcom/fasterxml/jackson/core/util/RequestPayload;)V"); + if (_m_JsonParser__setRequestPayloadOnError == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, + _m_JsonParser__setRequestPayloadOnError, payload); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__setRequestPayloadOnError1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setRequestPayloadOnError1(jobject self_, + jobject payload, + jobject charset) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setRequestPayloadOnError1, + "setRequestPayloadOnError", "([BLjava/lang/String;)V"); + if (_m_JsonParser__setRequestPayloadOnError1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, + _m_JsonParser__setRequestPayloadOnError1, payload, + charset); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__setRequestPayloadOnError2 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setRequestPayloadOnError2(jobject self_, + jobject payload) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setRequestPayloadOnError2, + "setRequestPayloadOnError", "(Ljava/lang/String;)V"); + if (_m_JsonParser__setRequestPayloadOnError2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, + _m_JsonParser__setRequestPayloadOnError2, payload); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__setSchema = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setSchema(jobject self_, jobject schema) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setSchema, "setSchema", + "(Lcom/fasterxml/jackson/core/FormatSchema;)V"); + if (_m_JsonParser__setSchema == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__setSchema, schema); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getSchema = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getSchema(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getSchema, "getSchema", + "()Lcom/fasterxml/jackson/core/FormatSchema;"); + if (_m_JsonParser__getSchema == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getSchema); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__canUseSchema = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__canUseSchema(jobject self_, jobject schema) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__canUseSchema, "canUseSchema", + "(Lcom/fasterxml/jackson/core/FormatSchema;)Z"); + if (_m_JsonParser__canUseSchema == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__canUseSchema, schema); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__requiresCustomCodec = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__requiresCustomCodec(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__requiresCustomCodec, + "requiresCustomCodec", "()Z"); + if (_m_JsonParser__requiresCustomCodec == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__requiresCustomCodec); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__canParseAsync = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__canParseAsync(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__canParseAsync, "canParseAsync", + "()Z"); + if (_m_JsonParser__canParseAsync == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__canParseAsync); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getNonBlockingInputFeeder = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getNonBlockingInputFeeder(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getNonBlockingInputFeeder, + "getNonBlockingInputFeeder", + "()Lcom/fasterxml/jackson/core/async/NonBlockingInputFeeder;"); + if (_m_JsonParser__getNonBlockingInputFeeder == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getNonBlockingInputFeeder); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getReadCapabilities = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getReadCapabilities(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getReadCapabilities, + "getReadCapabilities", + "()Lcom/fasterxml/jackson/core/util/JacksonFeatureSet;"); + if (_m_JsonParser__getReadCapabilities == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getReadCapabilities); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__version = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__version(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__version, "version", + "()Lcom/fasterxml/jackson/core/Version;"); + if (_m_JsonParser__version == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__version); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__close = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__close(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__close, "close", "()V"); + if (_m_JsonParser__close == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__close); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__isClosed = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isClosed(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isClosed, "isClosed", "()Z"); + if (_m_JsonParser__isClosed == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__isClosed); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getParsingContext = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getParsingContext(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getParsingContext, + "getParsingContext", + "()Lcom/fasterxml/jackson/core/JsonStreamContext;"); + if (_m_JsonParser__getParsingContext == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getParsingContext); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__currentLocation = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__currentLocation(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__currentLocation, "currentLocation", + "()Lcom/fasterxml/jackson/core/JsonLocation;"); + if (_m_JsonParser__currentLocation == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonParser__currentLocation); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__currentTokenLocation = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__currentTokenLocation(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__currentTokenLocation, + "currentTokenLocation", + "()Lcom/fasterxml/jackson/core/JsonLocation;"); + if (_m_JsonParser__currentTokenLocation == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__currentTokenLocation); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getCurrentLocation = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getCurrentLocation(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getCurrentLocation, + "getCurrentLocation", + "()Lcom/fasterxml/jackson/core/JsonLocation;"); + if (_m_JsonParser__getCurrentLocation == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getCurrentLocation); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getTokenLocation = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getTokenLocation(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getTokenLocation, + "getTokenLocation", + "()Lcom/fasterxml/jackson/core/JsonLocation;"); + if (_m_JsonParser__getTokenLocation == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getTokenLocation); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__currentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__currentValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__currentValue, "currentValue", + "()Ljava/lang/Object;"); + if (_m_JsonParser__currentValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__currentValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__assignCurrentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__assignCurrentValue(jobject self_, jobject v) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__assignCurrentValue, + "assignCurrentValue", "(Ljava/lang/Object;)V"); + if (_m_JsonParser__assignCurrentValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__assignCurrentValue, + v); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getCurrentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getCurrentValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getCurrentValue, "getCurrentValue", + "()Ljava/lang/Object;"); + if (_m_JsonParser__getCurrentValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonParser__getCurrentValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__setCurrentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setCurrentValue(jobject self_, jobject v) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setCurrentValue, "setCurrentValue", + "(Ljava/lang/Object;)V"); + if (_m_JsonParser__setCurrentValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__setCurrentValue, v); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__releaseBuffered = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__releaseBuffered(jobject self_, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__releaseBuffered, "releaseBuffered", + "(Ljava/io/OutputStream;)I"); + if (_m_JsonParser__releaseBuffered == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonParser__releaseBuffered, out); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__releaseBuffered1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__releaseBuffered1(jobject self_, jobject w) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__releaseBuffered1, + "releaseBuffered", "(Ljava/io/Writer;)I"); + if (_m_JsonParser__releaseBuffered1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonParser__releaseBuffered1, w); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__enable = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__enable(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__enable, "enable", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/" + "jackson/core/JsonParser;"); + if (_m_JsonParser__enable == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__enable, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__disable = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__disable(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__disable, "disable", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/" + "jackson/core/JsonParser;"); + if (_m_JsonParser__disable == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__disable, f); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__configure = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__configure(jobject self_, jobject f, uint8_t state) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__configure, "configure", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;Z)Lcom/" + "fasterxml/jackson/core/JsonParser;"); + if (_m_JsonParser__configure == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__configure, f, state); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__isEnabled = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isEnabled(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isEnabled, "isEnabled", + "(Lcom/fasterxml/jackson/core/JsonParser$Feature;)Z"); + if (_m_JsonParser__isEnabled == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__isEnabled, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__isEnabled1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isEnabled1(jobject self_, jobject f) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isEnabled1, "isEnabled", + "(Lcom/fasterxml/jackson/core/StreamReadFeature;)Z"); + if (_m_JsonParser__isEnabled1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__isEnabled1, f); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getFeatureMask = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getFeatureMask(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getFeatureMask, "getFeatureMask", + "()I"); + if (_m_JsonParser__getFeatureMask == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getFeatureMask); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__setFeatureMask = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__setFeatureMask(jobject self_, int32_t mask) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__setFeatureMask, "setFeatureMask", + "(I)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonParser__setFeatureMask == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__setFeatureMask, mask); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__overrideStdFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__overrideStdFeatures(jobject self_, + int32_t values, + int32_t mask) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__overrideStdFeatures, + "overrideStdFeatures", + "(II)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonParser__overrideStdFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__overrideStdFeatures, values, mask); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getFormatFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getFormatFeatures(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getFormatFeatures, + "getFormatFeatures", "()I"); + if (_m_JsonParser__getFormatFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getFormatFeatures); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__overrideFormatFeatures = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__overrideFormatFeatures(jobject self_, + int32_t values, + int32_t mask) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__overrideFormatFeatures, + "overrideFormatFeatures", + "(II)Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonParser__overrideFormatFeatures == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__overrideFormatFeatures, values, mask); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__nextToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextToken, "nextToken", + "()Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonParser__nextToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__nextToken); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__nextValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextValue, "nextValue", + "()Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonParser__nextValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__nextValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__nextFieldName = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextFieldName(jobject self_, jobject str) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextFieldName, "nextFieldName", + "(Lcom/fasterxml/jackson/core/SerializableString;)Z"); + if (_m_JsonParser__nextFieldName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__nextFieldName, str); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__nextFieldName1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextFieldName1(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextFieldName1, "nextFieldName", + "()Ljava/lang/String;"); + if (_m_JsonParser__nextFieldName1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__nextFieldName1); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__nextTextValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextTextValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextTextValue, "nextTextValue", + "()Ljava/lang/String;"); + if (_m_JsonParser__nextTextValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__nextTextValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__nextIntValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextIntValue(jobject self_, int32_t defaultValue) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextIntValue, "nextIntValue", + "(I)I"); + if (_m_JsonParser__nextIntValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonParser__nextIntValue, defaultValue); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__nextLongValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextLongValue(jobject self_, int64_t defaultValue) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextLongValue, "nextLongValue", + "(J)J"); + if (_m_JsonParser__nextLongValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = (*jniEnv)->CallLongMethod( + jniEnv, self_, _m_JsonParser__nextLongValue, defaultValue); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__nextBooleanValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__nextBooleanValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__nextBooleanValue, + "nextBooleanValue", "()Ljava/lang/Boolean;"); + if (_m_JsonParser__nextBooleanValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__nextBooleanValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__skipChildren = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__skipChildren(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__skipChildren, "skipChildren", + "()Lcom/fasterxml/jackson/core/JsonParser;"); + if (_m_JsonParser__skipChildren == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__skipChildren); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__finishToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__finishToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__finishToken, "finishToken", "()V"); + if (_m_JsonParser__finishToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__finishToken); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__currentToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__currentToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__currentToken, "currentToken", + "()Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonParser__currentToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__currentToken); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__currentTokenId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__currentTokenId(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__currentTokenId, "currentTokenId", + "()I"); + if (_m_JsonParser__currentTokenId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__currentTokenId); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getCurrentToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getCurrentToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getCurrentToken, "getCurrentToken", + "()Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonParser__getCurrentToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonParser__getCurrentToken); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getCurrentTokenId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getCurrentTokenId(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getCurrentTokenId, + "getCurrentTokenId", "()I"); + if (_m_JsonParser__getCurrentTokenId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getCurrentTokenId); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__hasCurrentToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__hasCurrentToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__hasCurrentToken, "hasCurrentToken", + "()Z"); + if (_m_JsonParser__hasCurrentToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__hasCurrentToken); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__hasTokenId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__hasTokenId(jobject self_, int32_t id) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__hasTokenId, "hasTokenId", "(I)Z"); + if (_m_JsonParser__hasTokenId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod(jniEnv, self_, + _m_JsonParser__hasTokenId, id); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__hasToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__hasToken(jobject self_, jobject t) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__hasToken, "hasToken", + "(Lcom/fasterxml/jackson/core/JsonToken;)Z"); + if (_m_JsonParser__hasToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__hasToken, t); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__isExpectedStartArrayToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isExpectedStartArrayToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isExpectedStartArrayToken, + "isExpectedStartArrayToken", "()Z"); + if (_m_JsonParser__isExpectedStartArrayToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__isExpectedStartArrayToken); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__isExpectedStartObjectToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isExpectedStartObjectToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isExpectedStartObjectToken, + "isExpectedStartObjectToken", "()Z"); + if (_m_JsonParser__isExpectedStartObjectToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__isExpectedStartObjectToken); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__isExpectedNumberIntToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isExpectedNumberIntToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isExpectedNumberIntToken, + "isExpectedNumberIntToken", "()Z"); + if (_m_JsonParser__isExpectedNumberIntToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__isExpectedNumberIntToken); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__isNaN = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__isNaN(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__isNaN, "isNaN", "()Z"); + if (_m_JsonParser__isNaN == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__isNaN); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__clearCurrentToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__clearCurrentToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__clearCurrentToken, + "clearCurrentToken", "()V"); + if (_m_JsonParser__clearCurrentToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__clearCurrentToken); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getLastClearedToken = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getLastClearedToken(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getLastClearedToken, + "getLastClearedToken", + "()Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonParser__getLastClearedToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getLastClearedToken); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__overrideCurrentName = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__overrideCurrentName(jobject self_, jobject name) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__overrideCurrentName, + "overrideCurrentName", "(Ljava/lang/String;)V"); + if (_m_JsonParser__overrideCurrentName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_JsonParser__overrideCurrentName, + name); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getCurrentName = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getCurrentName(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getCurrentName, "getCurrentName", + "()Ljava/lang/String;"); + if (_m_JsonParser__getCurrentName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getCurrentName); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__currentName = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__currentName(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__currentName, "currentName", + "()Ljava/lang/String;"); + if (_m_JsonParser__currentName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__currentName); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getText = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getText(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getText, "getText", + "()Ljava/lang/String;"); + if (_m_JsonParser__getText == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getText); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getText1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getText1(jobject self_, jobject writer) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getText1, "getText", + "(Ljava/io/Writer;)I"); + if (_m_JsonParser__getText1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getText1, writer); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getTextCharacters = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getTextCharacters(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getTextCharacters, + "getTextCharacters", "()[C"); + if (_m_JsonParser__getTextCharacters == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getTextCharacters); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getTextLength = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getTextLength(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getTextLength, "getTextLength", + "()I"); + if (_m_JsonParser__getTextLength == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getTextLength); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getTextOffset = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getTextOffset(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getTextOffset, "getTextOffset", + "()I"); + if (_m_JsonParser__getTextOffset == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getTextOffset); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__hasTextCharacters = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__hasTextCharacters(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__hasTextCharacters, + "hasTextCharacters", "()Z"); + if (_m_JsonParser__hasTextCharacters == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__hasTextCharacters); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getNumberValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getNumberValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getNumberValue, "getNumberValue", + "()Ljava/lang/Number;"); + if (_m_JsonParser__getNumberValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getNumberValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getNumberValueExact = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getNumberValueExact(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getNumberValueExact, + "getNumberValueExact", "()Ljava/lang/Number;"); + if (_m_JsonParser__getNumberValueExact == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getNumberValueExact); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getNumberType = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getNumberType(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getNumberType, "getNumberType", + "()Lcom/fasterxml/jackson/core/JsonParser$NumberType;"); + if (_m_JsonParser__getNumberType == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getNumberType); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getByteValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getByteValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getByteValue, "getByteValue", + "()B"); + if (_m_JsonParser__getByteValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int8_t _result = + (*jniEnv)->CallByteMethod(jniEnv, self_, _m_JsonParser__getByteValue); + return (JniResult){.value = {.b = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getShortValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getShortValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getShortValue, "getShortValue", + "()S"); + if (_m_JsonParser__getShortValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int16_t _result = + (*jniEnv)->CallShortMethod(jniEnv, self_, _m_JsonParser__getShortValue); + return (JniResult){.value = {.s = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getIntValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getIntValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getIntValue, "getIntValue", "()I"); + if (_m_JsonParser__getIntValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getIntValue); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getLongValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getLongValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getLongValue, "getLongValue", + "()J"); + if (_m_JsonParser__getLongValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = + (*jniEnv)->CallLongMethod(jniEnv, self_, _m_JsonParser__getLongValue); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getBigIntegerValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getBigIntegerValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getBigIntegerValue, + "getBigIntegerValue", "()Ljava/math/BigInteger;"); + if (_m_JsonParser__getBigIntegerValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getBigIntegerValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getFloatValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getFloatValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getFloatValue, "getFloatValue", + "()F"); + if (_m_JsonParser__getFloatValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + float _result = + (*jniEnv)->CallFloatMethod(jniEnv, self_, _m_JsonParser__getFloatValue); + return (JniResult){.value = {.f = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getDoubleValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getDoubleValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getDoubleValue, "getDoubleValue", + "()D"); + if (_m_JsonParser__getDoubleValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + double _result = + (*jniEnv)->CallDoubleMethod(jniEnv, self_, _m_JsonParser__getDoubleValue); + return (JniResult){.value = {.d = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getDecimalValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getDecimalValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getDecimalValue, "getDecimalValue", + "()Ljava/math/BigDecimal;"); + if (_m_JsonParser__getDecimalValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonParser__getDecimalValue); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getBooleanValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getBooleanValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getBooleanValue, "getBooleanValue", + "()Z"); + if (_m_JsonParser__getBooleanValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__getBooleanValue); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getEmbeddedObject = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getEmbeddedObject(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getEmbeddedObject, + "getEmbeddedObject", "()Ljava/lang/Object;"); + if (_m_JsonParser__getEmbeddedObject == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getEmbeddedObject); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getBinaryValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getBinaryValue(jobject self_, jobject bv) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getBinaryValue, "getBinaryValue", + "(Lcom/fasterxml/jackson/core/Base64Variant;)[B"); + if (_m_JsonParser__getBinaryValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getBinaryValue, bv); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getBinaryValue1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getBinaryValue1(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getBinaryValue1, "getBinaryValue", + "()[B"); + if (_m_JsonParser__getBinaryValue1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonParser__getBinaryValue1); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__readBinaryValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readBinaryValue(jobject self_, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__readBinaryValue, "readBinaryValue", + "(Ljava/io/OutputStream;)I"); + if (_m_JsonParser__readBinaryValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonParser__readBinaryValue, out); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__readBinaryValue1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readBinaryValue1(jobject self_, jobject bv, jobject out) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_JsonParser, &_m_JsonParser__readBinaryValue1, "readBinaryValue", + "(Lcom/fasterxml/jackson/core/Base64Variant;Ljava/io/OutputStream;)I"); + if (_m_JsonParser__readBinaryValue1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonParser__readBinaryValue1, bv, out); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsInt = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsInt(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsInt, "getValueAsInt", + "()I"); + if (_m_JsonParser__getValueAsInt == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser__getValueAsInt); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsInt1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsInt1(jobject self_, int32_t def) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsInt1, "getValueAsInt", + "(I)I"); + if (_m_JsonParser__getValueAsInt1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_JsonParser__getValueAsInt1, def); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsLong = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsLong(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsLong, "getValueAsLong", + "()J"); + if (_m_JsonParser__getValueAsLong == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = + (*jniEnv)->CallLongMethod(jniEnv, self_, _m_JsonParser__getValueAsLong); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsLong1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsLong1(jobject self_, int64_t def) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsLong1, "getValueAsLong", + "(J)J"); + if (_m_JsonParser__getValueAsLong1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = (*jniEnv)->CallLongMethod( + jniEnv, self_, _m_JsonParser__getValueAsLong1, def); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsDouble = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsDouble(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsDouble, + "getValueAsDouble", "()D"); + if (_m_JsonParser__getValueAsDouble == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + double _result = (*jniEnv)->CallDoubleMethod(jniEnv, self_, + _m_JsonParser__getValueAsDouble); + return (JniResult){.value = {.d = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsDouble1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsDouble1(jobject self_, double def) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsDouble1, + "getValueAsDouble", "(D)D"); + if (_m_JsonParser__getValueAsDouble1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + double _result = (*jniEnv)->CallDoubleMethod( + jniEnv, self_, _m_JsonParser__getValueAsDouble1, def); + return (JniResult){.value = {.d = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsBoolean = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsBoolean(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsBoolean, + "getValueAsBoolean", "()Z"); + if (_m_JsonParser__getValueAsBoolean == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__getValueAsBoolean); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsBoolean1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsBoolean1(jobject self_, uint8_t def) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsBoolean1, + "getValueAsBoolean", "(Z)Z"); + if (_m_JsonParser__getValueAsBoolean1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__getValueAsBoolean1, def); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getValueAsString = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsString(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsString, + "getValueAsString", "()Ljava/lang/String;"); + if (_m_JsonParser__getValueAsString == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getValueAsString); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getValueAsString1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getValueAsString1(jobject self_, jobject def) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getValueAsString1, + "getValueAsString", "(Ljava/lang/String;)Ljava/lang/String;"); + if (_m_JsonParser__getValueAsString1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__getValueAsString1, def); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__canReadObjectId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__canReadObjectId(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__canReadObjectId, "canReadObjectId", + "()Z"); + if (_m_JsonParser__canReadObjectId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser__canReadObjectId); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__canReadTypeId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__canReadTypeId(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__canReadTypeId, "canReadTypeId", + "()Z"); + if (_m_JsonParser__canReadTypeId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonParser__canReadTypeId); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser__getObjectId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getObjectId(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getObjectId, "getObjectId", + "()Ljava/lang/Object;"); + if (_m_JsonParser__getObjectId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getObjectId); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__getTypeId = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__getTypeId(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__getTypeId, "getTypeId", + "()Ljava/lang/Object;"); + if (_m_JsonParser__getTypeId == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonParser__getTypeId); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__readValueAs = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readValueAs(jobject self_, jobject valueType) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__readValueAs, "readValueAs", + "(Ljava/lang/Class;)Ljava/lang/Object;"); + if (_m_JsonParser__readValueAs == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__readValueAs, valueType); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__readValueAs1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readValueAs1(jobject self_, jobject valueTypeRef) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_JsonParser, &_m_JsonParser__readValueAs1, "readValueAs", + "(Lcom/fasterxml/jackson/core/type/TypeReference;)Ljava/lang/Object;"); + if (_m_JsonParser__readValueAs1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__readValueAs1, valueTypeRef); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__readValuesAs = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readValuesAs(jobject self_, jobject valueType) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__readValuesAs, "readValuesAs", + "(Ljava/lang/Class;)Ljava/util/Iterator;"); + if (_m_JsonParser__readValuesAs == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__readValuesAs, valueType); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__readValuesAs1 = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readValuesAs1(jobject self_, jobject valueTypeRef) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_JsonParser, &_m_JsonParser__readValuesAs1, "readValuesAs", + "(Lcom/fasterxml/jackson/core/type/TypeReference;)Ljava/util/Iterator;"); + if (_m_JsonParser__readValuesAs1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_JsonParser__readValuesAs1, valueTypeRef); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser__readValueAsTree = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser__readValueAsTree(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser, &_m_JsonParser__readValueAsTree, "readValueAsTree", + "()Ljava/lang/Object;"); + if (_m_JsonParser__readValueAsTree == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, + _m_JsonParser__readValueAsTree); + return to_global_ref_result(_result); +} + +jfieldID _f_JsonParser__DEFAULT_READ_CAPABILITIES = NULL; +FFI_PLUGIN_EXPORT +JniResult get_JsonParser__DEFAULT_READ_CAPABILITIES() { + load_env(); + load_class_global_ref(&_c_JsonParser, + "com/fasterxml/jackson/core/JsonParser"); + if (_c_JsonParser == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_JsonParser, &_f_JsonParser__DEFAULT_READ_CAPABILITIES, + "DEFAULT_READ_CAPABILITIES", + "Lcom/fasterxml/jackson/core/util/JacksonFeatureSet;"); + jobject _result = (*jniEnv)->GetStaticObjectField( + jniEnv, _c_JsonParser, _f_JsonParser__DEFAULT_READ_CAPABILITIES); + return to_global_ref_result(_result); +} + +// com.fasterxml.jackson.core.JsonParser$Feature +jclass _c_JsonParser_Feature = NULL; + +jmethodID _m_JsonParser_Feature__values = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_Feature__values() { + load_env(); + load_class_global_ref(&_c_JsonParser_Feature, + "com/fasterxml/jackson/core/JsonParser$Feature"); + if (_c_JsonParser_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonParser_Feature, &_m_JsonParser_Feature__values, + "values", + "()[Lcom/fasterxml/jackson/core/JsonParser$Feature;"); + if (_m_JsonParser_Feature__values == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonParser_Feature, _m_JsonParser_Feature__values); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser_Feature__valueOf = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_Feature__valueOf(jobject name) { + load_env(); + load_class_global_ref(&_c_JsonParser_Feature, + "com/fasterxml/jackson/core/JsonParser$Feature"); + if (_c_JsonParser_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_JsonParser_Feature, &_m_JsonParser_Feature__valueOf, "valueOf", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser$Feature;"); + if (_m_JsonParser_Feature__valueOf == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonParser_Feature, _m_JsonParser_Feature__valueOf, name); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser_Feature__collectDefaults = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_Feature__collectDefaults() { + load_env(); + load_class_global_ref(&_c_JsonParser_Feature, + "com/fasterxml/jackson/core/JsonParser$Feature"); + if (_c_JsonParser_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonParser_Feature, + &_m_JsonParser_Feature__collectDefaults, "collectDefaults", + "()I"); + if (_m_JsonParser_Feature__collectDefaults == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod( + jniEnv, _c_JsonParser_Feature, _m_JsonParser_Feature__collectDefaults); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser_Feature__enabledByDefault = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_Feature__enabledByDefault(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser_Feature, + "com/fasterxml/jackson/core/JsonParser$Feature"); + if (_c_JsonParser_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser_Feature, &_m_JsonParser_Feature__enabledByDefault, + "enabledByDefault", "()Z"); + if (_m_JsonParser_Feature__enabledByDefault == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser_Feature__enabledByDefault); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser_Feature__enabledIn = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_Feature__enabledIn(jobject self_, int32_t flags) { + load_env(); + load_class_global_ref(&_c_JsonParser_Feature, + "com/fasterxml/jackson/core/JsonParser$Feature"); + if (_c_JsonParser_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser_Feature, &_m_JsonParser_Feature__enabledIn, + "enabledIn", "(I)Z"); + if (_m_JsonParser_Feature__enabledIn == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = (*jniEnv)->CallBooleanMethod( + jniEnv, self_, _m_JsonParser_Feature__enabledIn, flags); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonParser_Feature__getMask = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_Feature__getMask(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonParser_Feature, + "com/fasterxml/jackson/core/JsonParser$Feature"); + if (_c_JsonParser_Feature == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonParser_Feature, &_m_JsonParser_Feature__getMask, "getMask", + "()I"); + if (_m_JsonParser_Feature__getMask == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonParser_Feature__getMask); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +// com.fasterxml.jackson.core.JsonParser$NumberType +jclass _c_JsonParser_NumberType = NULL; + +jmethodID _m_JsonParser_NumberType__values = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_NumberType__values() { + load_env(); + load_class_global_ref(&_c_JsonParser_NumberType, + "com/fasterxml/jackson/core/JsonParser$NumberType"); + if (_c_JsonParser_NumberType == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonParser_NumberType, + &_m_JsonParser_NumberType__values, "values", + "()[Lcom/fasterxml/jackson/core/JsonParser$NumberType;"); + if (_m_JsonParser_NumberType__values == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonParser_NumberType, _m_JsonParser_NumberType__values); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonParser_NumberType__valueOf = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonParser_NumberType__valueOf(jobject name) { + load_env(); + load_class_global_ref(&_c_JsonParser_NumberType, + "com/fasterxml/jackson/core/JsonParser$NumberType"); + if (_c_JsonParser_NumberType == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_JsonParser_NumberType, &_m_JsonParser_NumberType__valueOf, "valueOf", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser$NumberType;"); + if (_m_JsonParser_NumberType__valueOf == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonParser_NumberType, _m_JsonParser_NumberType__valueOf, + name); + return to_global_ref_result(_result); +} + +// com.fasterxml.jackson.core.JsonToken +jclass _c_JsonToken = NULL; + +jmethodID _m_JsonToken__values = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__values() { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonToken, &_m_JsonToken__values, "values", + "()[Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonToken__values == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_JsonToken, + _m_JsonToken__values); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonToken__valueOf = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__valueOf(jobject name) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_JsonToken, &_m_JsonToken__valueOf, "valueOf", + "(Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonToken;"); + if (_m_JsonToken__valueOf == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonToken, _m_JsonToken__valueOf, name); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonToken__id = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__id(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__id, "id", "()I"); + if (_m_JsonToken__id == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod(jniEnv, self_, _m_JsonToken__id); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonToken__asString = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__asString(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__asString, "asString", + "()Ljava/lang/String;"); + if (_m_JsonToken__asString == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonToken__asString); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonToken__asCharArray = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__asCharArray(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__asCharArray, "asCharArray", "()[C"); + if (_m_JsonToken__asCharArray == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonToken__asCharArray); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonToken__asByteArray = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__asByteArray(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__asByteArray, "asByteArray", "()[B"); + if (_m_JsonToken__asByteArray == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_JsonToken__asByteArray); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonToken__isNumeric = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__isNumeric(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__isNumeric, "isNumeric", "()Z"); + if (_m_JsonToken__isNumeric == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonToken__isNumeric); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonToken__isStructStart = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__isStructStart(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__isStructStart, "isStructStart", + "()Z"); + if (_m_JsonToken__isStructStart == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonToken__isStructStart); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonToken__isStructEnd = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__isStructEnd(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__isStructEnd, "isStructEnd", "()Z"); + if (_m_JsonToken__isStructEnd == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonToken__isStructEnd); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonToken__isScalarValue = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__isScalarValue(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__isScalarValue, "isScalarValue", + "()Z"); + if (_m_JsonToken__isScalarValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonToken__isScalarValue); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_JsonToken__isBoolean = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonToken__isBoolean(jobject self_) { + load_env(); + load_class_global_ref(&_c_JsonToken, "com/fasterxml/jackson/core/JsonToken"); + if (_c_JsonToken == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_JsonToken, &_m_JsonToken__isBoolean, "isBoolean", "()Z"); + if (_m_JsonToken__isBoolean == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_JsonToken__isBoolean); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +}
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/_init.dart b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/_init.dart new file mode 100644 index 0000000..8018e7d --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/_init.dart
@@ -0,0 +1,24 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; + +// Auto-generated initialization code. + +final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup = + ProtectedJniExtensions.initGeneratedLibrary("jackson_core");
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonFactory.dart b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonFactory.dart new file mode 100644 index 0000000..4389ac3 --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonFactory.dart
@@ -0,0 +1,1994 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: file_names +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_shown_name + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "JsonParser.dart" as jsonparser_; +import "../../../../_init.dart"; + +/// from: com.fasterxml.jackson.core.JsonFactory +/// +/// The main factory class of Jackson package, used to configure and +/// construct reader (aka parser, JsonParser) +/// and writer (aka generator, JsonGenerator) +/// instances. +/// +/// Factory instances are thread-safe and reusable after configuration +/// (if any). Typically applications and services use only a single +/// globally shared factory instance, unless they need differently +/// configured factories. Factory reuse is important if efficiency matters; +/// most recycling of expensive construct is done on per-factory basis. +/// +/// Creation of a factory instance is a light-weight operation, +/// and since there is no need for pluggable alternative implementations +/// (as there is no "standard" JSON processor API to implement), +/// the default constructor is used for constructing factory +/// instances. +///@author Tatu Saloranta +class JsonFactory extends jni.JObject { + @override + late final jni.JObjType $type = type; + + JsonFactory.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $JsonFactoryType(); + + /// from: static public final java.lang.String FORMAT_NAME_JSON + /// + /// Name used to identify JSON format + /// (and returned by \#getFormatName() + static const FORMAT_NAME_JSON = r"""JSON"""; + + static final _get_DEFAULT_FACTORY_FEATURE_FLAGS = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final int DEFAULT_FACTORY_FEATURE_FLAGS + /// + /// Bitfield (set of flags) of all factory features that are enabled by default. + static int get DEFAULT_FACTORY_FEATURE_FLAGS => + _get_DEFAULT_FACTORY_FEATURE_FLAGS().integer; + + static final _get_DEFAULT_PARSER_FEATURE_FLAGS = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final int DEFAULT_PARSER_FEATURE_FLAGS + /// + /// Bitfield (set of flags) of all parser features that are enabled + /// by default. + static int get DEFAULT_PARSER_FEATURE_FLAGS => + _get_DEFAULT_PARSER_FEATURE_FLAGS().integer; + + static final _get_DEFAULT_GENERATOR_FEATURE_FLAGS = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final int DEFAULT_GENERATOR_FEATURE_FLAGS + /// + /// Bitfield (set of flags) of all generator features that are enabled + /// by default. + static int get DEFAULT_GENERATOR_FEATURE_FLAGS => + _get_DEFAULT_GENERATOR_FEATURE_FLAGS().integer; + + static final _get_DEFAULT_ROOT_VALUE_SEPARATOR = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR") + .asFunction<jni.JniResult Function()>(); + + /// from: static public final com.fasterxml.jackson.core.SerializableString DEFAULT_ROOT_VALUE_SEPARATOR + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JObject get DEFAULT_ROOT_VALUE_SEPARATOR => const jni.JObjectType() + .fromRef(_get_DEFAULT_ROOT_VALUE_SEPARATOR().object); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Default constructor used to create factory instances. + /// Creation of a factory instance is a light-weight operation, + /// but it is still a good idea to reuse limited number of + /// factory instances (and quite often just a single instance): + /// factories are used as context for storing some reused + /// processing objects (such as symbol tables parsers use) + /// and this reuse only works within context of a single + /// factory instance. + factory JsonFactory() { + return JsonFactory.fromRef(_ctor().object); + } + + static final _ctor1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void <init>(com.fasterxml.jackson.core.ObjectCodec oc) + /// The returned object must be deleted after use, by calling the `delete` method. + factory JsonFactory.ctor1( + jni.JObject oc, + ) { + return JsonFactory.fromRef(_ctor1(oc.reference).object); + } + + static final _ctor2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: protected void <init>(com.fasterxml.jackson.core.JsonFactory src, com.fasterxml.jackson.core.ObjectCodec codec) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Constructor used when copy()ing a factory instance. + ///@param src Original factory to copy settings from + ///@param codec Databinding-level codec to use, if any + ///@since 2.2.1 + factory JsonFactory.ctor2( + JsonFactory src, + jni.JObject codec, + ) { + return JsonFactory.fromRef(_ctor2(src.reference, codec.reference).object); + } + + static final _ctor3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor3") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void <init>(com.fasterxml.jackson.core.JsonFactoryBuilder b) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Constructor used by JsonFactoryBuilder for instantiation. + ///@param b Builder that contains settings to use + ///@since 2.10 + factory JsonFactory.ctor3( + jni.JObject b, + ) { + return JsonFactory.fromRef(_ctor3(b.reference).object); + } + + static final _ctor4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__ctor4") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: protected void <init>(com.fasterxml.jackson.core.TSFBuilder<?,?> b, boolean bogus) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Constructor for subtypes; needed to work around the fact that before 3.0, + /// this factory has cumbersome dual role as generic type as well as actual + /// implementation for json. + ///@param b Builder that contains settings to use + ///@param bogus Argument only needed to separate constructor signature; ignored + factory JsonFactory.ctor4( + jni.JObject b, + bool bogus, + ) { + return JsonFactory.fromRef(_ctor4(b.reference, bogus ? 1 : 0).object); + } + + static final _rebuild = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__rebuild") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.TSFBuilder<?,?> rebuild() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that allows construction of differently configured factory, starting + /// with settings of this factory. + ///@return Builder instance to use + ///@since 2.10 + jni.JObject rebuild() { + return const jni.JObjectType().fromRef(_rebuild(reference).object); + } + + static final _builder = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory__builder") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.fasterxml.jackson.core.TSFBuilder<?,?> builder() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Main factory method to use for constructing JsonFactory instances with + /// different configuration: creates and returns a builder for collecting configuration + /// settings; instance created by calling {@code build()} after all configuration + /// set. + /// + /// 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() { + return const jni.JObjectType().fromRef(_builder().object); + } + + static final _copy = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__copy") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory copy() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing a new JsonFactory that has + /// the same settings as this instance, but is otherwise + /// independent (i.e. nothing is actually shared, symbol tables + /// are separate). + /// Note that ObjectCodec reference is not copied but is + /// set to null; caller typically needs to set it after calling + /// this method. Reason for this is that the codec is used for + /// callbacks, and assumption is that there is strict 1-to-1 + /// mapping between codec, factory. Caller has to, then, explicitly + /// set codec after making the copy. + ///@return Copy of this factory instance + ///@since 2.1 + JsonFactory copy() { + return const $JsonFactoryType().fromRef(_copy(reference).object); + } + + static final _readResolve = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__readResolve") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: protected java.lang.Object readResolve() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that we need to override to actually make restoration go + /// through constructors etc: needed to allow JDK serializability of + /// factory instances. + /// + /// Note: must be overridden by sub-classes as well. + ///@return Newly constructed instance + jni.JObject readResolve() { + return const jni.JObjectType().fromRef(_readResolve(reference).object); + } + + static final _requiresPropertyOrdering = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__requiresPropertyOrdering") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean requiresPropertyOrdering() + /// + /// Introspection method that higher-level functionality may call + /// to see whether underlying data format requires a stable ordering + /// of object properties or not. + /// This is usually used for determining + /// whether to force a stable ordering (like alphabetic ordering by name) + /// if no ordering if explicitly specified. + /// + /// Default implementation returns <code>false</code> as JSON does NOT + /// require stable ordering. Formats that require ordering include positional + /// textual formats like <code>CSV</code>, and schema-based binary formats + /// like <code>Avro</code>. + ///@return Whether format supported by this factory + /// requires Object properties to be ordered. + ///@since 2.3 + bool requiresPropertyOrdering() { + return _requiresPropertyOrdering(reference).boolean; + } + + static final _canHandleBinaryNatively = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__canHandleBinaryNatively") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canHandleBinaryNatively() + /// + /// Introspection method that higher-level functionality may call + /// to see whether underlying data format can read and write binary + /// data natively; that is, embeded it as-is without using encodings + /// such as Base64. + /// + /// Default implementation returns <code>false</code> as JSON does not + /// support native access: all binary content must use Base64 encoding. + /// Most binary formats (like Smile and Avro) support native binary content. + ///@return Whether format supported by this factory + /// supports native binary content + ///@since 2.3 + bool canHandleBinaryNatively() { + return _canHandleBinaryNatively(reference).boolean; + } + + static final _canUseCharArrays = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__canUseCharArrays") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canUseCharArrays() + /// + /// Introspection method that can be used by base factory to check + /// whether access using <code>char[]</code> is something that actual + /// parser implementations can take advantage of, over having to + /// use java.io.Reader. Sub-types are expected to override + /// definition; default implementation (suitable for JSON) alleges + /// that optimization are possible; and thereby is likely to try + /// to access java.lang.String content by first copying it into + /// recyclable intermediate buffer. + ///@return Whether access to decoded textual content can be efficiently + /// accessed using parser method {@code getTextCharacters()}. + ///@since 2.4 + bool canUseCharArrays() { + return _canUseCharArrays(reference).boolean; + } + + static final _canParseAsync = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__canParseAsync") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canParseAsync() + /// + /// Introspection method that can be used to check whether this + /// factory can create non-blocking parsers: parsers that do not + /// use blocking I/O abstractions but instead use a + /// com.fasterxml.jackson.core.async.NonBlockingInputFeeder. + ///@return Whether this factory supports non-blocking ("async") parsing or + /// not (and consequently whether {@code createNonBlockingXxx()} method(s) work) + ///@since 2.9 + bool canParseAsync() { + return _canParseAsync(reference).boolean; + } + + static final _getFormatReadFeatureType = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatReadFeatureType") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// 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() { + return const jni.JObjectType() + .fromRef(_getFormatReadFeatureType(reference).object); + } + + static final _getFormatWriteFeatureType = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatWriteFeatureType") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// 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() { + return const jni.JObjectType() + .fromRef(_getFormatWriteFeatureType(reference).object); + } + + static final _canUseSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__canUseSchema") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) + /// + /// Method that can be used to quickly check whether given schema + /// is something that parsers and/or generators constructed by this + /// factory could use. Note that this means possible use, at the level + /// of data format (i.e. schema is for same data format as parsers and + /// generators this factory constructs); individual schema instances + /// may have further usage restrictions. + ///@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, + ) { + return _canUseSchema(reference, schema.reference).boolean; + } + + static final _getFormatName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getFormatName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getFormatName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that returns short textual id identifying format + /// this factory supports. + /// + /// 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() { + return const jni.JStringType().fromRef(_getFormatName(reference).object); + } + + static final _hasFormat = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__hasFormat") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// 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, + ) { + return const jni.JObjectType() + .fromRef(_hasFormat(reference, acc.reference).object); + } + + static final _requiresCustomCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__requiresCustomCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean requiresCustomCodec() + /// + /// Method that can be called to determine if a custom + /// ObjectCodec is needed for binding data parsed + /// using JsonParser constructed by this factory + /// (which typically also implies the same for serialization + /// with JsonGenerator). + ///@return True if custom codec is needed with parsers and + /// generators created by this factory; false if a general + /// ObjectCodec is enough + ///@since 2.1 + bool requiresCustomCodec() { + return _requiresCustomCodec(reference).boolean; + } + + static final _hasJSONFormat = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__hasJSONFormat") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// 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, + ) { + return const jni.JObjectType() + .fromRef(_hasJSONFormat(reference, acc.reference).object); + } + + static final _version = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__version") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.Version version() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject version() { + return const jni.JObjectType().fromRef(_version(reference).object); + } + + static final _configure = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonFactory.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified parser feature + /// (check JsonParser.Feature for list of features) + ///@param f Feature to enable/disable + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_configure(reference, f.reference, state ? 1 : 0).object); + } + + static final _enable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__enable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonFactory.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified parser feature + /// (check JsonFactory.Feature for list of features) + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_enable(reference, f.reference).object); + } + + static final _disable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__disable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonFactory.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified parser features + /// (check JsonFactory.Feature for list of features) + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_disable(reference, f.reference).object); + } + + static final _isEnabled = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonFactory.Feature f) + /// + /// 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, + ) { + return _isEnabled(reference, f.reference).boolean; + } + + static final _getParserFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getParserFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final int getParserFeatures() + int getParserFeatures() { + return _getParserFeatures(reference).integer; + } + + static final _getGeneratorFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getGeneratorFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final int getGeneratorFeatures() + int getGeneratorFeatures() { + return _getGeneratorFeatures(reference).integer; + } + + static final _getFormatParserFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatParserFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFormatParserFeatures() + int getFormatParserFeatures() { + return _getFormatParserFeatures(reference).integer; + } + + static final _getFormatGeneratorFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatGeneratorFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFormatGeneratorFeatures() + int getFormatGeneratorFeatures() { + return _getFormatGeneratorFeatures(reference).integer; + } + + static final _configure1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified parser feature + /// (check JsonParser.Feature for list of features) + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_configure1(reference, f.reference, state ? 1 : 0).object); + } + + static final _enable1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__enable1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified parser feature + /// (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, + ) { + return const $JsonFactoryType() + .fromRef(_enable1(reference, f.reference).object); + } + + static final _disable1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__disable1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified parser features + /// (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, + ) { + return const $JsonFactoryType() + .fromRef(_disable1(reference, f.reference).object); + } + + static final _isEnabled1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f) + /// + /// 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, + ) { + return _isEnabled1(reference, f.reference).boolean; + } + + static final _isEnabled2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f) + /// + /// Method for checking if the specified stream read feature is enabled. + ///@param f Feature to check + ///@return True if specified feature is enabled + ///@since 2.10 + bool isEnabled2( + jni.JObject f, + ) { + return _isEnabled2(reference, f.reference).boolean; + } + + static final _getInputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getInputDecorator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.io.InputDecorator getInputDecorator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for getting currently configured input decorator (if any; + /// there is no default decorator). + ///@return InputDecorator configured, if any + jni.JObject getInputDecorator() { + return const jni.JObjectType() + .fromRef(_getInputDecorator(reference).object); + } + + static final _setInputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setInputDecorator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setInputDecorator(com.fasterxml.jackson.core.io.InputDecorator d) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for overriding currently configured input decorator + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_setInputDecorator(reference, d.reference).object); + } + + static final _configure2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonGenerator.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified generator feature + /// (check JsonGenerator.Feature for list of features) + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_configure2(reference, f.reference, state ? 1 : 0).object); + } + + static final _enable2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__enable2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonGenerator.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified generator features + /// (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, + ) { + return const $JsonFactoryType() + .fromRef(_enable2(reference, f.reference).object); + } + + static final _disable2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__disable2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonGenerator.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified generator feature + /// (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, + ) { + return const $JsonFactoryType() + .fromRef(_disable2(reference, f.reference).object); + } + + static final _isEnabled3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled3") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f) + /// + /// Check whether specified generator feature is enabled. + ///@param f Feature to check + ///@return Whether specified feature is enabled + bool isEnabled3( + jni.JObject f, + ) { + return _isEnabled3(reference, f.reference).boolean; + } + + static final _isEnabled4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled4") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.StreamWriteFeature f) + /// + /// Check whether specified stream write feature is enabled. + ///@param f Feature to check + ///@return Whether specified feature is enabled + ///@since 2.10 + bool isEnabled4( + jni.JObject f, + ) { + return _isEnabled4(reference, f.reference).boolean; + } + + static final _getCharacterEscapes = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getCharacterEscapes") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.io.CharacterEscapes getCharacterEscapes() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for accessing custom escapes factory uses for JsonGenerators + /// it creates. + ///@return Configured {@code CharacterEscapes}, if any; {@code null} if none + jni.JObject getCharacterEscapes() { + return const jni.JObjectType() + .fromRef(_getCharacterEscapes(reference).object); + } + + static final _setCharacterEscapes = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setCharacterEscapes") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setCharacterEscapes(com.fasterxml.jackson.core.io.CharacterEscapes esc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for defining custom escapes factory uses for JsonGenerators + /// 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, + ) { + return const $JsonFactoryType() + .fromRef(_setCharacterEscapes(reference, esc.reference).object); + } + + static final _getOutputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getOutputDecorator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.io.OutputDecorator getOutputDecorator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for getting currently configured output decorator (if any; + /// there is no default decorator). + ///@return OutputDecorator configured for generators factory creates, if any; + /// {@code null} if none. + jni.JObject getOutputDecorator() { + return const jni.JObjectType() + .fromRef(_getOutputDecorator(reference).object); + } + + static final _setOutputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setOutputDecorator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setOutputDecorator(com.fasterxml.jackson.core.io.OutputDecorator d) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for overriding currently configured output decorator + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_setOutputDecorator(reference, d.reference).object); + } + + static final _setRootValueSeparator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setRootValueSeparator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setRootValueSeparator(java.lang.String sep) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that allows overriding String used for separating root-level + /// JSON values (default is single space character) + ///@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, + ) { + return const $JsonFactoryType() + .fromRef(_setRootValueSeparator(reference, sep.reference).object); + } + + static final _getRootValueSeparator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getRootValueSeparator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getRootValueSeparator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// @return Root value separator configured, if any + jni.JString getRootValueSeparator() { + return const jni.JStringType() + .fromRef(_getRootValueSeparator(reference).object); + } + + static final _setCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setCodec") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setCodec(com.fasterxml.jackson.core.ObjectCodec oc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for associating a ObjectCodec (typically + /// a <code>com.fasterxml.jackson.databind.ObjectMapper</code>) + /// with this factory (and more importantly, parsers and generators + /// it constructs). This is needed to use data-binding methods + /// of JsonParser and JsonGenerator instances. + ///@param oc Codec to use + ///@return This factory instance (to allow call chaining) + JsonFactory setCodec( + jni.JObject oc, + ) { + return const $JsonFactoryType() + .fromRef(_setCodec(reference, oc.reference).object); + } + + static final _getCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.ObjectCodec getCodec() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject getCodec() { + return const jni.JObjectType().fromRef(_getCodec(reference).object); + } + + static final _createParser = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.File f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of specified file. + /// + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// 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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser(reference, f.reference).object); + } + + static final _createParser1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.net.URL url) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of resource reference by given URL. + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// 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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser1(reference, url.reference).object); + } + + static final _createParser2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.InputStream in) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// the contents accessed via specified input stream. + /// + /// The input stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.StreamReadFeature\#AUTO_CLOSE_SOURCE + /// is enabled. + /// + /// + /// Note: no encoding argument is taken since it can always be + /// auto-detected as suggested by JSON RFC. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// 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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser2(reference, in0.reference).object); + } + + static final _createParser3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser3") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.Reader r) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents accessed via specified Reader. + /// + /// The read stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.StreamReadFeature\#AUTO_CLOSE_SOURCE + /// is enabled. + ///@param r Reader to use for reading JSON content to parse + ///@since 2.1 + jsonparser_.JsonParser createParser3( + jni.JObject r, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser3(reference, r.reference).object); + } + + static final _createParser4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser4") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(byte[] data) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents of given byte array. + ///@since 2.1 + jsonparser_.JsonParser createParser4( + jni.JArray<jni.JByte> data, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser4(reference, data.reference).object); + } + + static final _createParser5 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Int32, + ffi.Int32)>>("JsonFactory__createParser5") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(byte[] data, int offset, int len) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents of given byte array. + ///@param data Buffer that contains data to parse + ///@param offset Offset of the first data byte within buffer + ///@param len Length of contents to parse within buffer + ///@since 2.1 + jsonparser_.JsonParser createParser5( + jni.JArray<jni.JByte> data, + int offset, + int len, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser5(reference, data.reference, offset, len).object); + } + + static final _createParser6 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser6") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.lang.String content) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// contents of given String. + ///@since 2.1 + jsonparser_.JsonParser createParser6( + jni.JString content, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser6(reference, content.reference).object); + } + + static final _createParser7 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser7") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(char[] content) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// contents of given char array. + ///@since 2.4 + jsonparser_.JsonParser createParser7( + jni.JArray<jni.JChar> content, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser7(reference, content.reference).object); + } + + static final _createParser8 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Int32, + ffi.Int32)>>("JsonFactory__createParser8") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(char[] content, int offset, int len) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// 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, + ) { + return const jsonparser_.$JsonParserType().fromRef( + _createParser8(reference, content.reference, offset, len).object); + } + + static final _createParser9 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser9") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.DataInput in) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Optional method for constructing parser for reading contents from specified DataInput + /// instance. + /// + /// If this factory does not support DataInput as source, + /// will throw UnsupportedOperationException + ///@since 2.8 + jsonparser_.JsonParser createParser9( + jni.JObject in0, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createParser9(reference, in0.reference).object); + } + + static final _createNonBlockingByteArrayParser = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__createNonBlockingByteArrayParser") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createNonBlockingByteArrayParser() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Optional method for constructing parser for non-blocking parsing + /// via com.fasterxml.jackson.core.async.ByteArrayFeeder + /// interface (accessed using JsonParser\#getNonBlockingInputFeeder() + /// from constructed instance). + /// + /// If this factory does not support non-blocking parsing (either at all, + /// or from byte array), + /// will throw UnsupportedOperationException. + /// + /// Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content + /// (and US-ASCII since it is proper subset); other encodings are not supported + /// at this point. + ///@since 2.9 + jsonparser_.JsonParser createNonBlockingByteArrayParser() { + return const jsonparser_.$JsonParserType() + .fromRef(_createNonBlockingByteArrayParser(reference).object); + } + + static final _createGenerator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified output stream. + /// Encoding to use must be specified, and needs to be one of available + /// types (as per JSON specification). + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the output stream when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET + /// is enabled). + /// Using application needs to close it explicitly if this is the case. + /// + /// Note: there are formats that use fixed encoding (like most binary data formats) + /// and that ignore passed in encoding. + ///@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, + ) { + return const jni.JObjectType().fromRef( + _createGenerator(reference, out.reference, enc.reference).object); + } + + static final _createGenerator1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience method for constructing generator that uses default + /// encoding of the format (UTF-8 for JSON and most other data formats). + /// + /// Note: there are formats that use fixed encoding (like most binary data formats). + ///@since 2.1 + jni.JObject createGenerator1( + jni.JObject out, + ) { + return const jni.JObjectType() + .fromRef(_createGenerator1(reference, out.reference).object); + } + + static final _createGenerator2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.Writer w) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified Writer. + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the Reader when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET is enabled). + /// 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, + ) { + return const jni.JObjectType() + .fromRef(_createGenerator2(reference, w.reference).object); + } + + static final _createGenerator3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator3") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.File f, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// to specified file, overwriting contents it might have (or creating + /// it if such file does not yet exist). + /// Encoding to use must be specified, and needs to be one of available + /// types (as per JSON specification). + /// + /// Underlying stream __is owned__ by the generator constructed, + /// i.e. generator will handle closing of file when + /// JsonGenerator\#close is called. + ///@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, + ) { + return const jni.JObjectType().fromRef( + _createGenerator3(reference, f.reference, enc.reference).object); + } + + static final _createGenerator4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator4") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing generator for writing content using specified + /// DataOutput instance. + ///@since 2.8 + jni.JObject createGenerator4( + jni.JObject out, + jni.JObject enc, + ) { + return const jni.JObjectType().fromRef( + _createGenerator4(reference, out.reference, enc.reference).object); + } + + static final _createGenerator5 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator5") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience method for constructing generator that uses default + /// encoding of the format (UTF-8 for JSON and most other data formats). + /// + /// Note: there are formats that use fixed encoding (like most binary data formats). + ///@since 2.8 + jni.JObject createGenerator5( + jni.JObject out, + ) { + return const jni.JObjectType() + .fromRef(_createGenerator5(reference, out.reference).object); + } + + static final _createJsonParser = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.File f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of specified file. + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// the parser, since caller has no access to it. + ///@param f File that contains JSON content to parse + ///@return Parser constructed + ///@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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createJsonParser(reference, f.reference).object); + } + + static final _createJsonParser1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.net.URL url) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of resource reference by given URL. + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// the parser, since caller has no access to it. + ///@param url URL pointing to resource that contains JSON content to parse + ///@return Parser constructed + ///@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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createJsonParser1(reference, url.reference).object); + } + + static final _createJsonParser2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.InputStream in) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// the contents accessed via specified input stream. + /// + /// The input stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.JsonParser.Feature\#AUTO_CLOSE_SOURCE + /// is enabled. + /// + /// + /// Note: no encoding argument is taken since it can always be + /// auto-detected as suggested by JSON RFC. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + ///@param in InputStream to use for reading JSON content to parse + ///@return Parser constructed + ///@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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createJsonParser2(reference, in0.reference).object); + } + + static final _createJsonParser3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser3") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.Reader r) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents accessed via specified Reader. + /// + /// The read stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.JsonParser.Feature\#AUTO_CLOSE_SOURCE + /// is enabled. + ///@param r Reader to use for reading JSON content to parse + ///@return Parser constructed + ///@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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createJsonParser3(reference, r.reference).object); + } + + static final _createJsonParser4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser4") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing the contents of given byte array. + ///@param data Input content to parse + ///@return Parser constructed + ///@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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createJsonParser4(reference, data.reference).object); + } + + static final _createJsonParser5 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Int32, + ffi.Int32)>>("JsonFactory__createJsonParser5") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data, int offset, int len) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents of given byte array. + ///@param data Buffer that contains data to parse + ///@param offset Offset of the first data byte within buffer + ///@param len Length of contents to parse within buffer + ///@return Parser constructed + ///@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[],int,int) instead. + jsonparser_.JsonParser createJsonParser5( + jni.JArray<jni.JByte> data, + int offset, + int len, + ) { + return const jsonparser_.$JsonParserType().fromRef( + _createJsonParser5(reference, data.reference, offset, len).object); + } + + static final _createJsonParser6 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser6") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.lang.String content) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// contents of given String. + ///@param content Input content to parse + ///@return Parser constructed + ///@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, + ) { + return const jsonparser_.$JsonParserType() + .fromRef(_createJsonParser6(reference, content.reference).object); + } + + static final _createJsonGenerator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified output stream. + /// Encoding to use must be specified, and needs to be one of available + /// types (as per JSON specification). + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the output stream when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET + /// is enabled). + /// Using application needs to close it explicitly if this is the case. + /// + /// Note: there are formats that use fixed encoding (like most binary data formats) + /// and that ignore passed in encoding. + ///@param out OutputStream to use for writing JSON content + ///@param enc Character encoding to use + ///@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, + ) { + return const jni.JObjectType().fromRef( + _createJsonGenerator(reference, out.reference, enc.reference).object); + } + + static final _createJsonGenerator1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.Writer out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified Writer. + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the Reader when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET is enabled). + /// Using application needs to close it explicitly. + ///@param out Writer to use for writing JSON content + ///@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, + ) { + return const jni.JObjectType() + .fromRef(_createJsonGenerator1(reference, out.reference).object); + } + + static final _createJsonGenerator2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience method for constructing generator that uses default + /// encoding of the format (UTF-8 for JSON and most other data formats). + /// + /// Note: there are formats that use fixed encoding (like most binary data formats). + ///@param out OutputStream to use for writing JSON content + ///@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, + ) { + return const jni.JObjectType() + .fromRef(_createJsonGenerator2(reference, out.reference).object); + } +} + +class $JsonFactoryType extends jni.JObjType<JsonFactory> { + const $JsonFactoryType(); + + @override + String get signature => r"Lcom/fasterxml/jackson/core/JsonFactory;"; + + @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 +/// +/// Enumeration that defines all on/off features that can only be +/// changed for JsonFactory. +class JsonFactory_Feature extends jni.JObject { + @override + late final jni.JObjType $type = type; + + JsonFactory_Feature.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $JsonFactory_FeatureType(); + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory_Feature__values") + .asFunction<jni.JniResult Function()>(); + + /// 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() { + return const jni.JArrayType($JsonFactory_FeatureType()) + .fromRef(_values().object); + } + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory_Feature__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// 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, + ) { + return const $JsonFactory_FeatureType() + .fromRef(_valueOf(name.reference).object); + } + + static final _collectDefaults = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory_Feature__collectDefaults") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int collectDefaults() + /// + /// 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() { + return _collectDefaults().integer; + } + + static final _enabledByDefault = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory_Feature__enabledByDefault") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean enabledByDefault() + bool enabledByDefault() { + return _enabledByDefault(reference).boolean; + } + + static final _enabledIn = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonFactory_Feature__enabledIn") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public boolean enabledIn(int flags) + bool enabledIn( + int flags, + ) { + return _enabledIn(reference, flags).boolean; + } + + static final _getMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory_Feature__getMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getMask() + int getMask() { + return _getMask(reference).integer; + } +} + +class $JsonFactory_FeatureType extends jni.JObjType<JsonFactory_Feature> { + const $JsonFactory_FeatureType(); + + @override + String get signature => r"Lcom/fasterxml/jackson/core/JsonFactory$Feature;"; + + @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/c_based/dart_bindings/com/fasterxml/jackson/core/JsonParser.dart b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonParser.dart new file mode 100644 index 0000000..54e45f8 --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonParser.dart
@@ -0,0 +1,2842 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: file_names +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_shown_name + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "JsonToken.dart" as jsontoken_; +import "../../../../_init.dart"; + +/// from: com.fasterxml.jackson.core.JsonParser +/// +/// Base class that defines public API for reading JSON content. +/// Instances are created using factory methods of +/// a JsonFactory instance. +///@author Tatu Saloranta +class JsonParser extends jni.JObject { + @override + late final jni.JObjType $type = type; + + JsonParser.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $JsonParserType(); + static final _get_DEFAULT_READ_CAPABILITIES = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonParser__DEFAULT_READ_CAPABILITIES") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> DEFAULT_READ_CAPABILITIES + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Default set of StreamReadCapabilityies that may be used as + /// basis for format-specific readers (or as bogus instance if non-null + /// set needs to be passed). + ///@since 2.12 + static jni.JObject get DEFAULT_READ_CAPABILITIES => + const jni.JObjectType().fromRef(_get_DEFAULT_READ_CAPABILITIES().object); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: protected void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory JsonParser() { + return JsonParser.fromRef(_ctor().object); + } + + static final _ctor1 = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( + "JsonParser__ctor1") + .asFunction<jni.JniResult Function(int)>(); + + /// from: protected void <init>(int features) + /// The returned object must be deleted after use, by calling the `delete` method. + factory JsonParser.ctor1( + int features, + ) { + return JsonParser.fromRef(_ctor1(features).object); + } + + static final _getCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.ObjectCodec getCodec() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor for ObjectCodec associated with this + /// 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() { + return const jni.JObjectType().fromRef(_getCodec(reference).object); + } + + static final _setCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__setCodec") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void setCodec(com.fasterxml.jackson.core.ObjectCodec oc) + /// + /// Setter that allows defining ObjectCodec associated with this + /// 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, + ) { + return _setCodec(reference, oc.reference).check(); + } + + static final _getInputSource = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getInputSource") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getInputSource() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be used to get access to object that is used + /// to access input being parsed; this is usually either + /// InputStream or Reader, depending on what + /// parser was constructed with. + /// Note that returned value may be null in some cases; including + /// case where parser implementation does not want to exposed raw + /// source to caller. + /// In cases where input has been decorated, object returned here + /// is the decorated version; this allows some level of interaction + /// between users of parser and decorator object. + /// + /// 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() { + return const jni.JObjectType().fromRef(_getInputSource(reference).object); + } + + static final _setRequestPayloadOnError = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "JsonParser__setRequestPayloadOnError") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setRequestPayloadOnError(com.fasterxml.jackson.core.util.RequestPayload payload) + /// + /// Sets the payload to be passed if JsonParseException is thrown. + ///@param payload Payload to pass + ///@since 2.8 + void setRequestPayloadOnError( + jni.JObject payload, + ) { + return _setRequestPayloadOnError(reference, payload.reference).check(); + } + + static final _setRequestPayloadOnError1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "JsonParser__setRequestPayloadOnError1") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public void setRequestPayloadOnError(byte[] payload, java.lang.String charset) + /// + /// Sets the byte[] request payload and the charset + ///@param payload Payload to pass + ///@param charset Character encoding for (lazily) decoding payload + ///@since 2.8 + void setRequestPayloadOnError1( + jni.JArray<jni.JByte> payload, + jni.JString charset, + ) { + return _setRequestPayloadOnError1( + reference, payload.reference, charset.reference) + .check(); + } + + static final _setRequestPayloadOnError2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "JsonParser__setRequestPayloadOnError2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setRequestPayloadOnError(java.lang.String payload) + /// + /// Sets the String request payload + ///@param payload Payload to pass + ///@since 2.8 + void setRequestPayloadOnError2( + jni.JString payload, + ) { + return _setRequestPayloadOnError2(reference, payload.reference).check(); + } + + static final _setSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__setSchema") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setSchema(com.fasterxml.jackson.core.FormatSchema schema) + /// + /// Method to call to make this parser use specified schema. Method must + /// be called before trying to parse any content, right after parser instance + /// has been created. + /// Note that not all parsers support schemas; and those that do usually only + /// accept specific types of schemas: ones defined for data format parser can read. + /// + /// If parser does not support specified schema, UnsupportedOperationException + /// is thrown. + ///@param schema Schema to use + ///@throws UnsupportedOperationException if parser does not support schema + void setSchema( + jni.JObject schema, + ) { + return _setSchema(reference, schema.reference).check(); + } + + static final _getSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getSchema") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.FormatSchema getSchema() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for accessing Schema that this parser uses, if any. + /// Default implementation returns null. + ///@return Schema in use by this parser, if any; {@code null} if none + ///@since 2.1 + jni.JObject getSchema() { + return const jni.JObjectType().fromRef(_getSchema(reference).object); + } + + static final _canUseSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__canUseSchema") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) + /// + /// Method that can be used to verify that given schema can be used with + /// 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, + ) { + return _canUseSchema(reference, schema.reference).boolean; + } + + static final _requiresCustomCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__requiresCustomCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean requiresCustomCodec() + /// + /// Method that can be called to determine if a custom + /// ObjectCodec is needed for binding data parsed + /// using JsonParser constructed by this factory + /// (which typically also implies the same for serialization + /// with JsonGenerator). + ///@return True if format-specific codec is needed with this parser; false if a general + /// ObjectCodec is enough + ///@since 2.1 + bool requiresCustomCodec() { + return _requiresCustomCodec(reference).boolean; + } + + static final _canParseAsync = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__canParseAsync") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canParseAsync() + /// + /// Method that can be called to determine if this parser instance + /// uses non-blocking ("asynchronous") input access for decoding or not. + /// Access mode is determined by earlier calls via JsonFactory; + /// it may not be changed after construction. + /// + /// If non-blocking decoding is (@code true}, it is possible to call + /// \#getNonBlockingInputFeeder() to obtain object to use + /// for feeding input; otherwise (<code>false</code> returned) + /// input is read by blocking + ///@return True if this is a non-blocking ("asynchronous") parser + ///@since 2.9 + bool canParseAsync() { + return _canParseAsync(reference).boolean; + } + + static final _getNonBlockingInputFeeder = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__getNonBlockingInputFeeder") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.async.NonBlockingInputFeeder getNonBlockingInputFeeder() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will either return a feeder instance (if parser uses + /// non-blocking, aka asynchronous access); or <code>null</code> for + /// parsers that use blocking I/O. + ///@return Input feeder to use with non-blocking (async) parsing + ///@since 2.9 + jni.JObject getNonBlockingInputFeeder() { + return const jni.JObjectType() + .fromRef(_getNonBlockingInputFeeder(reference).object); + } + + static final _getReadCapabilities = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getReadCapabilities") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> getReadCapabilities() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor for getting metadata on capabilities of this parser, based on + /// 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() { + return const jni.JObjectType() + .fromRef(_getReadCapabilities(reference).object); + } + + static final _version = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__version") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.Version version() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor for getting version of the core package, given a parser instance. + /// 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() { + return const jni.JObjectType().fromRef(_version(reference).object); + } + + static final _close = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__close") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void close() + /// + /// Closes the parser so that no further iteration or data access + /// can be made; will also close the underlying input source + /// if parser either __owns__ the input source, or feature + /// Feature\#AUTO_CLOSE_SOURCE is enabled. + /// Whether parser owns the input source depends on factory + /// method that was used to construct instance (so check + /// com.fasterxml.jackson.core.JsonFactory for details, + /// but the general + /// idea is that if caller passes in closable resource (such + /// as InputStream or Reader) parser does NOT + /// own the source; but if it passes a reference (such as + /// 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() { + return _close(reference).check(); + } + + static final _isClosed = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__isClosed") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean isClosed() + /// + /// Method that can be called to determine whether this parser + /// is closed or not. If it is closed, no new tokens can be + /// retrieved by calling \#nextToken (and the underlying + /// stream may be closed). Closing may be due to an explicit + /// call to \#close or because parser has encountered + /// end of input. + ///@return {@code True} if this parser instance has been closed + bool isClosed() { + return _isClosed(reference).boolean; + } + + static final _getParsingContext = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getParsingContext") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonStreamContext getParsingContext() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be used to access current parsing context reader + /// is in. There are 3 different types: root, array and object contexts, + /// with slightly different available information. Contexts are + /// hierarchically nested, and can be used for example for figuring + /// out part of the input document that correspond to specific + /// array or object (for highlighting purposes, or error reporting). + /// 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() { + return const jni.JObjectType() + .fromRef(_getParsingContext(reference).object); + } + + static final _currentLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonLocation currentLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that returns location of the last processed input unit (character + /// or byte) from the input; + /// usually for error reporting purposes. + /// + /// Note that the location is not guaranteed to be accurate (although most + /// implementation will try their best): some implementations may only + /// report specific boundary locations (start or end locations of tokens) + /// and others only return JsonLocation\#NA due to not having access + /// to input location information (when delegating actual decoding work + /// to other library) + ///@return Location of the last processed input unit (byte or character) + ///@since 2.13 + jni.JObject currentLocation() { + return const jni.JObjectType().fromRef(_currentLocation(reference).object); + } + + static final _currentTokenLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentTokenLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonLocation currentTokenLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that return the __starting__ location of the current + /// (most recently returned) + /// token; that is, the position of the first input unit (character or byte) from input + /// that starts the current token. + /// + /// Note that the location is not guaranteed to be accurate (although most + /// implementation will try their best): some implementations may only + /// return JsonLocation\#NA due to not having access + /// to input location information (when delegating actual decoding work + /// to other library) + ///@return Starting location of the token parser currently points to + ///@since 2.13 (will eventually replace \#getTokenLocation) + jni.JObject currentTokenLocation() { + return const jni.JObjectType() + .fromRef(_currentTokenLocation(reference).object); + } + + static final _getCurrentLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonLocation getCurrentLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// 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() { + return const jni.JObjectType() + .fromRef(_getCurrentLocation(reference).object); + } + + static final _getTokenLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTokenLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonLocation getTokenLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// 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() { + return const jni.JObjectType().fromRef(_getTokenLocation(reference).object); + } + + static final _currentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object currentValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Helper method, usually equivalent to: + ///<code> + /// getParsingContext().getCurrentValue(); + ///</code> + /// + /// Note that "current value" is NOT populated (or used) by Streaming parser; + /// it is only used by higher-level data-binding functionality. + /// The reason it is included here is that it can be stored and accessed hierarchically, + /// 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() { + return const jni.JObjectType().fromRef(_currentValue(reference).object); + } + + static final _assignCurrentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__assignCurrentValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void assignCurrentValue(java.lang.Object v) + /// + /// Helper method, usually equivalent to: + ///<code> + /// getParsingContext().setCurrentValue(v); + ///</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, + ) { + return _assignCurrentValue(reference, v.reference).check(); + } + + static final _getCurrentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getCurrentValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// 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() { + return const jni.JObjectType().fromRef(_getCurrentValue(reference).object); + } + + static final _setCurrentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__setCurrentValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setCurrentValue(java.lang.Object v) + /// + /// 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, + ) { + return _setCurrentValue(reference, v.reference).check(); + } + + static final _releaseBuffered = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__releaseBuffered") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int releaseBuffered(java.io.OutputStream out) + /// + /// Method that can be called to push back any content that + /// has been read but not consumed by the parser. This is usually + /// done after reading all content of interest using parser. + /// Content is released by writing it to given stream if possible; + /// if underlying input is byte-based it can released, if not (char-based) + /// it can not. + ///@param out OutputStream to which buffered, undecoded content is written to + ///@return -1 if the underlying content source is not byte based + /// (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, + ) { + return _releaseBuffered(reference, out.reference).integer; + } + + static final _releaseBuffered1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__releaseBuffered1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int releaseBuffered(java.io.Writer w) + /// + /// Method that can be called to push back any content that + /// has been read but not consumed by the parser. + /// This is usually + /// done after reading all content of interest using parser. + /// Content is released by writing it to given writer if possible; + /// if underlying input is char-based it can released, if not (byte-based) + /// it can not. + ///@param w Writer to which buffered but unprocessed content is written to + ///@return -1 if the underlying content source is not char-based + /// (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, + ) { + return _releaseBuffered1(reference, w.reference).integer; + } + + static final _enable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__enable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser enable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified parser feature + /// (check Feature for list of features) + ///@param f Feature to enable + ///@return This parser, to allow call chaining + JsonParser enable( + JsonParser_Feature f, + ) { + return const $JsonParserType() + .fromRef(_enable(reference, f.reference).object); + } + + static final _disable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__disable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser disable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified feature + /// (check Feature for list of features) + ///@param f Feature to disable + ///@return This parser, to allow call chaining + JsonParser disable( + JsonParser_Feature f, + ) { + return const $JsonParserType() + .fromRef(_disable(reference, f.reference).object); + } + + static final _configure = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonParser__configure") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified feature + /// (check Feature for list of features) + ///@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, + ) { + return const $JsonParserType() + .fromRef(_configure(reference, f.reference, state ? 1 : 0).object); + } + + static final _isEnabled = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__isEnabled") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f) + /// + /// 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, + ) { + return _isEnabled(reference, f.reference).boolean; + } + + static final _isEnabled1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__isEnabled1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f) + /// + /// Method for checking whether specified Feature is enabled. + ///@param f Feature to check + ///@return {@code True} if feature is enabled; {@code false} otherwise + ///@since 2.10 + bool isEnabled1( + jni.JObject f, + ) { + return _isEnabled1(reference, f.reference).boolean; + } + + static final _getFeatureMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getFeatureMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFeatureMask() + /// + /// 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() { + return _getFeatureMask(reference).integer; + } + + static final _setFeatureMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser__setFeatureMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser setFeatureMask(int mask) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Bulk set method for (re)setting states of all standard Features + ///@param mask Bit mask that defines set of features to enable + ///@return This parser, to allow call chaining + ///@since 2.3 + ///@deprecated Since 2.7, use \#overrideStdFeatures(int, int) instead + JsonParser setFeatureMask( + int mask, + ) { + return const $JsonParserType() + .fromRef(_setFeatureMask(reference, mask).object); + } + + static final _overrideStdFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int32, + ffi.Int32)>>("JsonParser__overrideStdFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser overrideStdFeatures(int values, int mask) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Bulk set method for (re)setting states of features specified by <code>mask</code>. + /// Functionally equivalent to + ///<code> + /// int oldState = getFeatureMask(); + /// int newState = (oldState & ~mask) | (values & mask); + /// setFeatureMask(newState); + ///</code> + /// but preferred as this lets caller more efficiently specify actual changes made. + ///@param values Bit mask of set/clear state for features to change + ///@param mask Bit mask of features to change + ///@return This parser, to allow call chaining + ///@since 2.6 + JsonParser overrideStdFeatures( + int values, + int mask, + ) { + return const $JsonParserType() + .fromRef(_overrideStdFeatures(reference, values, mask).object); + } + + static final _getFormatFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getFormatFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFormatFeatures() + /// + /// Bulk access method for getting state of all FormatFeatures, format-specific + /// on/off configuration settings. + ///@return Bit mask that defines current states of all standard FormatFeatures. + ///@since 2.6 + int getFormatFeatures() { + return _getFormatFeatures(reference).integer; + } + + static final _overrideFormatFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int32, + ffi.Int32)>>("JsonParser__overrideFormatFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser overrideFormatFeatures(int values, int mask) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Bulk set method for (re)setting states of FormatFeatures, + /// by specifying values (set / clear) along with a mask, to determine + /// which features to change, if any. + /// + /// Default implementation will simply throw an exception to indicate that + /// the parser implementation does not support any FormatFeatures. + ///@param values Bit mask of set/clear state for features to change + ///@param mask Bit mask of features to change + ///@return This parser, to allow call chaining + ///@since 2.6 + JsonParser overrideFormatFeatures( + int values, + int mask, + ) { + return const $JsonParserType() + .fromRef(_overrideFormatFeatures(reference, values, mask).object); + } + + static final _nextToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken nextToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Main iteration method, which will advance stream enough + /// to determine type of the next token, if any. If none + /// remaining (stream has no content other than possible + /// white space before ending), null will be returned. + ///@return Next token from the stream, if any found, or null + /// to indicate end-of-input + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jsontoken_.JsonToken nextToken() { + return const jsontoken_.$JsonTokenType() + .fromRef(_nextToken(reference).object); + } + + static final _nextValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken nextValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Iteration method that will advance stream enough + /// to determine type of the next token that is a value type + /// (including JSON Array and Object start/end markers). + /// Or put another way, nextToken() will be called once, + /// and if JsonToken\#FIELD_NAME is returned, another + /// time to get the value for the field. + /// Method is most useful for iterating over value entries + /// of JSON objects; field name will still be available + /// by calling \#getCurrentName when parser points to + /// the value. + ///@return Next non-field-name token from the stream, if any found, + /// or null to indicate end-of-input (or, for non-blocking + /// parsers, JsonToken\#NOT_AVAILABLE if no tokens were + /// available yet) + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jsontoken_.JsonToken nextValue() { + return const jsontoken_.$JsonTokenType() + .fromRef(_nextValue(reference).object); + } + + static final _nextFieldName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__nextFieldName") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean nextFieldName(com.fasterxml.jackson.core.SerializableString str) + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// verifies whether it is JsonToken\#FIELD_NAME with specified name + /// and returns result of that comparison. + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName()); + ///</pre> + /// but may be faster for parser to verify, and can therefore be used if caller + /// expects to get such a property name from input next. + ///@param str Property name to compare next token to (if next token is + /// <code>JsonToken.FIELD_NAME</code>) + ///@return {@code True} if parser advanced to {@code JsonToken.FIELD_NAME} with + /// 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, + ) { + return _nextFieldName(reference, str.reference).boolean; + } + + static final _nextFieldName1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextFieldName1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String nextFieldName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// verifies whether it is JsonToken\#FIELD_NAME; if it is, + /// returns same as \#getCurrentName(), otherwise null. + ///@return Name of the the {@code JsonToken.FIELD_NAME} parser advanced to, if any; + /// {@code null} if next token is of some other type + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.5 + jni.JString nextFieldName1() { + return const jni.JStringType().fromRef(_nextFieldName1(reference).object); + } + + static final _nextTextValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextTextValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String nextTextValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_STRING returns contained String value; + /// otherwise returns null. + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get a String value next from input. + ///@return Text value of the {@code JsonToken.VALUE_STRING} 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.JString nextTextValue() { + return const jni.JStringType().fromRef(_nextTextValue(reference).object); + } + + static final _nextIntValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser__nextIntValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public int nextIntValue(int defaultValue) + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_NUMBER_INT returns 32-bit int value; + /// otherwise returns specified default value + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get an int value next from input. + /// + /// NOTE: value checks are performed similar to \#getIntValue() + ///@param defaultValue Value to return if next token is NOT of type {@code JsonToken.VALUE_NUMBER_INT} + ///@return Integer ({@code int}) value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced + /// to; or {@code defaultValue} if next token is of some other type + ///@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, + ) { + return _nextIntValue(reference, defaultValue).integer; + } + + static final _nextLongValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int64)>>("JsonParser__nextLongValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public long nextLongValue(long defaultValue) + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_NUMBER_INT returns 64-bit long value; + /// otherwise returns specified default value + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get a long value next from input. + /// + /// NOTE: value checks are performed similar to \#getLongValue() + ///@param defaultValue Value to return if next token is NOT of type {@code JsonToken.VALUE_NUMBER_INT} + ///@return {@code long} value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced + /// to; or {@code defaultValue} if next token is of some other type + ///@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, + ) { + return _nextLongValue(reference, defaultValue).long; + } + + static final _nextBooleanValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextBooleanValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Boolean nextBooleanValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_TRUE or JsonToken\#VALUE_FALSE + /// returns matching Boolean value; otherwise return null. + /// It is functionally equivalent to: + ///<pre> + /// JsonToken t = nextToken(); + /// if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE; + /// if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE; + /// return null; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get a Boolean value next from input. + ///@return {@code Boolean} value of the {@code JsonToken.VALUE_TRUE} or {@code JsonToken.VALUE_FALSE} + /// 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() { + return const jni.JObjectType().fromRef(_nextBooleanValue(reference).object); + } + + static final _skipChildren = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__skipChildren") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonParser skipChildren() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will skip all child tokens of an array or + /// object token that the parser currently points to, + /// iff stream points to + /// JsonToken\#START_OBJECT or JsonToken\#START_ARRAY. + /// If not, it will do nothing. + /// After skipping, stream will point to __matching__ + /// JsonToken\#END_OBJECT or JsonToken\#END_ARRAY + /// (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens + /// as well as value tokens). + /// The idea is that after calling this method, application + /// will call \#nextToken to point to the next + /// available token, if any. + ///@return This parser, to allow call chaining + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + JsonParser skipChildren() { + return const $JsonParserType().fromRef(_skipChildren(reference).object); + } + + static final _finishToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__finishToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void finishToken() + /// + /// Method that may be used to force full handling of the current token + /// so that even if lazy processing is enabled, the whole contents are + /// read for possible retrieval. This is usually used to ensure that + /// the token end location is available, as well as token contents + /// (similar to what calling, say \#getTextCharacters(), would + /// achieve). + /// + /// Note that for many dataformat implementations this method + /// will not do anything; this is the default implementation unless + /// overridden by sub-classes. + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.8 + void finishToken() { + return _finishToken(reference).check(); + } + + static final _currentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonToken currentToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor to find which token parser currently points to, if any; + /// null will be returned if none. + /// If return value is non-null, data associated with the token + /// is available via other accessor methods. + ///@return Type of the token this parser currently points to, + /// if any: null before any tokens have been read, and + /// after end-of-input has been encountered, as well as + /// if the current token has been explicitly cleared. + ///@since 2.8 + jsontoken_.JsonToken currentToken() { + return const jsontoken_.$JsonTokenType() + .fromRef(_currentToken(reference).object); + } + + static final _currentTokenId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentTokenId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int currentTokenId() + /// + /// Method similar to \#getCurrentToken() but that returns an + /// <code>int</code> instead of JsonToken (enum value). + /// + /// Use of int directly is typically more efficient on switch statements, + /// so this method may be useful when building low-overhead codecs. + /// Note, however, that effect may not be big enough to matter: make sure + /// to profile performance before deciding to use this method. + ///@since 2.8 + ///@return {@code int} matching one of constants from JsonTokenId. + int currentTokenId() { + return _currentTokenId(reference).integer; + } + + static final _getCurrentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken getCurrentToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias for \#currentToken(), may be deprecated sometime after + /// 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() { + return const jsontoken_.$JsonTokenType() + .fromRef(_getCurrentToken(reference).object); + } + + static final _getCurrentTokenId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentTokenId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getCurrentTokenId() + /// + /// Deprecated alias for \#currentTokenId(). + ///@return {@code int} matching one of constants from JsonTokenId. + ///@deprecated Since 2.12 use \#currentTokenId instead + int getCurrentTokenId() { + return _getCurrentTokenId(reference).integer; + } + + static final _hasCurrentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__hasCurrentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean hasCurrentToken() + /// + /// Method for checking whether parser currently points to + /// a token (and data for that token is available). + /// Equivalent to check for <code>parser.getCurrentToken() != null</code>. + ///@return True if the parser just returned a valid + /// token via \#nextToken; false otherwise (parser + /// was just constructed, encountered end-of-input + /// and returned null from \#nextToken, or the token + /// has been consumed) + bool hasCurrentToken() { + return _hasCurrentToken(reference).boolean; + } + + static final _hasTokenId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Int32)>>("JsonParser__hasTokenId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public abstract boolean hasTokenId(int id) + /// + /// Method that is functionally equivalent to: + ///<code> + /// return currentTokenId() == id + ///</code> + /// but may be more efficiently implemented. + /// + /// Note that no traversal or conversion is performed; so in some + /// cases calling method like \#isExpectedStartArrayToken() + /// is necessary instead. + ///@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, + ) { + return _hasTokenId(reference, id).boolean; + } + + static final _hasToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__hasToken") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean hasToken(com.fasterxml.jackson.core.JsonToken t) + /// + /// Method that is functionally equivalent to: + ///<code> + /// return currentToken() == t + ///</code> + /// but may be more efficiently implemented. + /// + /// Note that no traversal or conversion is performed; so in some + /// cases calling method like \#isExpectedStartArrayToken() + /// is necessary instead. + ///@param t Token to match + ///@return {@code True} if the parser current points to specified token + ///@since 2.6 + bool hasToken( + jsontoken_.JsonToken t, + ) { + return _hasToken(reference, t.reference).boolean; + } + + static final _isExpectedStartArrayToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__isExpectedStartArrayToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isExpectedStartArrayToken() + /// + /// Specialized accessor that can be used to verify that the current + /// token indicates start array (usually meaning that current token + /// is JsonToken\#START_ARRAY) when start array is expected. + /// For some specialized parsers this can return true for other cases + /// as well; this is usually done to emulate arrays in cases underlying + /// format is ambiguous (XML, for example, has no format-level difference + /// between Objects and Arrays; it just has elements). + /// + /// Default implementation is equivalent to: + ///<pre> + /// currentToken() == JsonToken.START_ARRAY + ///</pre> + /// but may be overridden by custom parser implementations. + ///@return True if the current token can be considered as a + /// start-array marker (such JsonToken\#START_ARRAY); + /// {@code false} if not + bool isExpectedStartArrayToken() { + return _isExpectedStartArrayToken(reference).boolean; + } + + static final _isExpectedStartObjectToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__isExpectedStartObjectToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isExpectedStartObjectToken() + /// + /// Similar to \#isExpectedStartArrayToken(), but checks whether stream + /// currently points to JsonToken\#START_OBJECT. + ///@return True if the current token can be considered as a + /// start-array marker (such JsonToken\#START_OBJECT); + /// {@code false} if not + ///@since 2.5 + bool isExpectedStartObjectToken() { + return _isExpectedStartObjectToken(reference).boolean; + } + + static final _isExpectedNumberIntToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__isExpectedNumberIntToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isExpectedNumberIntToken() + /// + /// Similar to \#isExpectedStartArrayToken(), but checks whether stream + /// currently points to JsonToken\#VALUE_NUMBER_INT. + /// + /// The initial use case is for XML backend to efficiently (attempt to) coerce + /// textual content into numbers. + ///@return True if the current token can be considered as a + /// start-array marker (such JsonToken\#VALUE_NUMBER_INT); + /// {@code false} if not + ///@since 2.12 + bool isExpectedNumberIntToken() { + return _isExpectedNumberIntToken(reference).boolean; + } + + static final _isNaN = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__isNaN") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isNaN() + /// + /// Access for checking whether current token is a numeric value token, but + /// one that is of "not-a-number" (NaN) variety (including both "NaN" AND + /// positive/negative infinity!): not supported by all formats, + /// but often supported for JsonToken\#VALUE_NUMBER_FLOAT. + /// NOTE: roughly equivalent to calling <code>!Double.isFinite()</code> + /// on value you would get from calling \#getDoubleValue(). + ///@return {@code True} if the current token is of type JsonToken\#VALUE_NUMBER_FLOAT + /// but represents a "Not a Number"; {@code false} for other tokens and regular + /// floating-point numbers + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.9 + bool isNaN() { + return _isNaN(reference).boolean; + } + + static final _clearCurrentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__clearCurrentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void clearCurrentToken() + /// + /// Method called to "consume" the current token by effectively + /// removing it so that \#hasCurrentToken returns false, and + /// \#getCurrentToken null). + /// Cleared token value can still be accessed by calling + /// \#getLastClearedToken (if absolutely needed), but + /// usually isn't. + /// + /// 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() { + return _clearCurrentToken(reference).check(); + } + + static final _getLastClearedToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getLastClearedToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken getLastClearedToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to get the last token that was + /// cleared using \#clearCurrentToken. This is not necessarily + /// the latest token read. + /// 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() { + return const jsontoken_.$JsonTokenType() + .fromRef(_getLastClearedToken(reference).object); + } + + static final _overrideCurrentName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__overrideCurrentName") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void overrideCurrentName(java.lang.String name) + /// + /// Method that can be used to change what is considered to be + /// the current (field) name. + /// May be needed to support non-JSON data formats or unusual binding + /// conventions; not needed for typical processing. + /// + /// 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, + ) { + return _overrideCurrentName(reference, name.reference).check(); + } + + static final _getCurrentName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.String getCurrentName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias of \#currentName(). + ///@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() { + return const jni.JStringType().fromRef(_getCurrentName(reference).object); + } + + static final _currentName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String currentName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to get the name associated with + /// the current token: for JsonToken\#FIELD_NAMEs it will + /// be the same as what \#getText returns; + /// for field values it will be preceding field name; + /// and for others (array values, root-level values) null. + ///@return Name of the current field in the parsing context + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.10 + jni.JString currentName() { + return const jni.JStringType().fromRef(_currentName(reference).object); + } + + static final _getText = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getText") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.String getText() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for accessing textual representation of the current token; + /// if no current token (before first call to \#nextToken, or + /// after encountering end-of-input), returns null. + /// Method can be called for any token type. + ///@return Textual value associated with the current token (one returned + /// by \#nextToken() or other iteration methods) + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JString getText() { + return const jni.JStringType().fromRef(_getText(reference).object); + } + + static final _getText1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__getText1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int getText(java.io.Writer writer) + /// + /// Method to read the textual representation of the current token in chunks and + /// pass it to the given Writer. + /// Conceptually same as calling: + ///<pre> + /// writer.write(parser.getText()); + ///</pre> + /// but should typically be more efficient as longer content does need to + /// be combined into a single <code>String</code> to return, and write + /// can occur directly from intermediate buffers Jackson uses. + ///@param writer Writer to write textual content to + ///@return The number of characters written to the Writer + ///@throws IOException for low-level read issues or writes using passed + /// {@code writer}, or + /// JsonParseException for decoding problems + ///@since 2.8 + int getText1( + jni.JObject writer, + ) { + return _getText1(reference, writer.reference).integer; + } + + static final _getTextCharacters = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTextCharacters") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract char[] getTextCharacters() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method similar to \#getText, but that will return + /// underlying (unmodifiable) character array that contains + /// textual value, instead of constructing a String object + /// to contain this information. + /// Note, however, that: + ///<ul> + /// <li>Textual contents are not guaranteed to start at + /// index 0 (rather, call \#getTextOffset) to + /// know the actual offset + /// </li> + /// <li>Length of textual contents may be less than the + /// length of returned buffer: call \#getTextLength + /// for actual length of returned content. + /// </li> + /// </ul> + /// + /// Note that caller __MUST NOT__ modify the returned + /// character array in any way -- doing so may corrupt + /// current parser state and render parser instance useless. + /// + /// The only reason to call this method (over \#getText) + /// is to avoid construction of a String object (which + /// will make a copy of contents). + ///@return Buffer that contains the current textual value (but not necessarily + /// 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() { + return const jni.JArrayType(jni.JCharType()) + .fromRef(_getTextCharacters(reference).object); + } + + static final _getTextLength = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTextLength") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getTextLength() + /// + /// Accessor used with \#getTextCharacters, to know length + /// of String stored in returned buffer. + ///@return Number of characters within buffer returned + /// by \#getTextCharacters that are part of + /// textual content of the current token. + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getTextLength() { + return _getTextLength(reference).integer; + } + + static final _getTextOffset = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTextOffset") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getTextOffset() + /// + /// Accessor used with \#getTextCharacters, to know offset + /// of the first text content character within buffer. + ///@return Offset of the first character within buffer returned + /// by \#getTextCharacters that is part of + /// textual content of the current token. + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getTextOffset() { + return _getTextOffset(reference).integer; + } + + static final _hasTextCharacters = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__hasTextCharacters") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean hasTextCharacters() + /// + /// Method that can be used to determine whether calling of + /// \#getTextCharacters would be the most efficient + /// way to access textual content for the event parser currently + /// points to. + /// + /// Default implementation simply returns false since only actual + /// implementation class has knowledge of its internal buffering + /// state. + /// Implementations are strongly encouraged to properly override + /// this method, to allow efficient copying of content by other + /// code. + ///@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() { + return _hasTextCharacters(reference).boolean; + } + + static final _getNumberValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.Number getNumberValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Generic number value accessor method that will work for + /// all kinds of numeric values. It will return the optimal + /// (simplest/smallest possible) wrapper object that can + /// express the numeric value just parsed. + ///@return Numeric value of the current token in its most optimal + /// representation + ///@throws IOException Problem with access: JsonParseException if + /// 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() { + return const jni.JObjectType().fromRef(_getNumberValue(reference).object); + } + + static final _getNumberValueExact = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberValueExact") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Number getNumberValueExact() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method similar to \#getNumberValue with the difference that + /// for floating-point numbers value returned may be BigDecimal + /// if the underlying format does not store floating-point numbers using + /// native representation: for example, textual formats represent numbers + /// as Strings (which are 10-based), and conversion to java.lang.Double + /// is potentially lossy operation. + /// + /// Default implementation simply returns \#getNumberValue() + ///@return Numeric value of the current token using most accurate representation + ///@throws IOException Problem with access: JsonParseException if + /// 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) + ///@since 2.12 + jni.JObject getNumberValueExact() { + return const jni.JObjectType() + .fromRef(_getNumberValueExact(reference).object); + } + + static final _getNumberType = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberType") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonParser.NumberType getNumberType() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// If current token is of type + /// JsonToken\#VALUE_NUMBER_INT or + /// JsonToken\#VALUE_NUMBER_FLOAT, returns + /// one of NumberType constants; otherwise returns null. + ///@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() { + return const $JsonParser_NumberTypeType() + .fromRef(_getNumberType(reference).object); + } + + static final _getByteValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getByteValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public byte getByteValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a value of Java byte primitive type. + /// Note that in addition to "natural" input range of {@code [-128, 127]}, + /// this also allows "unsigned 8-bit byte" values {@code [128, 255]}: + /// but for this range value will be translated by truncation, leading + /// to sign change. + /// + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the resulting integer value falls outside range of + /// {@code [-128, 255]}, + /// a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code byte} (if numeric token within + /// range of {@code [-128, 255]}); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getByteValue() { + return _getByteValue(reference).byte; + } + + static final _getShortValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getShortValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public short getShortValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a value of Java short primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the resulting integer value falls outside range of + /// Java short, a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code short} (if numeric token within + /// Java 16-bit signed {@code short} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getShortValue() { + return _getShortValue(reference).short; + } + + static final _getIntValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getIntValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getIntValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a value of Java int primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the resulting integer value falls outside range of + /// Java {@code int}, a InputCoercionException + /// may be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code int} (if numeric token within + /// Java 32-bit signed {@code int} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getIntValue() { + return _getIntValue(reference).integer; + } + + static final _getLongValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getLongValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract long getLongValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a Java long primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting to int; except for possible overflow/underflow + /// exception. + /// + /// Note: if the token is an integer, but its value falls + /// outside of range of Java long, a InputCoercionException + /// may be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code long} (if numeric token within + /// Java 32-bit signed {@code long} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getLongValue() { + return _getLongValue(reference).long; + } + + static final _getBigIntegerValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getBigIntegerValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.math.BigInteger getBigIntegerValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can not be used as a Java long primitive type due to its + /// magnitude. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDecimalValue + /// and then constructing a BigInteger from that value. + ///@return Current number value as BigInteger (if numeric token); + /// otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JObject getBigIntegerValue() { + return const jni.JObjectType() + .fromRef(_getBigIntegerValue(reference).object); + } + + static final _getFloatValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getFloatValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract float getFloatValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_FLOAT and + /// it can be expressed as a Java float primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_INT; + /// if so, it is equivalent to calling \#getLongValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the value falls + /// outside of range of Java float, a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code float} (if numeric token within + /// Java {@code float} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getFloatValue() { + return _getFloatValue(reference).float; + } + + static final _getDoubleValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getDoubleValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract double getDoubleValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_FLOAT and + /// it can be expressed as a Java double primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_INT; + /// if so, it is equivalent to calling \#getLongValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the value falls + /// outside of range of Java double, a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code double} (if numeric token within + /// Java {@code double} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getDoubleValue() { + return _getDoubleValue(reference).doubleFloat; + } + + static final _getDecimalValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getDecimalValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.math.BigDecimal getDecimalValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_FLOAT or + /// JsonToken\#VALUE_NUMBER_INT. No under/overflow exceptions + /// are ever thrown. + ///@return Current number value as BigDecimal (if numeric token); + /// otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JObject getDecimalValue() { + return const jni.JObjectType().fromRef(_getDecimalValue(reference).object); + } + + static final _getBooleanValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getBooleanValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean getBooleanValue() + /// + /// Convenience accessor that can be called when the current + /// token is JsonToken\#VALUE_TRUE or + /// JsonToken\#VALUE_FALSE, to return matching {@code boolean} + /// value. + /// If the current token is of some other type, JsonParseException + /// will be thrown + ///@return {@code True} if current token is {@code JsonToken.VALUE_TRUE}, + /// {@code false} if current token is {@code JsonToken.VALUE_FALSE}; + /// otherwise throws JsonParseException + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + bool getBooleanValue() { + return _getBooleanValue(reference).boolean; + } + + static final _getEmbeddedObject = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getEmbeddedObject") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getEmbeddedObject() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor that can be called if (and only if) the current token + /// is JsonToken\#VALUE_EMBEDDED_OBJECT. For other token types, + /// null is returned. + /// + /// Note: only some specialized parser implementations support + /// embedding of objects (usually ones that are facades on top + /// of non-streaming sources, such as object trees). One exception + /// is access to binary content (whether via base64 encoding or not) + /// which typically is accessible using this method, as well as + /// \#getBinaryValue(). + ///@return Embedded value (usually of "native" type supported by format) + /// for the current token, if any; {@code null otherwise} + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JObject getEmbeddedObject() { + return const jni.JObjectType() + .fromRef(_getEmbeddedObject(reference).object); + } + + static final _getBinaryValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__getBinaryValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant bv) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be used to read (and consume -- results + /// may not be accessible using other methods after the call) + /// base64-encoded binary data + /// included in the current textual JSON value. + /// It works similar to getting String value via \#getText + /// and decoding result (except for decoding part), + /// but should be significantly more performant. + /// + /// Note that non-decoded textual contents of the current token + /// are not guaranteed to be accessible after this method + /// is called. Current implementation, for example, clears up + /// textual content during decoding. + /// Decoded binary content, however, will be retained until + /// parser is advanced to the next event. + ///@param bv Expected variant of base64 encoded + /// content (see Base64Variants for definitions + /// of "standard" variants). + ///@return Decoded binary data + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JArray<jni.JByte> getBinaryValue( + jni.JObject bv, + ) { + return const jni.JArrayType(jni.JByteType()) + .fromRef(_getBinaryValue(reference, bv.reference).object); + } + + static final _getBinaryValue1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getBinaryValue1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public byte[] getBinaryValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience alternative to \#getBinaryValue(Base64Variant) + /// that defaults to using + /// Base64Variants\#getDefaultVariant as the default encoding. + ///@return Decoded binary data + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JArray<jni.JByte> getBinaryValue1() { + return const jni.JArrayType(jni.JByteType()) + .fromRef(_getBinaryValue1(reference).object); + } + + static final _readBinaryValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readBinaryValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int readBinaryValue(java.io.OutputStream out) + /// + /// Method that can be used as an alternative to \#getBigIntegerValue(), + /// especially when value can be large. The main difference (beyond method + /// of returning content using OutputStream instead of as byte array) + /// is that content will NOT remain accessible after method returns: any content + /// processed will be consumed and is not buffered in any way. If caller needs + /// buffering, it has to implement it. + ///@param out Output stream to use for passing decoded binary data + ///@return Number of bytes that were decoded and written via OutputStream + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + int readBinaryValue( + jni.JObject out, + ) { + return _readBinaryValue(reference, out.reference).integer; + } + + static final _readBinaryValue1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readBinaryValue1") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public int readBinaryValue(com.fasterxml.jackson.core.Base64Variant bv, java.io.OutputStream out) + /// + /// Similar to \#readBinaryValue(OutputStream) but allows explicitly + /// specifying base64 variant to use. + ///@param bv base64 variant to use + ///@param out Output stream to use for passing decoded binary data + ///@return Number of bytes that were decoded and written via OutputStream + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + int readBinaryValue1( + jni.JObject bv, + jni.JObject out, + ) { + return _readBinaryValue1(reference, bv.reference, out.reference).integer; + } + + static final _getValueAsInt = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsInt") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getValueAsInt() + /// + /// Method that will try to convert value of current token to a + /// Java {@code int} value. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to an int (including structured type + /// markers like start/end Object/Array) + /// default value of __0__ will be returned; no exceptions are thrown. + ///@return {@code int} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getValueAsInt() { + return _getValueAsInt(reference).integer; + } + + static final _getValueAsInt1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser__getValueAsInt1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public int getValueAsInt(int def) + /// + /// Method that will try to convert value of current token to a + /// __int__. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to an int (including structured type + /// markers like start/end Object/Array) + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code int} is not possible + ///@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, + ) { + return _getValueAsInt1(reference, def).integer; + } + + static final _getValueAsLong = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsLong") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public long getValueAsLong() + /// + /// Method that will try to convert value of current token to a + /// __long__. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to a long (including structured type + /// markers like start/end Object/Array) + /// default value of __0L__ will be returned; no exceptions are thrown. + ///@return {@code long} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getValueAsLong() { + return _getValueAsLong(reference).long; + } + + static final _getValueAsLong1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int64)>>("JsonParser__getValueAsLong1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public long getValueAsLong(long def) + /// + /// Method that will try to convert value of current token to a + /// __long__. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to a long (including structured type + /// markers like start/end Object/Array) + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code long} is not possible + ///@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, + ) { + return _getValueAsLong1(reference, def).long; + } + + static final _getValueAsDouble = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsDouble") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public double getValueAsDouble() + /// + /// Method that will try to convert value of current token to a Java + /// __double__. + /// Numbers are coerced using default Java rules; booleans convert to 0.0 (false) + /// and 1.0 (true), and Strings are parsed using default Java language floating + /// point parsing rules. + /// + /// If representation can not be converted to a double (including structured types + /// like Objects and Arrays), + /// default value of __0.0__ will be returned; no exceptions are thrown. + ///@return {@code double} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getValueAsDouble() { + return _getValueAsDouble(reference).doubleFloat; + } + + static final _getValueAsDouble1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Double)>>("JsonParser__getValueAsDouble1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, double)>(); + + /// from: public double getValueAsDouble(double def) + /// + /// Method that will try to convert value of current token to a + /// Java __double__. + /// Numbers are coerced using default Java rules; booleans convert to 0.0 (false) + /// and 1.0 (true), and Strings are parsed using default Java language floating + /// point parsing rules. + /// + /// If representation can not be converted to a double (including structured types + /// like Objects and Arrays), + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code double} is not possible + ///@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, + ) { + return _getValueAsDouble1(reference, def).doubleFloat; + } + + static final _getValueAsBoolean = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsBoolean") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean getValueAsBoolean() + /// + /// Method that will try to convert value of current token to a + /// __boolean__. + /// JSON booleans map naturally; integer numbers other than 0 map to true, and + /// 0 maps to false + /// and Strings 'true' and 'false' map to corresponding values. + /// + /// If representation can not be converted to a boolean value (including structured types + /// like Objects and Arrays), + /// default value of __false__ will be returned; no exceptions are thrown. + ///@return {@code boolean} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + bool getValueAsBoolean() { + return _getValueAsBoolean(reference).boolean; + } + + static final _getValueAsBoolean1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Uint8)>>("JsonParser__getValueAsBoolean1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public boolean getValueAsBoolean(boolean def) + /// + /// Method that will try to convert value of current token to a + /// __boolean__. + /// JSON booleans map naturally; integer numbers other than 0 map to true, and + /// 0 maps to false + /// and Strings 'true' and 'false' map to corresponding values. + /// + /// If representation can not be converted to a boolean value (including structured types + /// like Objects and Arrays), + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code boolean} is not possible + ///@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, + ) { + return _getValueAsBoolean1(reference, def ? 1 : 0).boolean; + } + + static final _getValueAsString = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsString") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getValueAsString() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will try to convert value of current token to a + /// java.lang.String. + /// JSON Strings map naturally; scalar values get converted to + /// their textual representation. + /// If representation can not be converted to a String value (including structured types + /// like Objects and Arrays and {@code null} token), default value of + /// __null__ will be returned; no exceptions are thrown. + ///@return String value current token is converted to, if possible; {@code null} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + jni.JString getValueAsString() { + return const jni.JStringType().fromRef(_getValueAsString(reference).object); + } + + static final _getValueAsString1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsString1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.String getValueAsString(java.lang.String def) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will try to convert value of current token to a + /// java.lang.String. + /// JSON Strings map naturally; scalar values get converted to + /// their textual representation. + /// If representation can not be converted to a String value (including structured types + /// like Objects and Arrays and {@code null} token), specified default value + /// will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code String} is not possible + ///@return String value current token is converted to, if possible; {@code def} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + jni.JString getValueAsString1( + jni.JString def, + ) { + return const jni.JStringType() + .fromRef(_getValueAsString1(reference, def.reference).object); + } + + static final _canReadObjectId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__canReadObjectId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canReadObjectId() + /// + /// Introspection method that may be called to see if the underlying + /// data format supports some kind of Object Ids natively (many do not; + /// for example, JSON doesn't). + /// + /// Default implementation returns true; overridden by data formats + /// that do support native Object Ids. Caller is expected to either + /// use a non-native notation (explicit property or such), or fail, + /// in case it can not use native object ids. + ///@return {@code True} if the format being read supports native Object Ids; + /// {@code false} if not + ///@since 2.3 + bool canReadObjectId() { + return _canReadObjectId(reference).boolean; + } + + static final _canReadTypeId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__canReadTypeId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canReadTypeId() + /// + /// Introspection method that may be called to see if the underlying + /// data format supports some kind of Type Ids natively (many do not; + /// for example, JSON doesn't). + /// + /// Default implementation returns true; overridden by data formats + /// that do support native Type Ids. Caller is expected to either + /// use a non-native notation (explicit property or such), or fail, + /// in case it can not use native type ids. + ///@return {@code True} if the format being read supports native Type Ids; + /// {@code false} if not + ///@since 2.3 + bool canReadTypeId() { + return _canReadTypeId(reference).boolean; + } + + static final _getObjectId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getObjectId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getObjectId() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to check whether current token + /// (one that was just read) has an associated Object id, and if + /// so, return it. + /// Note that while typically caller should check with \#canReadObjectId + /// first, it is not illegal to call this method even if that method returns + /// true; but if so, it will return null. This may be used to simplify calling + /// code. + /// + /// Default implementation will simply return null. + ///@return Native Object id associated with the current token, if any; {@code null} if none + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.3 + jni.JObject getObjectId() { + return const jni.JObjectType().fromRef(_getObjectId(reference).object); + } + + static final _getTypeId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTypeId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getTypeId() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to check whether current token + /// (one that was just read) has an associated type id, and if + /// so, return it. + /// Note that while typically caller should check with \#canReadTypeId + /// first, it is not illegal to call this method even if that method returns + /// true; but if so, it will return null. This may be used to simplify calling + /// code. + /// + /// Default implementation will simply return null. + ///@return Native Type Id associated with the current token, if any; {@code null} if none + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.3 + jni.JObject getTypeId() { + return const jni.JObjectType().fromRef(_getTypeId(reference).object); + } + + static final _readValueAs = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readValueAs") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public T readValueAs(java.lang.Class<T> valueType) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method to deserialize JSON content into a non-container + /// type (it can be an array type, however): typically a bean, array + /// or a wrapper type (like java.lang.Boolean). + /// __Note__: method can only be called if the parser has + /// an object codec assigned; this is true for parsers constructed + /// by <code>MappingJsonFactory</code> (from "jackson-databind" jar) + /// but not for JsonFactory (unless its <code>setCodec</code> + /// method has been explicitly called). + /// + /// This method may advance the event stream, for structured types + /// the current token will be the closing end marker (END_ARRAY, + /// END_OBJECT) of the bound structure. For non-structured Json types + /// (and for JsonToken\#VALUE_EMBEDDED_OBJECT) + /// stream is not advanced. + /// + /// Note: this method should NOT be used if the result type is a + /// container (java.util.Collection or java.util.Map. + /// The reason is that due to type erasure, key and value types + /// can not be introspected when using this method. + ///@param <T> Nominal type parameter for value type + ///@param valueType Java type to read content as (passed to ObjectCodec that + /// deserializes content) + ///@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.JObject valueType, { + required jni.JObjType<$T> T, + }) { + return T.fromRef(_readValueAs(reference, valueType.reference).object); + } + + static final _readValueAs1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readValueAs1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public T readValueAs(com.fasterxml.jackson.core.type.TypeReference<?> valueTypeRef) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method to deserialize JSON content into a Java type, reference + /// to which is passed as argument. Type is passed using so-called + /// "super type token" + /// and specifically needs to be used if the root type is a + /// parameterized (generic) container type. + /// __Note__: method can only be called if the parser has + /// an object codec assigned; this is true for parsers constructed + /// by <code>MappingJsonFactory</code> (defined in 'jackson-databind' bundle) + /// but not for JsonFactory (unless its <code>setCodec</code> + /// method has been explicitly called). + /// + /// This method may advance the event stream, for structured types + /// the current token will be the closing end marker (END_ARRAY, + /// END_OBJECT) of the bound structure. For non-structured Json types + /// (and for JsonToken\#VALUE_EMBEDDED_OBJECT) + /// stream is not advanced. + ///@param <T> Nominal type parameter for value type + ///@param valueTypeRef Java type to read content as (passed to ObjectCodec that + /// deserializes content) + ///@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.JObject valueTypeRef, { + required jni.JObjType<$T> T, + }) { + return T.fromRef(_readValueAs1(reference, valueTypeRef.reference).object); + } + + static final _readValuesAs = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readValuesAs") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Iterator<T> readValuesAs(java.lang.Class<T> valueType) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for reading sequence of Objects from parser stream, + /// all with same specified value type. + ///@param <T> Nominal type parameter for value type + ///@param valueType Java type to read content as (passed to ObjectCodec that + /// deserializes content) + ///@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.JObject valueType, { + required jni.JObjType<$T> T, + }) { + return const jni.JObjectType() + .fromRef(_readValuesAs(reference, valueType.reference).object); + } + + static final _readValuesAs1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readValuesAs1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Iterator<T> readValuesAs(com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for reading sequence of Objects from parser stream, + /// all with same specified value type. + ///@param <T> Nominal type parameter for value type + ///@param valueTypeRef Java type to read content as (passed to ObjectCodec that + /// deserializes content) + ///@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.JObject valueTypeRef, { + required jni.JObjType<$T> T, + }) { + return const jni.JObjectType() + .fromRef(_readValuesAs1(reference, valueTypeRef.reference).object); + } + + static final _readValueAsTree = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__readValueAsTree") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public T readValueAsTree() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method to deserialize JSON content into equivalent "tree model", + /// represented by root TreeNode of resulting model. + /// For JSON Arrays it will an array node (with child nodes), + /// for objects object node (with child nodes), and for other types + /// matching leaf node type. Empty or whitespace documents are null. + ///@param <T> Nominal type parameter for result node type (to reduce need for casting) + ///@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>({ + required jni.JObjType<$T> T, + }) { + return T.fromRef(_readValueAsTree(reference).object); + } +} + +class $JsonParserType extends jni.JObjType<JsonParser> { + const $JsonParserType(); + + @override + String get signature => r"Lcom/fasterxml/jackson/core/JsonParser;"; + + @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 { + @override + late final jni.JObjType $type = type; + + JsonParser_Feature.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $JsonParser_FeatureType(); + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_Feature__values") + .asFunction<jni.JniResult Function()>(); + + /// 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() { + return const jni.JArrayType($JsonParser_FeatureType()) + .fromRef(_values().object); + } + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser_Feature__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// 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, + ) { + return const $JsonParser_FeatureType() + .fromRef(_valueOf(name.reference).object); + } + + static final _collectDefaults = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_Feature__collectDefaults") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int collectDefaults() + /// + /// 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() { + return _collectDefaults().integer; + } + + static final _enabledByDefault = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser_Feature__enabledByDefault") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean enabledByDefault() + bool enabledByDefault() { + return _enabledByDefault(reference).boolean; + } + + static final _enabledIn = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser_Feature__enabledIn") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public boolean enabledIn(int flags) + bool enabledIn( + int flags, + ) { + return _enabledIn(reference, flags).boolean; + } + + static final _getMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser_Feature__getMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getMask() + int getMask() { + return _getMask(reference).integer; + } +} + +class $JsonParser_FeatureType extends jni.JObjType<JsonParser_Feature> { + const $JsonParser_FeatureType(); + + @override + String get signature => r"Lcom/fasterxml/jackson/core/JsonParser$Feature;"; + + @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 +/// +/// Enumeration of possible "native" (optimal) types that can be +/// used for numbers. +class JsonParser_NumberType extends jni.JObject { + @override + late final jni.JObjType $type = type; + + JsonParser_NumberType.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $JsonParser_NumberTypeType(); + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_NumberType__values") + .asFunction<jni.JniResult Function()>(); + + /// 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() { + return const jni.JArrayType($JsonParser_NumberTypeType()) + .fromRef(_values().object); + } + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser_NumberType__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// 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, + ) { + return const $JsonParser_NumberTypeType() + .fromRef(_valueOf(name.reference).object); + } +} + +class $JsonParser_NumberTypeType extends jni.JObjType<JsonParser_NumberType> { + const $JsonParser_NumberTypeType(); + + @override + String get signature => r"Lcom/fasterxml/jackson/core/JsonParser$NumberType;"; + + @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/c_based/dart_bindings/com/fasterxml/jackson/core/JsonToken.dart b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonToken.dart new file mode 100644 index 0000000..0714344 --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/JsonToken.dart
@@ -0,0 +1,235 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: file_names +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_shown_name + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "../../../../_init.dart"; + +/// from: com.fasterxml.jackson.core.JsonToken +/// +/// Enumeration for basic token types used for returning results +/// of parsing JSON content. +class JsonToken extends jni.JObject { + @override + late final jni.JObjType $type = type; + + JsonToken.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $JsonTokenType(); + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonToken__values") + .asFunction<jni.JniResult Function()>(); + + /// 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() { + return const jni.JArrayType($JsonTokenType()).fromRef(_values().object); + } + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// 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, + ) { + return const $JsonTokenType().fromRef(_valueOf(name.reference).object); + } + + static final _id = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>("JsonToken__id") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final int id() + int id() { + return _id(reference).integer; + } + + static final _asString = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__asString") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final java.lang.String asString() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JString asString() { + return const jni.JStringType().fromRef(_asString(reference).object); + } + + static final _asCharArray = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__asCharArray") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final char[] asCharArray() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JArray<jni.JChar> asCharArray() { + return const jni.JArrayType(jni.JCharType()) + .fromRef(_asCharArray(reference).object); + } + + static final _asByteArray = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__asByteArray") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final byte[] asByteArray() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JArray<jni.JByte> asByteArray() { + return const jni.JArrayType(jni.JByteType()) + .fromRef(_asByteArray(reference).object); + } + + static final _isNumeric = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isNumeric") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isNumeric() + /// + /// @return {@code True} if this token is {@code VALUE_NUMBER_INT} or {@code VALUE_NUMBER_FLOAT}, + /// {@code false} otherwise + bool isNumeric() { + return _isNumeric(reference).boolean; + } + + static final _isStructStart = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isStructStart") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isStructStart() + /// + /// Accessor that is functionally equivalent to: + /// <code> + /// this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY + /// </code> + ///@return {@code True} if this token is {@code START_OBJECT} or {@code START_ARRAY}, + /// {@code false} otherwise + ///@since 2.3 + bool isStructStart() { + return _isStructStart(reference).boolean; + } + + static final _isStructEnd = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isStructEnd") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isStructEnd() + /// + /// Accessor that is functionally equivalent to: + /// <code> + /// this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY + /// </code> + ///@return {@code True} if this token is {@code END_OBJECT} or {@code END_ARRAY}, + /// {@code false} otherwise + ///@since 2.3 + bool isStructEnd() { + return _isStructEnd(reference).boolean; + } + + static final _isScalarValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isScalarValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isScalarValue() + /// + /// Method that can be used to check whether this token represents + /// a valid non-structured value. This means all {@code VALUE_xxx} tokens; + /// excluding {@code START_xxx} and {@code END_xxx} tokens as well + /// {@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() { + return _isScalarValue(reference).boolean; + } + + static final _isBoolean = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isBoolean") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isBoolean() + /// + /// @return {@code True} if this token is {@code VALUE_TRUE} or {@code VALUE_FALSE}, + /// {@code false} otherwise + bool isBoolean() { + return _isBoolean(reference).boolean; + } +} + +class $JsonTokenType extends jni.JObjType<JsonToken> { + const $JsonTokenType(); + + @override + String get signature => r"Lcom/fasterxml/jackson/core/JsonToken;"; + + @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/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart b/pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/_package.dart similarity index 100% copy from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart copy to pkgs/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/_package.dart
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart b/pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/_init.dart similarity index 100% copy from pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart copy to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/_init.dart
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/dart_only/dart_bindings/com/fasterxml/jackson/core/JsonFactory.dart similarity index 100% copy from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart copy to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/com/fasterxml/jackson/core/JsonFactory.dart
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/dart_only/dart_bindings/com/fasterxml/jackson/core/JsonParser.dart similarity index 100% copy from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart copy to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/com/fasterxml/jackson/core/JsonParser.dart
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/dart_only/dart_bindings/com/fasterxml/jackson/core/JsonToken.dart similarity index 100% copy from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart copy to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/com/fasterxml/jackson/core/JsonToken.dart
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart b/pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/com/fasterxml/jackson/core/_package.dart similarity index 100% copy from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart copy to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/com/fasterxml/jackson/core/_package.dart
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart b/pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/_init.dart similarity index 100% rename from pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart rename to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/_init.dart
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/dart_only/lib/com/fasterxml/jackson/core/JsonFactory.dart similarity index 100% rename from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart rename to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/com/fasterxml/jackson/core/JsonFactory.dart
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/dart_only/lib/com/fasterxml/jackson/core/JsonParser.dart similarity index 100% rename from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart rename to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/com/fasterxml/jackson/core/JsonParser.dart
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/dart_only/lib/com/fasterxml/jackson/core/JsonToken.dart similarity index 100% rename from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart rename to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/com/fasterxml/jackson/core/JsonToken.dart
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart b/pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/com/fasterxml/jackson/core/_package.dart similarity index 100% rename from pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart rename to pkgs/jnigen/test/jackson_core_test/third_party/dart_only/lib/com/fasterxml/jackson/core/_package.dart
diff --git a/pkgs/jnigen/test/kotlin_test/src/.clang-format b/pkgs/jnigen/test/kotlin_test/c_based/c_bindings/.clang-format similarity index 100% rename from pkgs/jnigen/test/kotlin_test/src/.clang-format rename to pkgs/jnigen/test/kotlin_test/c_based/c_bindings/.clang-format
diff --git a/pkgs/jnigen/test/kotlin_test/src/CMakeLists.txt b/pkgs/jnigen/test/kotlin_test/c_based/c_bindings/CMakeLists.txt similarity index 100% rename from pkgs/jnigen/test/kotlin_test/src/CMakeLists.txt rename to pkgs/jnigen/test/kotlin_test/c_based/c_bindings/CMakeLists.txt
diff --git a/pkgs/jnigen/test/kotlin_test/src/dartjni.h b/pkgs/jnigen/test/kotlin_test/c_based/c_bindings/dartjni.h similarity index 94% copy from pkgs/jnigen/test/kotlin_test/src/dartjni.h copy to pkgs/jnigen/test/kotlin_test/c_based/c_bindings/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/test/kotlin_test/src/dartjni.h +++ b/pkgs/jnigen/test/kotlin_test/c_based/c_bindings/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/test/kotlin_test/src/kotlin.c b/pkgs/jnigen/test/kotlin_test/c_based/c_bindings/kotlin.c similarity index 88% rename from pkgs/jnigen/test/kotlin_test/src/kotlin.c rename to pkgs/jnigen/test/kotlin_test/c_based/c_bindings/kotlin.c index b70978e..b131ce9 100644 --- a/pkgs/jnigen/test/kotlin_test/src/kotlin.c +++ b/pkgs/jnigen/test/kotlin_test/c_based/c_bindings/kotlin.c
@@ -35,8 +35,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->NewObject(jniEnv, _c_SuspendFun, _m_SuspendFun__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_SuspendFun__sayHello = NULL; @@ -53,8 +52,7 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_SuspendFun__sayHello, continuation); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); } jmethodID _m_SuspendFun__sayHello1 = NULL; @@ -74,6 +72,5 @@ return (JniResult){.value = {.j = 0}, .exception = check_exception()}; jobject _result = (*jniEnv)->CallObjectMethod( jniEnv, self_, _m_SuspendFun__sayHello1, string, continuation); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; + return to_global_ref_result(_result); }
diff --git a/pkgs/jnigen/test/kotlin_test/lib/kotlin.dart b/pkgs/jnigen/test/kotlin_test/c_based/dart_bindings/kotlin.dart similarity index 100% rename from pkgs/jnigen/test/kotlin_test/lib/kotlin.dart rename to pkgs/jnigen/test/kotlin_test/c_based/dart_bindings/kotlin.dart
diff --git a/pkgs/jnigen/test/kotlin_test/dart_only/dart_bindings/kotlin.dart b/pkgs/jnigen/test/kotlin_test/dart_only/dart_bindings/kotlin.dart new file mode 100644 index 0000000..f0a4754 --- /dev/null +++ b/pkgs/jnigen/test/kotlin_test/dart_only/dart_bindings/kotlin.dart
@@ -0,0 +1,118 @@ +// 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. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: file_names +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_shown_name + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +// Auto-generated initialization code. + +final jniEnv = jni.Jni.env; +final jniAccessors = jni.Jni.accessors; + +/// from: com.github.dart_lang.jnigen.SuspendFun +class SuspendFun extends jni.JObject { + @override + late final jni.JObjType $type = type; + + SuspendFun.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = + jniAccessors.getClassOf(r"com/github/dart_lang/jnigen/SuspendFun"); + + /// The type which includes information such as the signature of this class. + static const type = $SuspendFunType(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory SuspendFun() { + return SuspendFun.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } + + static final _id_sayHello = jniAccessors.getMethodIDOf(_classRef, r"sayHello", + r"(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"); + + /// from: public final java.lang.Object sayHello(kotlin.coroutines.Continuation continuation) + /// The returned object must be deleted after use, by calling the `delete` method. + Future<jni.JString> sayHello() async { + final $p = ReceivePort(); + final $c = jni.JObject.fromRef(jni.Jni.newPortContinuation($p)); + jniAccessors.callMethodWithArgs(reference, _id_sayHello, + jni.JniCallType.objectType, [$c.reference]).object; + final $o = jni.JObjectPtr.fromAddress(await $p.first); + final $k = const jni.JStringType().getClass().reference; + if (!jni.Jni.env.IsInstanceOf($o, $k)) { + throw "Failed"; + } + return const jni.JStringType().fromRef($o); + } + + static final _id_sayHello1 = jniAccessors.getMethodIDOf( + _classRef, + r"sayHello", + r"(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"); + + /// 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 { + final $p = ReceivePort(); + final $c = jni.JObject.fromRef(jni.Jni.newPortContinuation($p)); + jniAccessors.callMethodWithArgs(reference, _id_sayHello1, + jni.JniCallType.objectType, [string.reference, $c.reference]).object; + final $o = jni.JObjectPtr.fromAddress(await $p.first); + final $k = const jni.JStringType().getClass().reference; + if (!jni.Jni.env.IsInstanceOf($o, $k)) { + throw "Failed"; + } + return const jni.JStringType().fromRef($o); + } +} + +class $SuspendFunType extends jni.JObjType<SuspendFun> { + const $SuspendFunType(); + + @override + String get signature => r"Lcom/github/dart_lang/jnigen/SuspendFun;"; + + @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/kotlin_test/generate.dart b/pkgs/jnigen/test/kotlin_test/generate.dart index 8f877ae..1b9b111 100644 --- a/pkgs/jnigen/test/kotlin_test/generate.dart +++ b/pkgs/jnigen/test/kotlin_test/generate.dart
@@ -37,8 +37,11 @@ Config getConfig([BindingsType bindingsType = BindingsType.cBased]) { compileKotlinSources(kotlinPath); - final cWrapperDir = Uri.directory(join(testRoot, "src")); - final dartWrappersRoot = Uri.directory(join(testRoot, "lib")); + final typeDir = bindingsType.getConfigString(); + final cWrapperDir = Uri.directory(join(testRoot, typeDir, "c_bindings")); + final dartWrappersRoot = Uri.directory( + join(testRoot, typeDir, "dart_bindings"), + ); final config = Config( classPath: [Uri.file(jarPath)], classes: [ @@ -67,4 +70,7 @@ return config; } -void main() async => await generateJniBindings(getConfig()); +void main() async { + await generateJniBindings(getConfig(BindingsType.cBased)); + await generateJniBindings(getConfig(BindingsType.dartOnly)); +}
diff --git a/pkgs/jnigen/test/kotlin_test/generated_files_test.dart b/pkgs/jnigen/test/kotlin_test/generated_files_test.dart index be9ff90..b96c643 100644 --- a/pkgs/jnigen/test/kotlin_test/generated_files_test.dart +++ b/pkgs/jnigen/test/kotlin_test/generated_files_test.dart
@@ -4,7 +4,6 @@ import 'package:jnigen/jnigen.dart'; import 'package:test/test.dart'; -import 'package:path/path.dart' hide equals; import 'generate.dart'; import '../test_util/test_util.dart'; @@ -13,17 +12,11 @@ // This is not run in setupAll, because we want to exit with one line of // error message, not throw a long exception. await checkLocallyBuiltDependencies(); - test( - "Generate and compare bindings for kotlin_test", - () async { - await generateAndCompareBindings( - getConfig(), - join(testRoot, "lib", "kotlin.dart"), - join(testRoot, "src"), - ); - }, - timeout: const Timeout.factor(1.5), - ); // test if generated file == expected file + generateAndCompareBothModes( + 'Generate and compare bindings for kotlin_test', + getConfig(BindingsType.cBased), + getConfig(BindingsType.dartOnly), + ); test( "Generate and analyze bindings for kotlin_test - pure dart", () async {
diff --git a/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart b/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart new file mode 100644 index 0000000..f99e3d4 --- /dev/null +++ b/pkgs/jnigen/test/kotlin_test/runtime_test_registrant.dart
@@ -0,0 +1,26 @@ +// Copyright (c) 2022, 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:test/test.dart'; +import 'package:jni/jni.dart'; + +import '../test_util/callback_types.dart'; + +import 'c_based/dart_bindings/kotlin.dart'; + +void registerTests(String groupName, TestRunnerCallback test) { + group(groupName, () { + test('Suspend functions', () async { + await using((arena) async { + final suspendFun = SuspendFun()..deletedIn(arena); + final hello = await suspendFun.sayHello(); + expect(hello.toDartString(deleteOriginal: true), "Hello!"); + const name = "Bob"; + final helloBob = + await suspendFun.sayHello1(name.toJString()..deletedIn(arena)); + expect(helloBob.toDartString(deleteOriginal: true), "Hello $name!"); + }); + }); + }); +}
diff --git a/pkgs/jnigen/test/regenerate_examples_test.dart b/pkgs/jnigen/test/regenerate_examples_test.dart index 50e41b6..5afeebe 100644 --- a/pkgs/jnigen/test/regenerate_examples_test.dart +++ b/pkgs/jnigen/test/regenerate_examples_test.dart
@@ -34,16 +34,9 @@ final examplePath = join('example', exampleName); final configPath = join(examplePath, 'jnigen.yaml'); - final dartBindingsPath = join(examplePath, dartOutput); - String? cBindingsPath; - if (cOutput != null) { - cBindingsPath = join(examplePath, cOutput); - } - final config = Config.parseArgs(['--config', configPath]); try { - await generateAndCompareBindings( - config, dartBindingsPath, cBindingsPath); + await generateAndCompareBindings(config); } on GradleException catch (_) { stderr.writeln('Skip: $exampleName'); }
diff --git a/pkgs/jnigen/test/simple_package_test/.gitignore b/pkgs/jnigen/test/simple_package_test/.gitignore index cbd7ab3..1db9cf8 100644 --- a/pkgs/jnigen/test/simple_package_test/.gitignore +++ b/pkgs/jnigen/test/simple_package_test/.gitignore
@@ -2,4 +2,5 @@ *.class test_lib/ test_src/ - +*_dartonly_generated.dart ## Generated test replicas +generated_runtime_test.dart \ No newline at end of file
diff --git a/pkgs/jnigen/test/simple_package_test/src/.clang-format b/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/.clang-format similarity index 100% rename from pkgs/jnigen/test/simple_package_test/src/.clang-format rename to pkgs/jnigen/test/simple_package_test/c_based/c_bindings/.clang-format
diff --git a/pkgs/jnigen/test/simple_package_test/src/CMakeLists.txt b/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/CMakeLists.txt similarity index 100% rename from pkgs/jnigen/test/simple_package_test/src/CMakeLists.txt rename to pkgs/jnigen/test/simple_package_test/c_based/c_bindings/CMakeLists.txt
diff --git a/pkgs/jnigen/test/kotlin_test/src/dartjni.h b/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/dartjni.h similarity index 94% copy from pkgs/jnigen/test/kotlin_test/src/dartjni.h copy to pkgs/jnigen/test/simple_package_test/c_based/c_bindings/dartjni.h index 21cef20..c0713af 100644 --- a/pkgs/jnigen/test/kotlin_test/src/dartjni.h +++ b/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/dartjni.h
@@ -176,10 +176,10 @@ char* methodName, char* signature); JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); + JniResult (*newPrimitiveArray)(jsize length, int type); + JniResult (*newObjectArray)(jsize length, + jclass elementClass, + jobject initialElement); JniResult (*getArrayElement)(jarray array, int index, int type); JniResult (*callMethod)(jobject obj, jmethodID methodID, @@ -261,8 +261,10 @@ acquire_lock(&jni->locks.classLoadingLock); if (*cls == NULL) { load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + if (!(*jniEnv)->ExceptionCheck(jniEnv)) { + *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); + (*jniEnv)->DeleteLocalRef(jniEnv, tmp); + } } release_lock(&jni->locks.classLoadingLock); } @@ -356,6 +358,15 @@ return to_global_ref(exception); } +static inline JniResult to_global_ref_result(jobject ref) { + JniResult result; + result.exception = check_exception(); + if (result.exception == NULL) { + result.value.l = to_global_ref(ref); + } + return result; +} + FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); JNIEXPORT void JNICALL
diff --git a/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/simple_package.c b/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/simple_package.c new file mode 100644 index 0000000..e388ec7 --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/c_based/c_bindings/simple_package.c
@@ -0,0 +1,2298 @@ +// Copyright (c) 2022, 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. + +// Autogenerated by jnigen. DO NOT EDIT! + +#include <stdint.h> +#include "dartjni.h" +#include "jni.h" + +thread_local JNIEnv* jniEnv; +JniContext* jni; + +JniContext* (*context_getter)(void); +JNIEnv* (*env_getter)(void); + +void setJniGetters(JniContext* (*cg)(void), JNIEnv* (*eg)(void)) { + context_getter = cg; + env_getter = eg; +} + +// com.github.dart_lang.jnigen.simple_package.Example +jclass _c_Example = NULL; + +jmethodID _m_Example__getAmount = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getAmount() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__getAmount, "getAmount", "()I"); + if (_m_Example__getAmount == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallStaticIntMethod(jniEnv, _c_Example, _m_Example__getAmount); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getPi = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getPi() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__getPi, "getPi", "()D"); + if (_m_Example__getPi == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + double _result = + (*jniEnv)->CallStaticDoubleMethod(jniEnv, _c_Example, _m_Example__getPi); + return (JniResult){.value = {.d = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getAsterisk = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getAsterisk() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__getAsterisk, "getAsterisk", + "()C"); + if (_m_Example__getAsterisk == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint16_t _result = (*jniEnv)->CallStaticCharMethod(jniEnv, _c_Example, + _m_Example__getAsterisk); + return (JniResult){.value = {.c = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getName = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getName() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__getName, "getName", + "()Ljava/lang/String;"); + if (_m_Example__getName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_Example, + _m_Example__getName); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__getNestedInstance = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getNestedInstance() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_Example, &_m_Example__getNestedInstance, "getNestedInstance", + "()Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;"); + if (_m_Example__getNestedInstance == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_Example, _m_Example__getNestedInstance); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__setAmount = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setAmount(int32_t newAmount) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__setAmount, "setAmount", "(I)V"); + if (_m_Example__setAmount == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallStaticVoidMethod(jniEnv, _c_Example, _m_Example__setAmount, + newAmount); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__setName = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setName(jobject newName) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__setName, "setName", + "(Ljava/lang/String;)V"); + if (_m_Example__setName == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallStaticVoidMethod(jniEnv, _c_Example, _m_Example__setName, + newName); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__setNestedInstance = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setNestedInstance(jobject newNested) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_Example, &_m_Example__setNestedInstance, "setNestedInstance", + "(Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;)V"); + if (_m_Example__setNestedInstance == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallStaticVoidMethod(jniEnv, _c_Example, + _m_Example__setNestedInstance, newNested); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__max4 = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__max4(int32_t a, int32_t b, int32_t c, int32_t d) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__max4, "max4", "(IIII)I"); + if (_m_Example__max4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod( + jniEnv, _c_Example, _m_Example__max4, a, b, c, d); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__max8 = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__max8(int32_t a, + int32_t b, + int32_t c, + int32_t d, + int32_t e, + int32_t f, + int32_t g, + int32_t h) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__max8, "max8", "(IIIIIIII)I"); + if (_m_Example__max8 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod( + jniEnv, _c_Example, _m_Example__max8, a, b, c, d, e, f, g, h); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getNumber = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getNumber(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getNumber, "getNumber", "()I"); + if (_m_Example__getNumber == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example__getNumber); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__setNumber = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setNumber(jobject self_, int32_t number) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__setNumber, "setNumber", "(I)V"); + if (_m_Example__setNumber == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example__setNumber, number); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__getIsUp = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getIsUp(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getIsUp, "getIsUp", "()Z"); + if (_m_Example__getIsUp == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_Example__getIsUp); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__setUp = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setUp(jobject self_, uint8_t isUp) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__setUp, "setUp", "(Z)V"); + if (_m_Example__setUp == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example__setUp, isUp); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__getCodename = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getCodename(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getCodename, "getCodename", + "()Ljava/lang/String;"); + if (_m_Example__getCodename == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_Example__getCodename); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__setCodename = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setCodename(jobject self_, jobject codename) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__setCodename, "setCodename", + "(Ljava/lang/String;)V"); + if (_m_Example__setCodename == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example__setCodename, codename); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__getRandom = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getRandom(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getRandom, "getRandom", + "()Ljava/util/Random;"); + if (_m_Example__getRandom == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_Example__getRandom); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__setRandom = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__setRandom(jobject self_, jobject random) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__setRandom, "setRandom", + "(Ljava/util/Random;)V"); + if (_m_Example__setRandom == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example__setRandom, random); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_Example__getRandomLong = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getRandomLong(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getRandomLong, "getRandomLong", "()J"); + if (_m_Example__getRandomLong == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = + (*jniEnv)->CallLongMethod(jniEnv, self_, _m_Example__getRandomLong); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__add4Longs = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__add4Longs(jobject self_, + int64_t a, + int64_t b, + int64_t c, + int64_t d) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__add4Longs, "add4Longs", "(JJJJ)J"); + if (_m_Example__add4Longs == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = (*jniEnv)->CallLongMethod( + jniEnv, self_, _m_Example__add4Longs, a, b, c, d); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__add8Longs = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__add8Longs(jobject self_, + int64_t a, + int64_t b, + int64_t c, + int64_t d, + int64_t e, + int64_t f, + int64_t g, + int64_t h) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__add8Longs, "add8Longs", "(JJJJJJJJ)J"); + if (_m_Example__add8Longs == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int64_t _result = (*jniEnv)->CallLongMethod( + jniEnv, self_, _m_Example__add8Longs, a, b, c, d, e, f, g, h); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getRandomNumericString = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getRandomNumericString(jobject self_, jobject random) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getRandomNumericString, + "getRandomNumericString", + "(Ljava/util/Random;)Ljava/lang/String;"); + if (_m_Example__getRandomNumericString == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_Example__getRandomNumericString, random); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__ctor() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__ctor, "<init>", "()V"); + if (_m_Example__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__ctor1 = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__ctor1(int32_t number) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__ctor1, "<init>", "(I)V"); + if (_m_Example__ctor1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor1, number); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__ctor2 = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__ctor2(int32_t number, uint8_t isUp) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__ctor2, "<init>", "(IZ)V"); + if (_m_Example__ctor2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor2, number, isUp); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__ctor3 = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__ctor3(int32_t number, uint8_t isUp, jobject codename) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__ctor3, "<init>", + "(IZLjava/lang/String;)V"); + if (_m_Example__ctor3 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor3, + number, isUp, codename); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__ctor4 = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__ctor4(int32_t a, + int32_t b, + int32_t c, + int32_t d, + int32_t e, + int32_t f, + int32_t g, + int32_t h) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__ctor4, "<init>", "(IIIIIIII)V"); + if (_m_Example__ctor4 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor4, + a, b, c, d, e, f, g, h); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__whichExample = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__whichExample(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__whichExample, "whichExample", "()I"); + if (_m_Example__whichExample == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example__whichExample); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__addInts = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__addInts(int32_t a, int32_t b) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__addInts, "addInts", "(II)I"); + if (_m_Example__addInts == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod(jniEnv, _c_Example, + _m_Example__addInts, a, b); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getArr = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getArr() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__getArr, "getArr", "()[I"); + if (_m_Example__getArr == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_Example, _m_Example__getArr); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__addAll = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__addAll(jobject arr) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__addAll, "addAll", "([I)I"); + if (_m_Example__addAll == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod(jniEnv, _c_Example, + _m_Example__addAll, arr); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example__getSelf = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__getSelf(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example, &_m_Example__getSelf, "getSelf", + "()Lcom/github/dart_lang/jnigen/simple_package/Example;"); + if (_m_Example__getSelf == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_Example__getSelf); + return to_global_ref_result(_result); +} + +jmethodID _m_Example__throwException = NULL; +FFI_PLUGIN_EXPORT +JniResult Example__throwException() { + load_env(); + load_class_global_ref(&_c_Example, + "com/github/dart_lang/jnigen/simple_package/Example"); + if (_c_Example == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Example, &_m_Example__throwException, "throwException", + "()V"); + if (_m_Example__throwException == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallStaticVoidMethod(jniEnv, _c_Example, + _m_Example__throwException); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.simple_package.Example$Nested +jclass _c_Example_Nested = NULL; + +jmethodID _m_Example_Nested__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult Example_Nested__ctor(uint8_t value) { + load_env(); + load_class_global_ref( + &_c_Example_Nested, + "com/github/dart_lang/jnigen/simple_package/Example$Nested"); + if (_c_Example_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example_Nested, &_m_Example_Nested__ctor, "<init>", "(Z)V"); + if (_m_Example_Nested__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Example_Nested, + _m_Example_Nested__ctor, value); + return to_global_ref_result(_result); +} + +jmethodID _m_Example_Nested__getValue = NULL; +FFI_PLUGIN_EXPORT +JniResult Example_Nested__getValue(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Example_Nested, + "com/github/dart_lang/jnigen/simple_package/Example$Nested"); + if (_c_Example_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example_Nested, &_m_Example_Nested__getValue, "getValue", + "()Z"); + if (_m_Example_Nested__getValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + uint8_t _result = + (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_Example_Nested__getValue); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +jmethodID _m_Example_Nested__setValue = NULL; +FFI_PLUGIN_EXPORT +JniResult Example_Nested__setValue(jobject self_, uint8_t value) { + load_env(); + load_class_global_ref( + &_c_Example_Nested, + "com/github/dart_lang/jnigen/simple_package/Example$Nested"); + if (_c_Example_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example_Nested, &_m_Example_Nested__setValue, "setValue", + "(Z)V"); + if (_m_Example_Nested__setValue == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example_Nested__setValue, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.simple_package.Exceptions +jclass _c_Exceptions = NULL; + +jmethodID _m_Exceptions__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__ctor() { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__ctor, "<init>", "()V"); + if (_m_Exceptions__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_Exceptions, _m_Exceptions__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__ctor1 = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__ctor1(float x) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__ctor1, "<init>", "(F)V"); + if (_m_Exceptions__ctor1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_Exceptions, _m_Exceptions__ctor1, x); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__ctor2 = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__ctor2(int32_t a, + int32_t b, + int32_t c, + int32_t d, + int32_t e, + int32_t f) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__ctor2, "<init>", "(IIIIII)V"); + if (_m_Exceptions__ctor2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject( + jniEnv, _c_Exceptions, _m_Exceptions__ctor2, a, b, c, d, e, f); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__staticObjectMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__staticObjectMethod() { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Exceptions, &_m_Exceptions__staticObjectMethod, + "staticObjectMethod", "()Ljava/lang/Object;"); + if (_m_Exceptions__staticObjectMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_Exceptions, _m_Exceptions__staticObjectMethod); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__staticIntMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__staticIntMethod() { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Exceptions, &_m_Exceptions__staticIntMethod, + "staticIntMethod", "()I"); + if (_m_Exceptions__staticIntMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallStaticIntMethod( + jniEnv, _c_Exceptions, _m_Exceptions__staticIntMethod); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Exceptions__staticObjectArrayMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__staticObjectArrayMethod() { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Exceptions, &_m_Exceptions__staticObjectArrayMethod, + "staticObjectArrayMethod", "()[Ljava/lang/Object;"); + if (_m_Exceptions__staticObjectArrayMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_Exceptions, _m_Exceptions__staticObjectArrayMethod); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__staticIntArrayMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__staticIntArrayMethod() { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Exceptions, &_m_Exceptions__staticIntArrayMethod, + "staticIntArrayMethod", "()[I"); + if (_m_Exceptions__staticIntArrayMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_Exceptions, _m_Exceptions__staticIntArrayMethod); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__objectMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__objectMethod(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__objectMethod, "objectMethod", + "()Ljava/lang/Object;"); + if (_m_Exceptions__objectMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_Exceptions__objectMethod); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__intMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__intMethod(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__intMethod, "intMethod", "()I"); + if (_m_Exceptions__intMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Exceptions__intMethod); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Exceptions__objectArrayMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__objectArrayMethod(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__objectArrayMethod, + "objectArrayMethod", "()[Ljava/lang/Object;"); + if (_m_Exceptions__objectArrayMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_Exceptions__objectArrayMethod); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__intArrayMethod = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__intArrayMethod(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__intArrayMethod, "intArrayMethod", + "()[I"); + if (_m_Exceptions__intArrayMethod == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_Exceptions__intArrayMethod); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__throwNullPointerException = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__throwNullPointerException(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__throwNullPointerException, + "throwNullPointerException", "()I"); + if (_m_Exceptions__throwNullPointerException == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_Exceptions__throwNullPointerException); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Exceptions__throwFileNotFoundException = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__throwFileNotFoundException(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__throwFileNotFoundException, + "throwFileNotFoundException", "()Ljava/io/InputStream;"); + if (_m_Exceptions__throwFileNotFoundException == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_Exceptions__throwFileNotFoundException); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__throwClassCastException = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__throwClassCastException(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__throwClassCastException, + "throwClassCastException", "()Ljava/io/FileInputStream;"); + if (_m_Exceptions__throwClassCastException == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_Exceptions__throwClassCastException); + return to_global_ref_result(_result); +} + +jmethodID _m_Exceptions__throwArrayIndexException = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__throwArrayIndexException(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__throwArrayIndexException, + "throwArrayIndexException", "()I"); + if (_m_Exceptions__throwArrayIndexException == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_Exceptions__throwArrayIndexException); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Exceptions__throwArithmeticException = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__throwArithmeticException(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Exceptions, &_m_Exceptions__throwArithmeticException, + "throwArithmeticException", "()I"); + if (_m_Exceptions__throwArithmeticException == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod( + jniEnv, self_, _m_Exceptions__throwArithmeticException); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +jmethodID _m_Exceptions__throwLoremIpsum = NULL; +FFI_PLUGIN_EXPORT +JniResult Exceptions__throwLoremIpsum() { + load_env(); + load_class_global_ref( + &_c_Exceptions, "com/github/dart_lang/jnigen/simple_package/Exceptions"); + if (_c_Exceptions == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_Exceptions, &_m_Exceptions__throwLoremIpsum, + "throwLoremIpsum", "()V"); + if (_m_Exceptions__throwLoremIpsum == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallStaticVoidMethod(jniEnv, _c_Exceptions, + _m_Exceptions__throwLoremIpsum); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.simple_package.Fields +jclass _c_Fields = NULL; + +jmethodID _m_Fields__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult Fields__ctor() { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Fields, &_m_Fields__ctor, "<init>", "()V"); + if (_m_Fields__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Fields, _m_Fields__ctor); + return to_global_ref_result(_result); +} + +jfieldID _f_Fields__amount = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__amount() { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__amount, "amount", "I"); + int32_t _result = + (*jniEnv)->GetStaticIntField(jniEnv, _c_Fields, _f_Fields__amount); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__amount(int32_t value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__amount, "amount", "I"); + (*jniEnv)->SetStaticIntField(jniEnv, _c_Fields, _f_Fields__amount, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__pi = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__pi() { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__pi, "pi", "D"); + double _result = + (*jniEnv)->GetStaticDoubleField(jniEnv, _c_Fields, _f_Fields__pi); + return (JniResult){.value = {.d = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__pi(double value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__pi, "pi", "D"); + (*jniEnv)->SetStaticDoubleField(jniEnv, _c_Fields, _f_Fields__pi, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__asterisk = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__asterisk() { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__asterisk, "asterisk", "C"); + uint16_t _result = + (*jniEnv)->GetStaticCharField(jniEnv, _c_Fields, _f_Fields__asterisk); + return (JniResult){.value = {.c = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__asterisk(uint16_t value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__asterisk, "asterisk", "C"); + (*jniEnv)->SetStaticCharField(jniEnv, _c_Fields, _f_Fields__asterisk, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__name = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__name() { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__name, "name", "Ljava/lang/String;"); + jobject _result = + (*jniEnv)->GetStaticObjectField(jniEnv, _c_Fields, _f_Fields__name); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__name(jobject value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__name, "name", "Ljava/lang/String;"); + (*jniEnv)->SetStaticObjectField(jniEnv, _c_Fields, _f_Fields__name, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__i = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__i(jobject self_) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__i, "i", "Ljava/lang/Integer;"); + jobject _result = (*jniEnv)->GetObjectField(jniEnv, self_, _f_Fields__i); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__i(jobject self_, jobject value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__i, "i", "Ljava/lang/Integer;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_Fields__i, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__trillion = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__trillion(jobject self_) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__trillion, "trillion", "J"); + int64_t _result = (*jniEnv)->GetLongField(jniEnv, self_, _f_Fields__trillion); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__trillion(jobject self_, int64_t value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__trillion, "trillion", "J"); + (*jniEnv)->SetLongField(jniEnv, self_, _f_Fields__trillion, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__isAchillesDead = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__isAchillesDead(jobject self_) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__isAchillesDead, "isAchillesDead", "Z"); + uint8_t _result = + (*jniEnv)->GetBooleanField(jniEnv, self_, _f_Fields__isAchillesDead); + return (JniResult){.value = {.z = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__isAchillesDead(jobject self_, uint8_t value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__isAchillesDead, "isAchillesDead", "Z"); + (*jniEnv)->SetBooleanField(jniEnv, self_, _f_Fields__isAchillesDead, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__bestFighterInGreece = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__bestFighterInGreece(jobject self_) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__bestFighterInGreece, "bestFighterInGreece", + "Ljava/lang/String;"); + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_Fields__bestFighterInGreece); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__bestFighterInGreece(jobject self_, jobject value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__bestFighterInGreece, "bestFighterInGreece", + "Ljava/lang/String;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_Fields__bestFighterInGreece, + value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__random = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__random(jobject self_) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__random, "random", "Ljava/util/Random;"); + jobject _result = (*jniEnv)->GetObjectField(jniEnv, self_, _f_Fields__random); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__random(jobject self_, jobject value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields, &_f_Fields__random, "random", "Ljava/util/Random;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_Fields__random, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields__euroSymbol = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields__euroSymbol() { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__euroSymbol, "euroSymbol", "C"); + uint16_t _result = + (*jniEnv)->GetStaticCharField(jniEnv, _c_Fields, _f_Fields__euroSymbol); + return (JniResult){.value = {.c = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields__euroSymbol(uint16_t value) { + load_env(); + load_class_global_ref(&_c_Fields, + "com/github/dart_lang/jnigen/simple_package/Fields"); + if (_c_Fields == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields, &_f_Fields__euroSymbol, "euroSymbol", "C"); + (*jniEnv)->SetStaticCharField(jniEnv, _c_Fields, _f_Fields__euroSymbol, + value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.simple_package.Fields$Nested +jclass _c_Fields_Nested = NULL; + +jmethodID _m_Fields_Nested__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult Fields_Nested__ctor() { + load_env(); + load_class_global_ref( + &_c_Fields_Nested, + "com/github/dart_lang/jnigen/simple_package/Fields$Nested"); + if (_c_Fields_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Fields_Nested, &_m_Fields_Nested__ctor, "<init>", "()V"); + if (_m_Fields_Nested__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_Fields_Nested, _m_Fields_Nested__ctor); + return to_global_ref_result(_result); +} + +jfieldID _f_Fields_Nested__hundred = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields_Nested__hundred(jobject self_) { + load_env(); + load_class_global_ref( + &_c_Fields_Nested, + "com/github/dart_lang/jnigen/simple_package/Fields$Nested"); + if (_c_Fields_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields_Nested, &_f_Fields_Nested__hundred, "hundred", "J"); + int64_t _result = + (*jniEnv)->GetLongField(jniEnv, self_, _f_Fields_Nested__hundred); + return (JniResult){.value = {.j = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields_Nested__hundred(jobject self_, int64_t value) { + load_env(); + load_class_global_ref( + &_c_Fields_Nested, + "com/github/dart_lang/jnigen/simple_package/Fields$Nested"); + if (_c_Fields_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_Fields_Nested, &_f_Fields_Nested__hundred, "hundred", "J"); + (*jniEnv)->SetLongField(jniEnv, self_, _f_Fields_Nested__hundred, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_Fields_Nested__BEST_GOD = NULL; +FFI_PLUGIN_EXPORT +JniResult get_Fields_Nested__BEST_GOD() { + load_env(); + load_class_global_ref( + &_c_Fields_Nested, + "com/github/dart_lang/jnigen/simple_package/Fields$Nested"); + if (_c_Fields_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields_Nested, &_f_Fields_Nested__BEST_GOD, "BEST_GOD", + "Ljava/lang/String;"); + jobject _result = (*jniEnv)->GetStaticObjectField(jniEnv, _c_Fields_Nested, + _f_Fields_Nested__BEST_GOD); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_Fields_Nested__BEST_GOD(jobject value) { + load_env(); + load_class_global_ref( + &_c_Fields_Nested, + "com/github/dart_lang/jnigen/simple_package/Fields$Nested"); + if (_c_Fields_Nested == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_Fields_Nested, &_f_Fields_Nested__BEST_GOD, "BEST_GOD", + "Ljava/lang/String;"); + (*jniEnv)->SetStaticObjectField(jniEnv, _c_Fields_Nested, + _f_Fields_Nested__BEST_GOD, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.pkg2.C2 +jclass _c_C2 = NULL; + +jmethodID _m_C2__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult C2__ctor() { + load_env(); + load_class_global_ref(&_c_C2, "com/github/dart_lang/jnigen/pkg2/C2"); + if (_c_C2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_C2, &_m_C2__ctor, "<init>", "()V"); + if (_m_C2__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_C2, _m_C2__ctor); + return to_global_ref_result(_result); +} + +jfieldID _f_C2__CONSTANT = NULL; +FFI_PLUGIN_EXPORT +JniResult get_C2__CONSTANT() { + load_env(); + load_class_global_ref(&_c_C2, "com/github/dart_lang/jnigen/pkg2/C2"); + if (_c_C2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_C2, &_f_C2__CONSTANT, "CONSTANT", "I"); + int32_t _result = + (*jniEnv)->GetStaticIntField(jniEnv, _c_C2, _f_C2__CONSTANT); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +FFI_PLUGIN_EXPORT +JniResult set_C2__CONSTANT(int32_t value) { + load_env(); + load_class_global_ref(&_c_C2, "com/github/dart_lang/jnigen/pkg2/C2"); + if (_c_C2 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_field(_c_C2, &_f_C2__CONSTANT, "CONSTANT", "I"); + (*jniEnv)->SetStaticIntField(jniEnv, _c_C2, _f_C2__CONSTANT, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.pkg2.Example +jclass _c_Example1 = NULL; + +jmethodID _m_Example1__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult Example1__ctor() { + load_env(); + load_class_global_ref(&_c_Example1, + "com/github/dart_lang/jnigen/pkg2/Example"); + if (_c_Example1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example1, &_m_Example1__ctor, "<init>", "()V"); + if (_m_Example1__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_Example1, _m_Example1__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_Example1__whichExample = NULL; +FFI_PLUGIN_EXPORT +JniResult Example1__whichExample(jobject self_) { + load_env(); + load_class_global_ref(&_c_Example1, + "com/github/dart_lang/jnigen/pkg2/Example"); + if (_c_Example1 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_Example1, &_m_Example1__whichExample, "whichExample", "()I"); + if (_m_Example1__whichExample == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = + (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example1__whichExample); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.GrandParent +jclass _c_GrandParent = NULL; + +jmethodID _m_GrandParent__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent__ctor(jobject value) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent, &_m_GrandParent__ctor, "<init>", + "(Ljava/lang/Object;)V"); + if (_m_GrandParent__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_GrandParent, _m_GrandParent__ctor, value); + return to_global_ref_result(_result); +} + +jmethodID _m_GrandParent__stringParent = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent__stringParent(jobject self_) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent, &_m_GrandParent__stringParent, "stringParent", + "()Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;"); + if (_m_GrandParent__stringParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_GrandParent__stringParent); + return to_global_ref_result(_result); +} + +jmethodID _m_GrandParent__varParent = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent__varParent(jobject self_, jobject nestedValue) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent, &_m_GrandParent__varParent, "varParent", + "(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/" + "GrandParent$Parent;"); + if (_m_GrandParent__varParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_GrandParent__varParent, nestedValue); + return to_global_ref_result(_result); +} + +jmethodID _m_GrandParent__stringStaticParent = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent__stringStaticParent() { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_GrandParent, &_m_GrandParent__stringStaticParent, "stringStaticParent", + "()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); + if (_m_GrandParent__stringStaticParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_GrandParent, _m_GrandParent__stringStaticParent); + return to_global_ref_result(_result); +} + +jmethodID _m_GrandParent__varStaticParent = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent__varStaticParent(jobject value) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_GrandParent, &_m_GrandParent__varStaticParent, + "varStaticParent", + "(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/" + "generics/GrandParent$StaticParent;"); + if (_m_GrandParent__varStaticParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_GrandParent, _m_GrandParent__varStaticParent, value); + return to_global_ref_result(_result); +} + +jmethodID _m_GrandParent__staticParentWithSameType = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent__staticParentWithSameType(jobject self_) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method( + _c_GrandParent, &_m_GrandParent__staticParentWithSameType, + "staticParentWithSameType", + "()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); + if (_m_GrandParent__staticParentWithSameType == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod( + jniEnv, self_, _m_GrandParent__staticParentWithSameType); + return to_global_ref_result(_result); +} + +jfieldID _f_GrandParent__value = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent__value(jobject self_) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent, &_f_GrandParent__value, "value", + "Ljava/lang/Object;"); + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_GrandParent__value); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent__value(jobject self_, jobject value) { + load_env(); + load_class_global_ref(&_c_GrandParent, + "com/github/dart_lang/jnigen/generics/GrandParent"); + if (_c_GrandParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent, &_f_GrandParent__value, "value", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent__value, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.GrandParent$Parent +jclass _c_GrandParent_Parent = NULL; + +jmethodID _m_GrandParent_Parent__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent_Parent__ctor(jobject parentValue, jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); + if (_c_GrandParent_Parent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent_Parent, &_m_GrandParent_Parent__ctor, "<init>", + "(Ljava/lang/Object;Ljava/lang/Object;)V"); + if (_m_GrandParent_Parent__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_GrandParent_Parent, + _m_GrandParent_Parent__ctor, parentValue, value); + return to_global_ref_result(_result); +} + +jfieldID _f_GrandParent_Parent__parentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_Parent__parentValue(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); + if (_c_GrandParent_Parent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__parentValue, + "parentValue", "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_Parent__parentValue); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_Parent__parentValue(jobject self_, jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); + if (_c_GrandParent_Parent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__parentValue, + "parentValue", "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_Parent__parentValue, + value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_GrandParent_Parent__value = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_Parent__value(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); + if (_c_GrandParent_Parent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__value, "value", + "Ljava/lang/Object;"); + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_GrandParent_Parent__value); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_Parent__value(jobject self_, jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); + if (_c_GrandParent_Parent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__value, "value", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_Parent__value, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.GrandParent$Parent$Child +jclass _c_GrandParent_Parent_Child = NULL; + +jmethodID _m_GrandParent_Parent_Child__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent_Parent_Child__ctor(jobject grandParentValue, + jobject parentValue, + jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent_Parent_Child, &_m_GrandParent_Parent_Child__ctor, + "<init>", + "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"); + if (_m_GrandParent_Parent_Child__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_GrandParent_Parent_Child, + _m_GrandParent_Parent_Child__ctor, + grandParentValue, parentValue, value); + return to_global_ref_result(_result); +} + +jfieldID _f_GrandParent_Parent_Child__grandParentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_Parent_Child__grandParentValue(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent_Child, + &_f_GrandParent_Parent_Child__grandParentValue, "grandParentValue", + "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_Parent_Child__grandParentValue); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_Parent_Child__grandParentValue(jobject self_, + jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent_Child, + &_f_GrandParent_Parent_Child__grandParentValue, "grandParentValue", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField( + jniEnv, self_, _f_GrandParent_Parent_Child__grandParentValue, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_GrandParent_Parent_Child__parentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_Parent_Child__parentValue(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent_Child, + &_f_GrandParent_Parent_Child__parentValue, "parentValue", + "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_Parent_Child__parentValue); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_Parent_Child__parentValue(jobject self_, + jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent_Child, + &_f_GrandParent_Parent_Child__parentValue, "parentValue", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, + _f_GrandParent_Parent_Child__parentValue, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_GrandParent_Parent_Child__value = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_Parent_Child__value(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent_Child, &_f_GrandParent_Parent_Child__value, + "value", "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_Parent_Child__value); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_Parent_Child__value(jobject self_, jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_Parent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + if (_c_GrandParent_Parent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_Parent_Child, &_f_GrandParent_Parent_Child__value, + "value", "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_Parent_Child__value, + value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.GrandParent$StaticParent +jclass _c_GrandParent_StaticParent = NULL; + +jmethodID _m_GrandParent_StaticParent__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent_StaticParent__ctor(jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); + if (_c_GrandParent_StaticParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent_StaticParent, &_m_GrandParent_StaticParent__ctor, + "<init>", "(Ljava/lang/Object;)V"); + if (_m_GrandParent_StaticParent__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_GrandParent_StaticParent, + _m_GrandParent_StaticParent__ctor, value); + return to_global_ref_result(_result); +} + +jfieldID _f_GrandParent_StaticParent__value = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_StaticParent__value(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); + if (_c_GrandParent_StaticParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_StaticParent, &_f_GrandParent_StaticParent__value, + "value", "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_StaticParent__value); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_StaticParent__value(jobject self_, jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); + if (_c_GrandParent_StaticParent == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_StaticParent, &_f_GrandParent_StaticParent__value, + "value", "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_StaticParent__value, + value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.GrandParent$StaticParent$Child +jclass _c_GrandParent_StaticParent_Child = NULL; + +jmethodID _m_GrandParent_StaticParent_Child__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult GrandParent_StaticParent_Child__ctor(jobject parentValue, + jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); + if (_c_GrandParent_StaticParent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_GrandParent_StaticParent_Child, + &_m_GrandParent_StaticParent_Child__ctor, "<init>", + "(Ljava/lang/Object;Ljava/lang/Object;)V"); + if (_m_GrandParent_StaticParent_Child__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject( + jniEnv, _c_GrandParent_StaticParent_Child, + _m_GrandParent_StaticParent_Child__ctor, parentValue, value); + return to_global_ref_result(_result); +} + +jfieldID _f_GrandParent_StaticParent_Child__parentValue = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_StaticParent_Child__parentValue(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); + if (_c_GrandParent_StaticParent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_StaticParent_Child, + &_f_GrandParent_StaticParent_Child__parentValue, "parentValue", + "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_StaticParent_Child__parentValue); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_StaticParent_Child__parentValue(jobject self_, + jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); + if (_c_GrandParent_StaticParent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_StaticParent_Child, + &_f_GrandParent_StaticParent_Child__parentValue, "parentValue", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField( + jniEnv, self_, _f_GrandParent_StaticParent_Child__parentValue, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_GrandParent_StaticParent_Child__value = NULL; +FFI_PLUGIN_EXPORT +JniResult get_GrandParent_StaticParent_Child__value(jobject self_) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); + if (_c_GrandParent_StaticParent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_StaticParent_Child, + &_f_GrandParent_StaticParent_Child__value, "value", + "Ljava/lang/Object;"); + jobject _result = (*jniEnv)->GetObjectField( + jniEnv, self_, _f_GrandParent_StaticParent_Child__value); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_GrandParent_StaticParent_Child__value(jobject self_, + jobject value) { + load_env(); + load_class_global_ref( + &_c_GrandParent_StaticParent_Child, + "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); + if (_c_GrandParent_StaticParent_Child == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_GrandParent_StaticParent_Child, + &_f_GrandParent_StaticParent_Child__value, "value", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, + _f_GrandParent_StaticParent_Child__value, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.MyMap +jclass _c_MyMap = NULL; + +jmethodID _m_MyMap__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult MyMap__ctor() { + load_env(); + load_class_global_ref(&_c_MyMap, + "com/github/dart_lang/jnigen/generics/MyMap"); + if (_c_MyMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyMap, &_m_MyMap__ctor, "<init>", "()V"); + if (_m_MyMap__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_MyMap, _m_MyMap__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_MyMap__get0 = NULL; +FFI_PLUGIN_EXPORT +JniResult MyMap__get0(jobject self_, jobject key) { + load_env(); + load_class_global_ref(&_c_MyMap, + "com/github/dart_lang/jnigen/generics/MyMap"); + if (_c_MyMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyMap, &_m_MyMap__get0, "get", + "(Ljava/lang/Object;)Ljava/lang/Object;"); + if (_m_MyMap__get0 == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyMap__get0, key); + return to_global_ref_result(_result); +} + +jmethodID _m_MyMap__put = NULL; +FFI_PLUGIN_EXPORT +JniResult MyMap__put(jobject self_, jobject key, jobject value) { + load_env(); + load_class_global_ref(&_c_MyMap, + "com/github/dart_lang/jnigen/generics/MyMap"); + if (_c_MyMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyMap, &_m_MyMap__put, "put", + "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + if (_m_MyMap__put == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyMap__put, key, value); + return to_global_ref_result(_result); +} + +jmethodID _m_MyMap__entryStack = NULL; +FFI_PLUGIN_EXPORT +JniResult MyMap__entryStack(jobject self_) { + load_env(); + load_class_global_ref(&_c_MyMap, + "com/github/dart_lang/jnigen/generics/MyMap"); + if (_c_MyMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyMap, &_m_MyMap__entryStack, "entryStack", + "()Lcom/github/dart_lang/jnigen/generics/MyStack;"); + if (_m_MyMap__entryStack == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyMap__entryStack); + return to_global_ref_result(_result); +} + +// com.github.dart_lang.jnigen.generics.MyMap$MyEntry +jclass _c_MyMap_MyEntry = NULL; + +jmethodID _m_MyMap_MyEntry__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult MyMap_MyEntry__ctor(jobject key, jobject value) { + load_env(); + load_class_global_ref(&_c_MyMap_MyEntry, + "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); + if (_c_MyMap_MyEntry == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyMap_MyEntry, &_m_MyMap_MyEntry__ctor, "<init>", + "(Ljava/lang/Object;Ljava/lang/Object;)V"); + if (_m_MyMap_MyEntry__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_MyMap_MyEntry, + _m_MyMap_MyEntry__ctor, key, value); + return to_global_ref_result(_result); +} + +jfieldID _f_MyMap_MyEntry__key = NULL; +FFI_PLUGIN_EXPORT +JniResult get_MyMap_MyEntry__key(jobject self_) { + load_env(); + load_class_global_ref(&_c_MyMap_MyEntry, + "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); + if (_c_MyMap_MyEntry == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__key, "key", + "Ljava/lang/Object;"); + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_MyMap_MyEntry__key); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_MyMap_MyEntry__key(jobject self_, jobject value) { + load_env(); + load_class_global_ref(&_c_MyMap_MyEntry, + "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); + if (_c_MyMap_MyEntry == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__key, "key", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_MyMap_MyEntry__key, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jfieldID _f_MyMap_MyEntry__value = NULL; +FFI_PLUGIN_EXPORT +JniResult get_MyMap_MyEntry__value(jobject self_) { + load_env(); + load_class_global_ref(&_c_MyMap_MyEntry, + "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); + if (_c_MyMap_MyEntry == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__value, "value", + "Ljava/lang/Object;"); + jobject _result = + (*jniEnv)->GetObjectField(jniEnv, self_, _f_MyMap_MyEntry__value); + return to_global_ref_result(_result); +} + +FFI_PLUGIN_EXPORT +JniResult set_MyMap_MyEntry__value(jobject self_, jobject value) { + load_env(); + load_class_global_ref(&_c_MyMap_MyEntry, + "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); + if (_c_MyMap_MyEntry == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__value, "value", + "Ljava/lang/Object;"); + (*jniEnv)->SetObjectField(jniEnv, self_, _f_MyMap_MyEntry__value, value); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.MyStack +jclass _c_MyStack = NULL; + +jmethodID _m_MyStack__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__ctor() { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyStack, &_m_MyStack__ctor, "<init>", "()V"); + if (_m_MyStack__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_MyStack, _m_MyStack__ctor); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__fromArray = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__fromArray(jobject arr) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_MyStack, _m_MyStack__fromArray, arr); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__fromArrayOfArrayOfGrandParents = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__fromArrayOfArrayOfGrandParents(jobject arr) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_MyStack, _m_MyStack__fromArrayOfArrayOfGrandParents, arr); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__of = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__of() { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_MyStack, _m_MyStack__of); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__of1 = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__of1(jobject obj) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_MyStack, + _m_MyStack__of1, obj); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__of2 = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__of2(jobject obj, jobject obj2) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_MyStack, _m_MyStack__of2, obj, obj2); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__push = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__push(jobject self_, jobject item) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyStack, &_m_MyStack__push, "push", "(Ljava/lang/Object;)V"); + if (_m_MyStack__push == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_MyStack__push, item); + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; +} + +jmethodID _m_MyStack__pop = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__pop(jobject self_) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyStack, &_m_MyStack__pop, "pop", "()Ljava/lang/Object;"); + if (_m_MyStack__pop == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyStack__pop); + return to_global_ref_result(_result); +} + +jmethodID _m_MyStack__size = NULL; +FFI_PLUGIN_EXPORT +JniResult MyStack__size(jobject self_) { + load_env(); + load_class_global_ref(&_c_MyStack, + "com/github/dart_lang/jnigen/generics/MyStack"); + if (_c_MyStack == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyStack, &_m_MyStack__size, "size", "()I"); + if (_m_MyStack__size == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + int32_t _result = (*jniEnv)->CallIntMethod(jniEnv, self_, _m_MyStack__size); + return (JniResult){.value = {.i = _result}, .exception = check_exception()}; +} + +// com.github.dart_lang.jnigen.generics.StringKeyedMap +jclass _c_StringKeyedMap = NULL; + +jmethodID _m_StringKeyedMap__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult StringKeyedMap__ctor() { + load_env(); + load_class_global_ref(&_c_StringKeyedMap, + "com/github/dart_lang/jnigen/generics/StringKeyedMap"); + if (_c_StringKeyedMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_StringKeyedMap, &_m_StringKeyedMap__ctor, "<init>", "()V"); + if (_m_StringKeyedMap__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_StringKeyedMap, _m_StringKeyedMap__ctor); + return to_global_ref_result(_result); +} + +// 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_global_ref(&_c_StringMap, + "com/github/dart_lang/jnigen/generics/StringMap"); + if (_c_StringMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_StringMap, &_m_StringMap__ctor, "<init>", "()V"); + if (_m_StringMap__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_StringMap, _m_StringMap__ctor); + return to_global_ref_result(_result); +} + +// com.github.dart_lang.jnigen.generics.StringStack +jclass _c_StringStack = NULL; + +jmethodID _m_StringStack__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult StringStack__ctor() { + load_env(); + load_class_global_ref(&_c_StringStack, + "com/github/dart_lang/jnigen/generics/StringStack"); + if (_c_StringStack == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_StringStack, &_m_StringStack__ctor, "<init>", "()V"); + if (_m_StringStack__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_StringStack, _m_StringStack__ctor); + return to_global_ref_result(_result); +} + +// com.github.dart_lang.jnigen.generics.StringValuedMap +jclass _c_StringValuedMap = NULL; + +jmethodID _m_StringValuedMap__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult StringValuedMap__ctor() { + load_env(); + load_class_global_ref(&_c_StringValuedMap, + "com/github/dart_lang/jnigen/generics/StringValuedMap"); + if (_c_StringValuedMap == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_StringValuedMap, &_m_StringValuedMap__ctor, "<init>", "()V"); + if (_m_StringValuedMap__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->NewObject(jniEnv, _c_StringValuedMap, + _m_StringValuedMap__ctor); + return to_global_ref_result(_result); +} + +// com.github.dart_lang.jnigen.annotations.JsonSerializable$Case +jclass _c_JsonSerializable_Case = NULL; + +jmethodID _m_JsonSerializable_Case__values = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonSerializable_Case__values() { + load_env(); + load_class_global_ref( + &_c_JsonSerializable_Case, + "com/github/dart_lang/jnigen/annotations/JsonSerializable$Case"); + if (_c_JsonSerializable_Case == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method( + _c_JsonSerializable_Case, &_m_JsonSerializable_Case__values, "values", + "()[Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;"); + if (_m_JsonSerializable_Case__values == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonSerializable_Case, _m_JsonSerializable_Case__values); + return to_global_ref_result(_result); +} + +jmethodID _m_JsonSerializable_Case__valueOf = NULL; +FFI_PLUGIN_EXPORT +JniResult JsonSerializable_Case__valueOf(jobject name) { + load_env(); + load_class_global_ref( + &_c_JsonSerializable_Case, + "com/github/dart_lang/jnigen/annotations/JsonSerializable$Case"); + if (_c_JsonSerializable_Case == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_static_method(_c_JsonSerializable_Case, + &_m_JsonSerializable_Case__valueOf, "valueOf", + "(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/" + "annotations/JsonSerializable$Case;"); + if (_m_JsonSerializable_Case__valueOf == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = (*jniEnv)->CallStaticObjectMethod( + jniEnv, _c_JsonSerializable_Case, _m_JsonSerializable_Case__valueOf, + name); + return to_global_ref_result(_result); +} + +// com.github.dart_lang.jnigen.annotations.MyDataClass +jclass _c_MyDataClass = NULL; + +jmethodID _m_MyDataClass__ctor = NULL; +FFI_PLUGIN_EXPORT +JniResult MyDataClass__ctor() { + load_env(); + load_class_global_ref(&_c_MyDataClass, + "com/github/dart_lang/jnigen/annotations/MyDataClass"); + if (_c_MyDataClass == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + load_method(_c_MyDataClass, &_m_MyDataClass__ctor, "<init>", "()V"); + if (_m_MyDataClass__ctor == NULL) + return (JniResult){.value = {.j = 0}, .exception = check_exception()}; + jobject _result = + (*jniEnv)->NewObject(jniEnv, _c_MyDataClass, _m_MyDataClass__ctor); + return to_global_ref_result(_result); +}
diff --git a/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart b/pkgs/jnigen/test/simple_package_test/c_based/dart_bindings/simple_package.dart similarity index 62% rename from pkgs/jnigen/test/simple_package_test/lib/simple_package.dart rename to pkgs/jnigen/test/simple_package_test/c_based/dart_bindings/simple_package.dart index c5d1083..16e99fc 100644 --- a/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart +++ b/pkgs/jnigen/test/simple_package_test/c_based/dart_bindings/simple_package.dart
@@ -46,41 +46,317 @@ /// from: static public final int OFF static const OFF = 0; - static final _get_aux = + /// from: static public final double PI + static const PI = 3.14159; + + /// from: static public final char SEMICOLON + static const SEMICOLON = r""";"""; + + /// from: static public final java.lang.String SEMICOLON_STRING + static const SEMICOLON_STRING = r""";"""; + + static final _getAmount = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_Example__aux") + "Example__getAmount") .asFunction<jni.JniResult Function()>(); - static final _set_aux = jniLookup< + /// from: static public int getAmount() + static int getAmount() { + return _getAmount().integer; + } + + static final _getPi = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example__getPi") + .asFunction<jni.JniResult Function()>(); + + /// from: static public double getPi() + static double getPi() { + return _getPi().doubleFloat; + } + + static final _getAsterisk = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Example__getAsterisk") + .asFunction<jni.JniResult Function()>(); + + /// from: static public char getAsterisk() + static int getAsterisk() { + return _getAsterisk().char; + } + + static final _getName = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Example__getName") + .asFunction<jni.JniResult Function()>(); + + /// from: static public java.lang.String getName() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JString getName() { + return const jni.JStringType().fromRef(_getName().object); + } + + static final _getNestedInstance = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Example__getNestedInstance") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.github.dart_lang.jnigen.simple_package.Example.Nested getNestedInstance() + /// The returned object must be deleted after use, by calling the `delete` method. + static Example_Nested getNestedInstance() { + return const $Example_NestedType().fromRef(_getNestedInstance().object); + } + + static final _setAmount = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( + "Example__setAmount") + .asFunction<jni.JniResult Function(int)>(); + + /// from: static public void setAmount(int newAmount) + static void setAmount( + int newAmount, + ) { + return _setAmount(newAmount).check(); + } + + static final _setName = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( - ffi.Pointer<ffi.Void>)>>("set_Example__aux") - .asFunction<jni.JThrowablePtr Function(ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__setName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - /// from: static public com.github.dart_lang.jnigen.simple_package.Example.Aux aux + /// from: static public void setName(java.lang.String newName) + static void setName( + jni.JString newName, + ) { + return _setName(newName.reference).check(); + } + + static final _setNestedInstance = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__setNestedInstance") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public void setNestedInstance(com.github.dart_lang.jnigen.simple_package.Example.Nested newNested) + static void setNestedInstance( + Example_Nested newNested, + ) { + return _setNestedInstance(newNested.reference).check(); + } + + static final _max4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Int32, ffi.Int32, ffi.Int32, ffi.Int32)>>("Example__max4") + .asFunction<jni.JniResult Function(int, int, int, int)>(); + + /// from: static public int max4(int a, int b, int c, int d) + static int max4( + int a, + int b, + int c, + int d, + ) { + return _max4(a, b, c, d).integer; + } + + static final _max8 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Int32, ffi.Int32, ffi.Int32, ffi.Int32, + ffi.Int32, ffi.Int32, ffi.Int32, ffi.Int32)>>("Example__max8") + .asFunction< + jni.JniResult Function(int, int, int, int, int, int, int, int)>(); + + /// from: static public int max8(int a, int b, int c, int d, int e, int f, int g, int h) + static int max8( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + ) { + return _max8(a, b, c, d, e, f, g, h).integer; + } + + static final _getNumber = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__getNumber") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getNumber() + int getNumber() { + return _getNumber(reference).integer; + } + + static final _setNumber = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Int32)>>("Example__setNumber") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public void setNumber(int number) + void setNumber( + int number, + ) { + return _setNumber(reference, number).check(); + } + + static final _getIsUp = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__getIsUp") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean getIsUp() + bool getIsUp() { + return _getIsUp(reference).boolean; + } + + static final _setUp = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("Example__setUp") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public void setUp(boolean isUp) + void setUp( + bool isUp, + ) { + return _setUp(reference, isUp ? 1 : 0).check(); + } + + static final _getCodename = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__getCodename") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getCodename() /// The returned object must be deleted after use, by calling the `delete` method. - static Example_Aux get aux => - const $Example_AuxType().fromRef(_get_aux().object); + jni.JString getCodename() { + return const jni.JStringType().fromRef(_getCodename(reference).object); + } - /// from: static public com.github.dart_lang.jnigen.simple_package.Example.Aux aux + static final _setCodename = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("Example__setCodename") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setCodename(java.lang.String codename) + void setCodename( + jni.JString codename, + ) { + return _setCodename(reference, codename.reference).check(); + } + + static final _getRandom = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__getRandom") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Random getRandom() /// The returned object must be deleted after use, by calling the `delete` method. - static set aux(Example_Aux value) => _set_aux(value.reference); + jni.JObject getRandom() { + return const jni.JObjectType().fromRef(_getRandom(reference).object); + } - static final _get_num = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_Example__num") - .asFunction<jni.JniResult Function()>(); + static final _setRandom = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("Example__setRandom") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - static final _set_num = - jniLookup<ffi.NativeFunction<jni.JThrowablePtr Function(ffi.Int32)>>( - "set_Example__num") - .asFunction<jni.JThrowablePtr Function(int)>(); + /// from: public void setRandom(java.util.Random random) + void setRandom( + jni.JObject random, + ) { + return _setRandom(reference, random.reference).check(); + } - /// from: static public int num - static int get num => _get_num().integer; + static final _getRandomLong = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example__getRandomLong") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - /// from: static public int num - static set num(int value) => _set_num(value); + /// from: public long getRandomLong() + int getRandomLong() { + return _getRandomLong(reference).long; + } + + static final _add4Longs = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int64, + ffi.Int64, ffi.Int64, ffi.Int64)>>("Example__add4Longs") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int, int, int)>(); + + /// from: public long add4Longs(long a, long b, long c, long d) + int add4Longs( + int a, + int b, + int c, + int d, + ) { + return _add4Longs(reference, a, b, c, d).long; + } + + static final _add8Longs = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Int64, + ffi.Int64, + ffi.Int64, + ffi.Int64, + ffi.Int64, + ffi.Int64, + ffi.Int64, + ffi.Int64)>>("Example__add8Longs") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, int, int, int, int, int, int, int, int)>(); + + /// from: public long add8Longs(long a, long b, long c, long d, long e, long f, long g, long h) + int add8Longs( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + ) { + return _add8Longs(reference, a, b, c, d, e, f, g, h).long; + } + + static final _getRandomNumericString = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("Example__getRandomNumericString") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getRandomNumericString(java.util.Random random) + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JString getRandomNumericString( + jni.JObject random, + ) { + return const jni.JStringType() + .fromRef(_getRandomNumericString(reference, random.reference).object); + } static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example__ctor") @@ -97,12 +373,72 @@ "Example__ctor1") .asFunction<jni.JniResult Function(int)>(); - /// from: public void <init>(int internal) + /// from: public void <init>(int number) /// The returned object must be deleted after use, by calling the `delete` method. factory Example.ctor1( - int internal, + int number, ) { - return Example.fromRef(_ctor1(internal).object); + return Example.fromRef(_ctor1(number).object); + } + + static final _ctor2 = jniLookup< + ffi.NativeFunction<jni.JniResult Function(ffi.Int32, ffi.Uint8)>>( + "Example__ctor2") + .asFunction<jni.JniResult Function(int, int)>(); + + /// from: public void <init>(int number, boolean isUp) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor2( + int number, + bool isUp, + ) { + return Example.fromRef(_ctor2(number, isUp ? 1 : 0).object); + } + + static final _ctor3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Int32, ffi.Uint8, + ffi.Pointer<ffi.Void>)>>("Example__ctor3") + .asFunction<jni.JniResult Function(int, int, ffi.Pointer<ffi.Void>)>(); + + /// from: public void <init>(int number, boolean isUp, java.lang.String codename) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor3( + int number, + bool isUp, + jni.JString codename, + ) { + return Example.fromRef( + _ctor3(number, isUp ? 1 : 0, codename.reference).object); + } + + static final _ctor4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Int32, + ffi.Int32, + ffi.Int32, + ffi.Int32, + ffi.Int32, + ffi.Int32, + ffi.Int32, + ffi.Int32)>>("Example__ctor4") + .asFunction< + jni.JniResult Function(int, int, int, int, int, int, int, int)>(); + + /// from: public void <init>(int a, int b, int c, int d, int e, int f, int g, int h) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor4( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + ) { + return Example.fromRef(_ctor4(a, b, c, d, e, f, g, h).object); } static final _whichExample = jniLookup< @@ -116,16 +452,6 @@ return _whichExample(reference).integer; } - static final _getAux = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example__getAux") - .asFunction<jni.JniResult Function()>(); - - /// 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() { - return const $Example_AuxType().fromRef(_getAux().object); - } - static final _addInts = jniLookup< ffi.NativeFunction<jni.JniResult Function(ffi.Int32, ffi.Int32)>>( "Example__addInts") @@ -173,53 +499,6 @@ return const $ExampleType().fromRef(_getSelf(reference).object); } - static final _getNum = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>("Example__getNum") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getNum() - int getNum() { - return _getNum(reference).integer; - } - - static final _setNum = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Int32)>>("Example__setNum") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public void setNum(int num) - void setNum( - int num, - ) { - return _setNum(reference, num).check(); - } - - static final _getInternal = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("Example__getInternal") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getInternal() - int getInternal() { - return _getInternal(reference).integer; - } - - static final _setInternal = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Int32)>>("Example__setInternal") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public void setInternal(int internal) - void setInternal( - int internal, - ) { - return _setInternal(reference, internal).check(); - } - static final _throwException = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( "Example__throwException") @@ -256,56 +535,34 @@ } } -/// from: com.github.dart_lang.jnigen.simple_package.Example$Aux -class Example_Aux extends jni.JObject { +/// from: com.github.dart_lang.jnigen.simple_package.Example$Nested +class Example_Nested extends jni.JObject { @override late final jni.JObjType $type = type; - Example_Aux.fromRef( + Example_Nested.fromRef( jni.JObjectPtr ref, ) : super.fromRef(ref); /// The type which includes information such as the signature of this class. - static const type = $Example_AuxType(); - static final _get_value = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - jni.JObjectPtr, - )>>("get_Example_Aux__value") - .asFunction< - jni.JniResult Function( - jni.JObjectPtr, - )>(); - - static final _set_value = jniLookup< - ffi.NativeFunction< - jni.JThrowablePtr Function( - jni.JObjectPtr, ffi.Uint8)>>("set_Example_Aux__value") - .asFunction<jni.JThrowablePtr Function(jni.JObjectPtr, int)>(); - - /// from: public boolean value - bool get value => _get_value(reference).boolean; - - /// from: public boolean value - set value(bool value) => _set_value(reference, value ? 1 : 0); - + static const type = $Example_NestedType(); static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint8)>>( - "Example_Aux__ctor") + "Example_Nested__ctor") .asFunction<jni.JniResult Function(int)>(); /// from: public void <init>(boolean value) /// The returned object must be deleted after use, by calling the `delete` method. - factory Example_Aux( + factory Example_Nested( bool value, ) { - return Example_Aux.fromRef(_ctor(value ? 1 : 0).object); + return Example_Nested.fromRef(_ctor(value ? 1 : 0).object); } static final _getValue = jniLookup< ffi.NativeFunction< jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("Example_Aux__getValue") + ffi.Pointer<ffi.Void>)>>("Example_Nested__getValue") .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); /// from: public boolean getValue() @@ -315,8 +572,8 @@ static final _setValue = jniLookup< ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Uint8)>>("Example_Aux__setValue") + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Uint8)>>("Example_Nested__setValue") .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); /// from: public void setValue(boolean value) @@ -327,15 +584,15 @@ } } -class $Example_AuxType extends jni.JObjType<Example_Aux> { - const $Example_AuxType(); +class $Example_NestedType extends jni.JObjType<Example_Nested> { + const $Example_NestedType(); @override String get signature => - r"Lcom/github/dart_lang/jnigen/simple_package/Example$Aux;"; + r"Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;"; @override - Example_Aux fromRef(jni.JObjectPtr ref) => Example_Aux.fromRef(ref); + Example_Nested fromRef(jni.JObjectPtr ref) => Example_Nested.fromRef(ref); @override jni.JObjType get superType => const jni.JObjectType(); @@ -344,11 +601,600 @@ final superCount = 1; @override - int get hashCode => ($Example_AuxType).hashCode; + int get hashCode => ($Example_NestedType).hashCode; @override bool operator ==(Object other) { - return other.runtimeType == $Example_AuxType && other is $Example_AuxType; + return other.runtimeType == $Example_NestedType && + other is $Example_NestedType; + } +} + +/// from: com.github.dart_lang.jnigen.simple_package.Exceptions +class Exceptions extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Exceptions.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $ExceptionsType(); + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Exceptions__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Exceptions() { + return Exceptions.fromRef(_ctor().object); + } + + static final _ctor1 = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Float)>>( + "Exceptions__ctor1") + .asFunction<jni.JniResult Function(double)>(); + + /// from: public void <init>(float x) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Exceptions.ctor1( + double x, + ) { + return Exceptions.fromRef(_ctor1(x).object); + } + + static final _ctor2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Int32, ffi.Int32, ffi.Int32, ffi.Int32, + ffi.Int32, ffi.Int32)>>("Exceptions__ctor2") + .asFunction<jni.JniResult Function(int, int, int, int, int, int)>(); + + /// from: public void <init>(int a, int b, int c, int d, int e, int f) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Exceptions.ctor2( + int a, + int b, + int c, + int d, + int e, + int f, + ) { + return Exceptions.fromRef(_ctor2(a, b, c, d, e, f).object); + } + + static final _staticObjectMethod = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Exceptions__staticObjectMethod") + .asFunction<jni.JniResult Function()>(); + + /// from: static public java.lang.Object staticObjectMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JObject staticObjectMethod() { + return const jni.JObjectType().fromRef(_staticObjectMethod().object); + } + + static final _staticIntMethod = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Exceptions__staticIntMethod") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int staticIntMethod() + static int staticIntMethod() { + return _staticIntMethod().integer; + } + + static final _staticObjectArrayMethod = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Exceptions__staticObjectArrayMethod") + .asFunction<jni.JniResult Function()>(); + + /// from: static public java.lang.Object[] staticObjectArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JArray<jni.JObject> staticObjectArrayMethod() { + return const jni.JArrayType(jni.JObjectType()) + .fromRef(_staticObjectArrayMethod().object); + } + + static final _staticIntArrayMethod = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Exceptions__staticIntArrayMethod") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int[] staticIntArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JArray<jni.JInt> staticIntArrayMethod() { + return const jni.JArrayType(jni.JIntType()) + .fromRef(_staticIntArrayMethod().object); + } + + static final _objectMethod = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Exceptions__objectMethod") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object objectMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject objectMethod() { + return const jni.JObjectType().fromRef(_objectMethod(reference).object); + } + + static final _intMethod = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Exceptions__intMethod") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int intMethod() + int intMethod() { + return _intMethod(reference).integer; + } + + static final _objectArrayMethod = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Exceptions__objectArrayMethod") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object[] objectArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JArray<jni.JObject> objectArrayMethod() { + return const jni.JArrayType(jni.JObjectType()) + .fromRef(_objectArrayMethod(reference).object); + } + + static final _intArrayMethod = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Exceptions__intArrayMethod") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int[] intArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JArray<jni.JInt> intArrayMethod() { + return const jni.JArrayType(jni.JIntType()) + .fromRef(_intArrayMethod(reference).object); + } + + static final _throwNullPointerException = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "Exceptions__throwNullPointerException") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int throwNullPointerException() + int throwNullPointerException() { + return _throwNullPointerException(reference).integer; + } + + static final _throwFileNotFoundException = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "Exceptions__throwFileNotFoundException") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.io.InputStream throwFileNotFoundException() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject throwFileNotFoundException() { + return const jni.JObjectType() + .fromRef(_throwFileNotFoundException(reference).object); + } + + static final _throwClassCastException = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "Exceptions__throwClassCastException") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.io.FileInputStream throwClassCastException() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject throwClassCastException() { + return const jni.JObjectType() + .fromRef(_throwClassCastException(reference).object); + } + + static final _throwArrayIndexException = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "Exceptions__throwArrayIndexException") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int throwArrayIndexException() + int throwArrayIndexException() { + return _throwArrayIndexException(reference).integer; + } + + static final _throwArithmeticException = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "Exceptions__throwArithmeticException") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int throwArithmeticException() + int throwArithmeticException() { + return _throwArithmeticException(reference).integer; + } + + static final _throwLoremIpsum = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Exceptions__throwLoremIpsum") + .asFunction<jni.JniResult Function()>(); + + /// from: static public void throwLoremIpsum() + static void throwLoremIpsum() { + return _throwLoremIpsum().check(); + } +} + +class $ExceptionsType extends jni.JObjType<Exceptions> { + const $ExceptionsType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Exceptions;"; + + @override + Exceptions fromRef(jni.JObjectPtr ref) => Exceptions.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ExceptionsType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $ExceptionsType && other is $ExceptionsType; + } +} + +/// from: com.github.dart_lang.jnigen.simple_package.Fields +class Fields extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Fields.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $FieldsType(); + static final _get_amount = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_Fields__amount") + .asFunction<jni.JniResult Function()>(); + + static final _set_amount = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( + "set_Fields__amount") + .asFunction<jni.JniResult Function(int)>(); + + /// from: static public int amount + static int get amount => _get_amount().integer; + + /// from: static public int amount + static set amount(int value) => _set_amount(value).check(); + + static final _get_pi = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("get_Fields__pi") + .asFunction<jni.JniResult Function()>(); + + static final _set_pi = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Double)>>( + "set_Fields__pi") + .asFunction<jni.JniResult Function(double)>(); + + /// from: static public double pi + static double get pi => _get_pi().doubleFloat; + + /// from: static public double pi + static set pi(double value) => _set_pi(value).check(); + + static final _get_asterisk = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_Fields__asterisk") + .asFunction<jni.JniResult Function()>(); + + static final _set_asterisk = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint16)>>( + "set_Fields__asterisk") + .asFunction<jni.JniResult Function(int)>(); + + /// from: static public char asterisk + static int get asterisk => _get_asterisk().char; + + /// from: static public char asterisk + static set asterisk(int value) => _set_asterisk(value).check(); + + static final _get_name = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_Fields__name") + .asFunction<jni.JniResult Function()>(); + + static final _set_name = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("set_Fields__name") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public java.lang.String name + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JString get name => + const jni.JStringType().fromRef(_get_name().object); + + /// from: static public java.lang.String name + /// The returned object must be deleted after use, by calling the `delete` method. + static set name(jni.JString value) => _set_name(value.reference).check(); + + static final _get_i = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>>("get_Fields__i") + .asFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>(); + + static final _set_i = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_Fields__i") + .asFunction< + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Integer i + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject get i => + const jni.JObjectType().fromRef(_get_i(reference).object); + + /// from: public java.lang.Integer i + /// The returned object must be deleted after use, by calling the `delete` method. + set i(jni.JObject value) => _set_i(reference, value.reference).check(); + + static final _get_trillion = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>>("get_Fields__trillion") + .asFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>(); + + static final _set_trillion = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, ffi.Int64)>>("set_Fields__trillion") + .asFunction<jni.JniResult Function(jni.JObjectPtr, int)>(); + + /// from: public long trillion + int get trillion => _get_trillion(reference).long; + + /// from: public long trillion + set trillion(int value) => _set_trillion(reference, value).check(); + + static final _get_isAchillesDead = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>>("get_Fields__isAchillesDead") + .asFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>(); + + static final _set_isAchillesDead = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, ffi.Uint8)>>("set_Fields__isAchillesDead") + .asFunction<jni.JniResult Function(jni.JObjectPtr, int)>(); + + /// from: public boolean isAchillesDead + bool get isAchillesDead => _get_isAchillesDead(reference).boolean; + + /// from: public boolean isAchillesDead + set isAchillesDead(bool value) => + _set_isAchillesDead(reference, value ? 1 : 0).check(); + + static final _get_bestFighterInGreece = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>>("get_Fields__bestFighterInGreece") + .asFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>(); + + static final _set_bestFighterInGreece = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(jni.JObjectPtr, + ffi.Pointer<ffi.Void>)>>("set_Fields__bestFighterInGreece") + .asFunction< + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String bestFighterInGreece + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JString get bestFighterInGreece => const jni.JStringType() + .fromRef(_get_bestFighterInGreece(reference).object); + + /// from: public java.lang.String bestFighterInGreece + /// The returned object must be deleted after use, by calling the `delete` method. + set bestFighterInGreece(jni.JString value) => + _set_bestFighterInGreece(reference, value.reference).check(); + + static final _get_random = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>>("get_Fields__random") + .asFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>(); + + static final _set_random = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_Fields__random") + .asFunction< + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Random random + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject get random => + const jni.JObjectType().fromRef(_get_random(reference).object); + + /// from: public java.util.Random random + /// The returned object must be deleted after use, by calling the `delete` method. + set random(jni.JObject value) => + _set_random(reference, value.reference).check(); + + static final _get_euroSymbol = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_Fields__euroSymbol") + .asFunction<jni.JniResult Function()>(); + + static final _set_euroSymbol = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint16)>>( + "set_Fields__euroSymbol") + .asFunction<jni.JniResult Function(int)>(); + + /// from: static public char euroSymbol + static int get euroSymbol => _get_euroSymbol().char; + + /// from: static public char euroSymbol + static set euroSymbol(int value) => _set_euroSymbol(value).check(); + + static final _ctor = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Fields__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Fields() { + return Fields.fromRef(_ctor().object); + } +} + +class $FieldsType extends jni.JObjType<Fields> { + const $FieldsType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Fields;"; + + @override + Fields fromRef(jni.JObjectPtr ref) => Fields.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($FieldsType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $FieldsType && other is $FieldsType; + } +} + +/// from: com.github.dart_lang.jnigen.simple_package.Fields$Nested +class Fields_Nested extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Fields_Nested.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + /// The type which includes information such as the signature of this class. + static const type = $Fields_NestedType(); + static final _get_hundred = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>>("get_Fields_Nested__hundred") + .asFunction< + jni.JniResult Function( + jni.JObjectPtr, + )>(); + + static final _set_hundred = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObjectPtr, ffi.Int64)>>("set_Fields_Nested__hundred") + .asFunction<jni.JniResult Function(jni.JObjectPtr, int)>(); + + /// from: public long hundred + int get hundred => _get_hundred(reference).long; + + /// from: public long hundred + set hundred(int value) => _set_hundred(reference, value).check(); + + static final _get_BEST_GOD = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_Fields_Nested__BEST_GOD") + .asFunction<jni.JniResult Function()>(); + + static final _set_BEST_GOD = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("set_Fields_Nested__BEST_GOD") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public java.lang.String BEST_GOD + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JString get BEST_GOD => + const jni.JStringType().fromRef(_get_BEST_GOD().object); + + /// from: static public java.lang.String BEST_GOD + /// The returned object must be deleted after use, by calling the `delete` method. + static set BEST_GOD(jni.JString value) => + _set_BEST_GOD(value.reference).check(); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "Fields_Nested__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Fields_Nested() { + return Fields_Nested.fromRef(_ctor().object); + } +} + +class $Fields_NestedType extends jni.JObjType<Fields_Nested> { + const $Fields_NestedType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Fields$Nested;"; + + @override + Fields_Nested fromRef(jni.JObjectPtr ref) => Fields_Nested.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Fields_NestedType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $Fields_NestedType && + other is $Fields_NestedType; } } @@ -369,15 +1215,15 @@ .asFunction<jni.JniResult Function()>(); static final _set_CONSTANT = - jniLookup<ffi.NativeFunction<jni.JThrowablePtr Function(ffi.Int32)>>( + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( "set_C2__CONSTANT") - .asFunction<jni.JThrowablePtr Function(int)>(); + .asFunction<jni.JniResult Function(int)>(); /// from: static public int CONSTANT static int get CONSTANT => _get_CONSTANT().integer; /// from: static public int CONSTANT - static set CONSTANT(int value) => _set_CONSTANT(value); + static set CONSTANT(int value) => _set_CONSTANT(value).check(); static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("C2__ctor") @@ -504,10 +1350,10 @@ static final _set_value = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_GrandParent__value") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public T value /// The returned object must be deleted after use, by calling the `delete` method. @@ -515,7 +1361,7 @@ /// 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).check(); static final _ctor = jniLookup< ffi.NativeFunction< @@ -684,11 +1530,11 @@ static final _set_parentValue = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_Parent__parentValue") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public T parentValue /// The returned object must be deleted after use, by calling the `delete` method. @@ -696,7 +1542,8 @@ /// 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).check(); static final _get_value = jniLookup< ffi.NativeFunction< @@ -710,10 +1557,10 @@ static final _set_value = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_GrandParent_Parent__value") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public S value /// The returned object must be deleted after use, by calling the `delete` method. @@ -721,7 +1568,7 @@ /// 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).check(); static final _ctor = jniLookup< ffi.NativeFunction< @@ -829,11 +1676,11 @@ static final _set_grandParentValue = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_Parent_Child__grandParentValue") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public T grandParentValue /// The returned object must be deleted after use, by calling the `delete` method. @@ -842,7 +1689,7 @@ /// from: public T grandParentValue /// The returned object must be deleted after use, by calling the `delete` method. set grandParentValue($T value) => - _set_grandParentValue(reference, value.reference); + _set_grandParentValue(reference, value.reference).check(); static final _get_parentValue = jniLookup< ffi.NativeFunction< @@ -856,11 +1703,11 @@ static final _set_parentValue = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_Parent_Child__parentValue") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public S parentValue /// The returned object must be deleted after use, by calling the `delete` method. @@ -868,7 +1715,8 @@ /// 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).check(); static final _get_value = jniLookup< ffi.NativeFunction< @@ -882,11 +1730,11 @@ static final _set_value = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_Parent_Child__value") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public U value /// The returned object must be deleted after use, by calling the `delete` method. @@ -894,7 +1742,7 @@ /// 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).check(); static final _ctor = jniLookup< ffi.NativeFunction< @@ -1008,11 +1856,11 @@ static final _set_value = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_StaticParent__value") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public S value /// The returned object must be deleted after use, by calling the `delete` method. @@ -1020,7 +1868,7 @@ /// 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).check(); static final _ctor = jniLookup< ffi.NativeFunction< @@ -1113,11 +1961,11 @@ static final _set_parentValue = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_StaticParent_Child__parentValue") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public S parentValue /// The returned object must be deleted after use, by calling the `delete` method. @@ -1125,7 +1973,8 @@ /// 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).check(); static final _get_value = jniLookup< ffi.NativeFunction< @@ -1139,11 +1988,11 @@ static final _set_value = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function( + jni.JniResult Function( jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>( "set_GrandParent_StaticParent_Child__value") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public U value /// The returned object must be deleted after use, by calling the `delete` method. @@ -1151,7 +2000,7 @@ /// 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).check(); static final _ctor = jniLookup< ffi.NativeFunction< @@ -1379,10 +2228,10 @@ static final _set_key = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_MyMap_MyEntry__key") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public K key /// The returned object must be deleted after use, by calling the `delete` method. @@ -1390,7 +2239,7 @@ /// 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).check(); static final _get_value = jniLookup< ffi.NativeFunction< @@ -1404,10 +2253,10 @@ static final _set_value = jniLookup< ffi.NativeFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>>("set_MyMap_MyEntry__value") .asFunction< - jni.JThrowablePtr Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); + jni.JniResult Function(jni.JObjectPtr, ffi.Pointer<ffi.Void>)>(); /// from: public V value /// The returned object must be deleted after use, by calling the `delete` method. @@ -1415,7 +2264,7 @@ /// 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).check(); static final _ctor = jniLookup< ffi.NativeFunction<
diff --git a/pkgs/jnigen/test/simple_package_test/dart_only/dart_bindings/simple_package.dart b/pkgs/jnigen/test/simple_package_test/dart_only/dart_bindings/simple_package.dart new file mode 100644 index 0000000..d1c4bdb --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/dart_only/dart_bindings/simple_package.dart
@@ -0,0 +1,2680 @@ +// Copyright (c) 2022, 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. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: file_names +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_shown_name + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +// Auto-generated initialization code. + +final jniEnv = jni.Jni.env; +final jniAccessors = jni.Jni.accessors; + +/// from: com.github.dart_lang.jnigen.simple_package.Example +class Example extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Example.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/simple_package/Example"); + + /// The type which includes information such as the signature of this class. + static const type = $ExampleType(); + + /// from: static public final int ON + static const ON = 1; + + /// from: static public final int OFF + static const OFF = 0; + + /// from: static public final double PI + static const PI = 3.14159; + + /// from: static public final char SEMICOLON + static const SEMICOLON = r""";"""; + + /// from: static public final java.lang.String SEMICOLON_STRING + static const SEMICOLON_STRING = r""";"""; + + static final _id_getAmount = + jniAccessors.getStaticMethodIDOf(_classRef, r"getAmount", r"()I"); + + /// from: static public int getAmount() + static int getAmount() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_getAmount, jni.JniCallType.intType, []).integer; + } + + static final _id_getPi = + jniAccessors.getStaticMethodIDOf(_classRef, r"getPi", r"()D"); + + /// from: static public double getPi() + static double getPi() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_getPi, jni.JniCallType.doubleType, []).doubleFloat; + } + + static final _id_getAsterisk = + jniAccessors.getStaticMethodIDOf(_classRef, r"getAsterisk", r"()C"); + + /// from: static public char getAsterisk() + static int getAsterisk() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_getAsterisk, jni.JniCallType.charType, []).char; + } + + static final _id_getName = jniAccessors.getStaticMethodIDOf( + _classRef, r"getName", r"()Ljava/lang/String;"); + + /// from: static public java.lang.String getName() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JString getName() { + return const jni.JStringType().fromRef(jniAccessors + .callStaticMethodWithArgs( + _classRef, _id_getName, jni.JniCallType.objectType, []).object); + } + + static final _id_getNestedInstance = jniAccessors.getStaticMethodIDOf( + _classRef, + r"getNestedInstance", + r"()Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;"); + + /// from: static public com.github.dart_lang.jnigen.simple_package.Example.Nested getNestedInstance() + /// The returned object must be deleted after use, by calling the `delete` method. + static Example_Nested getNestedInstance() { + return const $Example_NestedType().fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_getNestedInstance, + jni.JniCallType.objectType, []).object); + } + + static final _id_setAmount = + jniAccessors.getStaticMethodIDOf(_classRef, r"setAmount", r"(I)V"); + + /// from: static public void setAmount(int newAmount) + static void setAmount( + int newAmount, + ) { + return jniAccessors.callStaticMethodWithArgs(_classRef, _id_setAmount, + jni.JniCallType.voidType, [jni.JValueInt(newAmount)]).check(); + } + + static final _id_setName = jniAccessors.getStaticMethodIDOf( + _classRef, r"setName", r"(Ljava/lang/String;)V"); + + /// from: static public void setName(java.lang.String newName) + static void setName( + jni.JString newName, + ) { + return jniAccessors.callStaticMethodWithArgs(_classRef, _id_setName, + jni.JniCallType.voidType, [newName.reference]).check(); + } + + static final _id_setNestedInstance = jniAccessors.getStaticMethodIDOf( + _classRef, + r"setNestedInstance", + r"(Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;)V"); + + /// from: static public void setNestedInstance(com.github.dart_lang.jnigen.simple_package.Example.Nested newNested) + static void setNestedInstance( + Example_Nested newNested, + ) { + return jniAccessors.callStaticMethodWithArgs( + _classRef, + _id_setNestedInstance, + jni.JniCallType.voidType, + [newNested.reference]).check(); + } + + static final _id_max4 = + jniAccessors.getStaticMethodIDOf(_classRef, r"max4", r"(IIII)I"); + + /// from: static public int max4(int a, int b, int c, int d) + static int max4( + int a, + int b, + int c, + int d, + ) { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_max4, jni.JniCallType.intType, [ + jni.JValueInt(a), + jni.JValueInt(b), + jni.JValueInt(c), + jni.JValueInt(d) + ]).integer; + } + + static final _id_max8 = + jniAccessors.getStaticMethodIDOf(_classRef, r"max8", r"(IIIIIIII)I"); + + /// from: static public int max8(int a, int b, int c, int d, int e, int f, int g, int h) + static int max8( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + ) { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_max8, jni.JniCallType.intType, [ + jni.JValueInt(a), + jni.JValueInt(b), + jni.JValueInt(c), + jni.JValueInt(d), + jni.JValueInt(e), + jni.JValueInt(f), + jni.JValueInt(g), + jni.JValueInt(h) + ]).integer; + } + + static final _id_getNumber = + jniAccessors.getMethodIDOf(_classRef, r"getNumber", r"()I"); + + /// from: public int getNumber() + int getNumber() { + return jniAccessors.callMethodWithArgs( + reference, _id_getNumber, jni.JniCallType.intType, []).integer; + } + + static final _id_setNumber = + jniAccessors.getMethodIDOf(_classRef, r"setNumber", r"(I)V"); + + /// from: public void setNumber(int number) + void setNumber( + int number, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setNumber, + jni.JniCallType.voidType, [jni.JValueInt(number)]).check(); + } + + static final _id_getIsUp = + jniAccessors.getMethodIDOf(_classRef, r"getIsUp", r"()Z"); + + /// from: public boolean getIsUp() + bool getIsUp() { + return jniAccessors.callMethodWithArgs( + reference, _id_getIsUp, jni.JniCallType.booleanType, []).boolean; + } + + static final _id_setUp = + jniAccessors.getMethodIDOf(_classRef, r"setUp", r"(Z)V"); + + /// from: public void setUp(boolean isUp) + void setUp( + bool isUp, + ) { + return jniAccessors.callMethodWithArgs( + reference, _id_setUp, jni.JniCallType.voidType, [isUp ? 1 : 0]).check(); + } + + static final _id_getCodename = jniAccessors.getMethodIDOf( + _classRef, r"getCodename", r"()Ljava/lang/String;"); + + /// from: public java.lang.String getCodename() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JString getCodename() { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getCodename, jni.JniCallType.objectType, []).object); + } + + static final _id_setCodename = jniAccessors.getMethodIDOf( + _classRef, r"setCodename", r"(Ljava/lang/String;)V"); + + /// from: public void setCodename(java.lang.String codename) + void setCodename( + jni.JString codename, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setCodename, + jni.JniCallType.voidType, [codename.reference]).check(); + } + + static final _id_getRandom = jniAccessors.getMethodIDOf( + _classRef, r"getRandom", r"()Ljava/util/Random;"); + + /// from: public java.util.Random getRandom() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject getRandom() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getRandom, jni.JniCallType.objectType, []).object); + } + + static final _id_setRandom = jniAccessors.getMethodIDOf( + _classRef, r"setRandom", r"(Ljava/util/Random;)V"); + + /// from: public void setRandom(java.util.Random random) + void setRandom( + jni.JObject random, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setRandom, + jni.JniCallType.voidType, [random.reference]).check(); + } + + static final _id_getRandomLong = + jniAccessors.getMethodIDOf(_classRef, r"getRandomLong", r"()J"); + + /// from: public long getRandomLong() + int getRandomLong() { + return jniAccessors.callMethodWithArgs( + reference, _id_getRandomLong, jni.JniCallType.longType, []).long; + } + + static final _id_add4Longs = + jniAccessors.getMethodIDOf(_classRef, r"add4Longs", r"(JJJJ)J"); + + /// from: public long add4Longs(long a, long b, long c, long d) + int add4Longs( + int a, + int b, + int c, + int d, + ) { + return jniAccessors.callMethodWithArgs( + reference, _id_add4Longs, jni.JniCallType.longType, [a, b, c, d]).long; + } + + static final _id_add8Longs = + jniAccessors.getMethodIDOf(_classRef, r"add8Longs", r"(JJJJJJJJ)J"); + + /// from: public long add8Longs(long a, long b, long c, long d, long e, long f, long g, long h) + int add8Longs( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_add8Longs, + jni.JniCallType.longType, [a, b, c, d, e, f, g, h]).long; + } + + static final _id_getRandomNumericString = jniAccessors.getMethodIDOf( + _classRef, + r"getRandomNumericString", + r"(Ljava/util/Random;)Ljava/lang/String;"); + + /// from: public java.lang.String getRandomNumericString(java.util.Random random) + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JString getRandomNumericString( + jni.JObject random, + ) { + return const jni.JStringType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_getRandomNumericString, + jni.JniCallType.objectType, + [random.reference]).object); + } + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example() { + return Example.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } + + static final _id_ctor1 = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(I)V"); + + /// from: public void <init>(int number) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor1( + int number, + ) { + return Example.fromRef(jniAccessors.newObjectWithArgs( + _classRef, _id_ctor1, [jni.JValueInt(number)]).object); + } + + static final _id_ctor2 = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(IZ)V"); + + /// from: public void <init>(int number, boolean isUp) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor2( + int number, + bool isUp, + ) { + return Example.fromRef(jniAccessors.newObjectWithArgs( + _classRef, _id_ctor2, [jni.JValueInt(number), isUp ? 1 : 0]).object); + } + + static final _id_ctor3 = jniAccessors.getMethodIDOf( + _classRef, r"<init>", r"(IZLjava/lang/String;)V"); + + /// from: public void <init>(int number, boolean isUp, java.lang.String codename) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor3( + int number, + bool isUp, + jni.JString codename, + ) { + return Example.fromRef(jniAccessors.newObjectWithArgs(_classRef, _id_ctor3, + [jni.JValueInt(number), isUp ? 1 : 0, codename.reference]).object); + } + + static final _id_ctor4 = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(IIIIIIII)V"); + + /// from: public void <init>(int a, int b, int c, int d, int e, int f, int g, int h) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example.ctor4( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + ) { + return Example.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor4, [ + jni.JValueInt(a), + jni.JValueInt(b), + jni.JValueInt(c), + jni.JValueInt(d), + jni.JValueInt(e), + jni.JValueInt(f), + jni.JValueInt(g), + jni.JValueInt(h) + ]).object); + } + + static final _id_whichExample = + jniAccessors.getMethodIDOf(_classRef, r"whichExample", r"()I"); + + /// from: public int whichExample() + int whichExample() { + return jniAccessors.callMethodWithArgs( + reference, _id_whichExample, jni.JniCallType.intType, []).integer; + } + + static final _id_addInts = + jniAccessors.getStaticMethodIDOf(_classRef, r"addInts", r"(II)I"); + + /// from: static public int addInts(int a, int b) + static int addInts( + int a, + int b, + ) { + return jniAccessors.callStaticMethodWithArgs(_classRef, _id_addInts, + jni.JniCallType.intType, [jni.JValueInt(a), jni.JValueInt(b)]).integer; + } + + static final _id_getArr = + jniAccessors.getStaticMethodIDOf(_classRef, r"getArr", r"()[I"); + + /// from: static public int[] getArr() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JArray<jni.JInt> getArr() { + return const jni.JArrayType(jni.JIntType()).fromRef(jniAccessors + .callStaticMethodWithArgs( + _classRef, _id_getArr, jni.JniCallType.objectType, []).object); + } + + static final _id_addAll = + jniAccessors.getStaticMethodIDOf(_classRef, r"addAll", r"([I)I"); + + /// from: static public int addAll(int[] arr) + static int addAll( + jni.JArray<jni.JInt> arr, + ) { + return jniAccessors.callStaticMethodWithArgs(_classRef, _id_addAll, + jni.JniCallType.intType, [arr.reference]).integer; + } + + static final _id_getSelf = jniAccessors.getMethodIDOf(_classRef, r"getSelf", + r"()Lcom/github/dart_lang/jnigen/simple_package/Example;"); + + /// 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() { + return const $ExampleType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_getSelf, jni.JniCallType.objectType, []).object); + } + + static final _id_throwException = + jniAccessors.getStaticMethodIDOf(_classRef, r"throwException", r"()V"); + + /// from: static public void throwException() + static void throwException() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_throwException, jni.JniCallType.voidType, []).check(); + } +} + +class $ExampleType extends jni.JObjType<Example> { + const $ExampleType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Example;"; + + @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$Nested +class Example_Nested extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Example_Nested.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/simple_package/Example$Nested"); + + /// The type which includes information such as the signature of this class. + static const type = $Example_NestedType(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(Z)V"); + + /// from: public void <init>(boolean value) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example_Nested( + bool value, + ) { + return Example_Nested.fromRef(jniAccessors + .newObjectWithArgs(_classRef, _id_ctor, [value ? 1 : 0]).object); + } + + static final _id_getValue = + jniAccessors.getMethodIDOf(_classRef, r"getValue", r"()Z"); + + /// from: public boolean getValue() + bool getValue() { + return jniAccessors.callMethodWithArgs( + reference, _id_getValue, jni.JniCallType.booleanType, []).boolean; + } + + static final _id_setValue = + jniAccessors.getMethodIDOf(_classRef, r"setValue", r"(Z)V"); + + /// from: public void setValue(boolean value) + void setValue( + bool value, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_setValue, + jni.JniCallType.voidType, [value ? 1 : 0]).check(); + } +} + +class $Example_NestedType extends jni.JObjType<Example_Nested> { + const $Example_NestedType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Example$Nested;"; + + @override + Example_Nested fromRef(jni.JObjectPtr ref) => Example_Nested.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Example_NestedType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $Example_NestedType && + other is $Example_NestedType; + } +} + +/// from: com.github.dart_lang.jnigen.simple_package.Exceptions +class Exceptions extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Exceptions.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/simple_package/Exceptions"); + + /// The type which includes information such as the signature of this class. + static const type = $ExceptionsType(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Exceptions() { + return Exceptions.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } + + static final _id_ctor1 = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(F)V"); + + /// from: public void <init>(float x) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Exceptions.ctor1( + double x, + ) { + return Exceptions.fromRef(jniAccessors + .newObjectWithArgs(_classRef, _id_ctor1, [jni.JValueFloat(x)]).object); + } + + static final _id_ctor2 = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"(IIIIII)V"); + + /// from: public void <init>(int a, int b, int c, int d, int e, int f) + /// The returned object must be deleted after use, by calling the `delete` method. + factory Exceptions.ctor2( + int a, + int b, + int c, + int d, + int e, + int f, + ) { + return Exceptions.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor2, [ + jni.JValueInt(a), + jni.JValueInt(b), + jni.JValueInt(c), + jni.JValueInt(d), + jni.JValueInt(e), + jni.JValueInt(f) + ]).object); + } + + static final _id_staticObjectMethod = jniAccessors.getStaticMethodIDOf( + _classRef, r"staticObjectMethod", r"()Ljava/lang/Object;"); + + /// from: static public java.lang.Object staticObjectMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JObject staticObjectMethod() { + return const jni.JObjectType().fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_staticObjectMethod, + jni.JniCallType.objectType, []).object); + } + + static final _id_staticIntMethod = + jniAccessors.getStaticMethodIDOf(_classRef, r"staticIntMethod", r"()I"); + + /// from: static public int staticIntMethod() + static int staticIntMethod() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_staticIntMethod, jni.JniCallType.intType, []).integer; + } + + static final _id_staticObjectArrayMethod = jniAccessors.getStaticMethodIDOf( + _classRef, r"staticObjectArrayMethod", r"()[Ljava/lang/Object;"); + + /// from: static public java.lang.Object[] staticObjectArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JArray<jni.JObject> staticObjectArrayMethod() { + return const jni.JArrayType(jni.JObjectType()).fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_staticObjectArrayMethod, + jni.JniCallType.objectType, []).object); + } + + static final _id_staticIntArrayMethod = jniAccessors.getStaticMethodIDOf( + _classRef, r"staticIntArrayMethod", r"()[I"); + + /// from: static public int[] staticIntArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JArray<jni.JInt> staticIntArrayMethod() { + return const jni.JArrayType(jni.JIntType()).fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_staticIntArrayMethod, + jni.JniCallType.objectType, []).object); + } + + static final _id_objectMethod = jniAccessors.getMethodIDOf( + _classRef, r"objectMethod", r"()Ljava/lang/Object;"); + + /// from: public java.lang.Object objectMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject objectMethod() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, _id_objectMethod, jni.JniCallType.objectType, []).object); + } + + static final _id_intMethod = + jniAccessors.getMethodIDOf(_classRef, r"intMethod", r"()I"); + + /// from: public int intMethod() + int intMethod() { + return jniAccessors.callMethodWithArgs( + reference, _id_intMethod, jni.JniCallType.intType, []).integer; + } + + static final _id_objectArrayMethod = jniAccessors.getMethodIDOf( + _classRef, r"objectArrayMethod", r"()[Ljava/lang/Object;"); + + /// from: public java.lang.Object[] objectArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JArray<jni.JObject> objectArrayMethod() { + return const jni.JArrayType(jni.JObjectType()).fromRef(jniAccessors + .callMethodWithArgs(reference, _id_objectArrayMethod, + jni.JniCallType.objectType, []).object); + } + + static final _id_intArrayMethod = + jniAccessors.getMethodIDOf(_classRef, r"intArrayMethod", r"()[I"); + + /// from: public int[] intArrayMethod() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JArray<jni.JInt> intArrayMethod() { + return const jni.JArrayType(jni.JIntType()).fromRef(jniAccessors + .callMethodWithArgs(reference, _id_intArrayMethod, + jni.JniCallType.objectType, []).object); + } + + static final _id_throwNullPointerException = jniAccessors.getMethodIDOf( + _classRef, r"throwNullPointerException", r"()I"); + + /// from: public int throwNullPointerException() + int throwNullPointerException() { + return jniAccessors.callMethodWithArgs(reference, + _id_throwNullPointerException, jni.JniCallType.intType, []).integer; + } + + static final _id_throwFileNotFoundException = jniAccessors.getMethodIDOf( + _classRef, r"throwFileNotFoundException", r"()Ljava/io/InputStream;"); + + /// from: public java.io.InputStream throwFileNotFoundException() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject throwFileNotFoundException() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_throwFileNotFoundException, + jni.JniCallType.objectType, []).object); + } + + static final _id_throwClassCastException = jniAccessors.getMethodIDOf( + _classRef, r"throwClassCastException", r"()Ljava/io/FileInputStream;"); + + /// from: public java.io.FileInputStream throwClassCastException() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject throwClassCastException() { + return const jni.JObjectType().fromRef(jniAccessors.callMethodWithArgs( + reference, + _id_throwClassCastException, + jni.JniCallType.objectType, []).object); + } + + static final _id_throwArrayIndexException = jniAccessors.getMethodIDOf( + _classRef, r"throwArrayIndexException", r"()I"); + + /// from: public int throwArrayIndexException() + int throwArrayIndexException() { + return jniAccessors.callMethodWithArgs(reference, + _id_throwArrayIndexException, jni.JniCallType.intType, []).integer; + } + + static final _id_throwArithmeticException = jniAccessors.getMethodIDOf( + _classRef, r"throwArithmeticException", r"()I"); + + /// from: public int throwArithmeticException() + int throwArithmeticException() { + return jniAccessors.callMethodWithArgs(reference, + _id_throwArithmeticException, jni.JniCallType.intType, []).integer; + } + + static final _id_throwLoremIpsum = + jniAccessors.getStaticMethodIDOf(_classRef, r"throwLoremIpsum", r"()V"); + + /// from: static public void throwLoremIpsum() + static void throwLoremIpsum() { + return jniAccessors.callStaticMethodWithArgs( + _classRef, _id_throwLoremIpsum, jni.JniCallType.voidType, []).check(); + } +} + +class $ExceptionsType extends jni.JObjType<Exceptions> { + const $ExceptionsType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Exceptions;"; + + @override + Exceptions fromRef(jni.JObjectPtr ref) => Exceptions.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ExceptionsType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $ExceptionsType && other is $ExceptionsType; + } +} + +/// from: com.github.dart_lang.jnigen.simple_package.Fields +class Fields extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Fields.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/simple_package/Fields"); + + /// The type which includes information such as the signature of this class. + static const type = $FieldsType(); + static final _id_amount = jniAccessors.getStaticFieldIDOf( + _classRef, + r"amount", + r"I", + ); + + /// from: static public int amount + static int get amount => jniAccessors + .getStaticField(_classRef, _id_amount, jni.JniCallType.intType) + .integer; + + /// from: static public int amount + static set amount(int value) => + jniEnv.SetStaticIntField(_classRef, _id_amount, value); + + static final _id_pi = jniAccessors.getStaticFieldIDOf( + _classRef, + r"pi", + r"D", + ); + + /// from: static public double pi + static double get pi => jniAccessors + .getStaticField(_classRef, _id_pi, jni.JniCallType.doubleType) + .doubleFloat; + + /// from: static public double pi + static set pi(double value) => + jniEnv.SetStaticDoubleField(_classRef, _id_pi, value); + + static final _id_asterisk = jniAccessors.getStaticFieldIDOf( + _classRef, + r"asterisk", + r"C", + ); + + /// from: static public char asterisk + static int get asterisk => jniAccessors + .getStaticField(_classRef, _id_asterisk, jni.JniCallType.charType) + .char; + + /// from: static public char asterisk + static set asterisk(int value) => + jniEnv.SetStaticCharField(_classRef, _id_asterisk, value); + + static final _id_name = jniAccessors.getStaticFieldIDOf( + _classRef, + r"name", + r"Ljava/lang/String;", + ); + + /// from: static public java.lang.String name + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JString get name => const jni.JStringType().fromRef(jniAccessors + .getStaticField(_classRef, _id_name, jni.JniCallType.objectType) + .object); + + /// from: static public java.lang.String name + /// The returned object must be deleted after use, by calling the `delete` method. + static set name(jni.JString value) => + jniEnv.SetStaticObjectField(_classRef, _id_name, value.reference); + + static final _id_i = jniAccessors.getFieldIDOf( + _classRef, + r"i", + r"Ljava/lang/Integer;", + ); + + /// from: public java.lang.Integer i + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject get i => const jni.JObjectType().fromRef(jniAccessors + .getField(reference, _id_i, jni.JniCallType.objectType) + .object); + + /// from: public java.lang.Integer i + /// The returned object must be deleted after use, by calling the `delete` method. + set i(jni.JObject value) => + jniEnv.SetObjectField(reference, _id_i, value.reference); + + static final _id_trillion = jniAccessors.getFieldIDOf( + _classRef, + r"trillion", + r"J", + ); + + /// from: public long trillion + int get trillion => jniAccessors + .getField(reference, _id_trillion, jni.JniCallType.longType) + .long; + + /// from: public long trillion + set trillion(int value) => + jniEnv.SetLongField(reference, _id_trillion, value); + + static final _id_isAchillesDead = jniAccessors.getFieldIDOf( + _classRef, + r"isAchillesDead", + r"Z", + ); + + /// from: public boolean isAchillesDead + bool get isAchillesDead => jniAccessors + .getField(reference, _id_isAchillesDead, jni.JniCallType.booleanType) + .boolean; + + /// from: public boolean isAchillesDead + set isAchillesDead(bool value) => + jniEnv.SetBooleanField(reference, _id_isAchillesDead, value ? 1 : 0); + + static final _id_bestFighterInGreece = jniAccessors.getFieldIDOf( + _classRef, + r"bestFighterInGreece", + r"Ljava/lang/String;", + ); + + /// from: public java.lang.String bestFighterInGreece + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JString get bestFighterInGreece => + const jni.JStringType().fromRef(jniAccessors + .getField( + reference, _id_bestFighterInGreece, jni.JniCallType.objectType) + .object); + + /// from: public java.lang.String bestFighterInGreece + /// The returned object must be deleted after use, by calling the `delete` method. + set bestFighterInGreece(jni.JString value) => jniEnv.SetObjectField( + reference, _id_bestFighterInGreece, value.reference); + + static final _id_random = jniAccessors.getFieldIDOf( + _classRef, + r"random", + r"Ljava/util/Random;", + ); + + /// from: public java.util.Random random + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JObject get random => const jni.JObjectType().fromRef(jniAccessors + .getField(reference, _id_random, jni.JniCallType.objectType) + .object); + + /// from: public java.util.Random random + /// The returned object must be deleted after use, by calling the `delete` method. + set random(jni.JObject value) => + jniEnv.SetObjectField(reference, _id_random, value.reference); + + static final _id_euroSymbol = jniAccessors.getStaticFieldIDOf( + _classRef, + r"euroSymbol", + r"C", + ); + + /// from: static public char euroSymbol + static int get euroSymbol => jniAccessors + .getStaticField(_classRef, _id_euroSymbol, jni.JniCallType.charType) + .char; + + /// from: static public char euroSymbol + static set euroSymbol(int value) => + jniEnv.SetStaticCharField(_classRef, _id_euroSymbol, value); + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Fields() { + return Fields.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $FieldsType extends jni.JObjType<Fields> { + const $FieldsType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Fields;"; + + @override + Fields fromRef(jni.JObjectPtr ref) => Fields.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($FieldsType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $FieldsType && other is $FieldsType; + } +} + +/// from: com.github.dart_lang.jnigen.simple_package.Fields$Nested +class Fields_Nested extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Fields_Nested.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/simple_package/Fields$Nested"); + + /// The type which includes information such as the signature of this class. + static const type = $Fields_NestedType(); + static final _id_hundred = jniAccessors.getFieldIDOf( + _classRef, + r"hundred", + r"J", + ); + + /// from: public long hundred + int get hundred => jniAccessors + .getField(reference, _id_hundred, jni.JniCallType.longType) + .long; + + /// from: public long hundred + set hundred(int value) => jniEnv.SetLongField(reference, _id_hundred, value); + + static final _id_BEST_GOD = jniAccessors.getStaticFieldIDOf( + _classRef, + r"BEST_GOD", + r"Ljava/lang/String;", + ); + + /// from: static public java.lang.String BEST_GOD + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JString get BEST_GOD => + const jni.JStringType().fromRef(jniAccessors + .getStaticField(_classRef, _id_BEST_GOD, jni.JniCallType.objectType) + .object); + + /// from: static public java.lang.String BEST_GOD + /// The returned object must be deleted after use, by calling the `delete` method. + static set BEST_GOD(jni.JString value) => + jniEnv.SetStaticObjectField(_classRef, _id_BEST_GOD, value.reference); + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Fields_Nested() { + return Fields_Nested.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $Fields_NestedType extends jni.JObjType<Fields_Nested> { + const $Fields_NestedType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/simple_package/Fields$Nested;"; + + @override + Fields_Nested fromRef(jni.JObjectPtr ref) => Fields_Nested.fromRef(ref); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Fields_NestedType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == $Fields_NestedType && + other is $Fields_NestedType; + } +} + +/// from: com.github.dart_lang.jnigen.pkg2.C2 +class C2 extends jni.JObject { + @override + late final jni.JObjType $type = type; + + C2.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = + jniAccessors.getClassOf(r"com/github/dart_lang/jnigen/pkg2/C2"); + + /// The type which includes information such as the signature of this class. + static const type = $C2Type(); + static final _id_CONSTANT = jniAccessors.getStaticFieldIDOf( + _classRef, + r"CONSTANT", + r"I", + ); + + /// from: static public int CONSTANT + static int get CONSTANT => jniAccessors + .getStaticField(_classRef, _id_CONSTANT, jni.JniCallType.intType) + .integer; + + /// from: static public int CONSTANT + static set CONSTANT(int value) => + jniEnv.SetStaticIntField(_classRef, _id_CONSTANT, value); + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory C2() { + return C2.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $C2Type extends jni.JObjType<C2> { + const $C2Type(); + + @override + String get signature => r"Lcom/github/dart_lang/jnigen/pkg2/C2;"; + + @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 { + @override + late final jni.JObjType $type = type; + + Example1.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = + jniAccessors.getClassOf(r"com/github/dart_lang/jnigen/pkg2/Example"); + + /// The type which includes information such as the signature of this class. + static const type = $Example1Type(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory Example1() { + return Example1.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } + + static final _id_whichExample = + jniAccessors.getMethodIDOf(_classRef, r"whichExample", r"()I"); + + /// from: public int whichExample() + int whichExample() { + return jniAccessors.callMethodWithArgs( + reference, _id_whichExample, jni.JniCallType.intType, []).integer; + } +} + +class $Example1Type extends jni.JObjType<Example1> { + const $Example1Type(); + + @override + String get signature => r"Lcom/github/dart_lang/jnigen/pkg2/Example;"; + + @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 { + @override + late final jni.JObjType $type = type(T); + + final jni.JObjType<$T> T; + + GrandParent.fromRef( + this.T, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/GrandParent"); + + /// The type which includes information such as the signature of this class. + static $GrandParentType<$T> type<$T extends jni.JObject>( + jni.JObjType<$T> T, + ) { + return $GrandParentType( + T, + ); + } + + static final _id_value = jniAccessors.getFieldIDOf( + _classRef, + r"value", + r"Ljava/lang/Object;", + ); + + /// from: public T value + /// The returned object must be deleted after use, by calling the `delete` method. + $T get value => T.fromRef(jniAccessors + .getField(reference, _id_value, jni.JniCallType.objectType) + .object); + + /// from: public T value + /// The returned object must be deleted after use, by calling the `delete` method. + set value($T value) => + jniEnv.SetObjectField(reference, _id_value, value.reference); + + static final _id_ctor = jniAccessors.getMethodIDOf( + _classRef, r"<init>", r"(Ljava/lang/Object;)V"); + + /// from: public void <init>(T value) + /// The returned object must be deleted after use, by calling the `delete` method. + factory GrandParent( + $T value, { + jni.JObjType<$T>? T, + }) { + T ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$T>; + return GrandParent.fromRef( + T, + jniAccessors + .newObjectWithArgs(_classRef, _id_ctor, [value.reference]).object); + } + + static final _id_stringParent = jniAccessors.getMethodIDOf( + _classRef, + r"stringParent", + r"()Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;"); + + /// 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() { + return const $GrandParent_ParentType(jni.JObjectType(), jni.JStringType()) + .fromRef(jniAccessors.callMethodWithArgs(reference, _id_stringParent, + jni.JniCallType.objectType, []).object); + } + + static final _id_varParent = jniAccessors.getMethodIDOf( + _classRef, + r"varParent", + r"(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;"); + + /// 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>( + $S nestedValue, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + nestedValue.$type, + ]) as jni.JObjType<$S>; + return $GrandParent_ParentType(const jni.JObjectType(), S).fromRef( + jniAccessors.callMethodWithArgs(reference, _id_varParent, + jni.JniCallType.objectType, [nestedValue.reference]).object); + } + + static final _id_stringStaticParent = jniAccessors.getStaticMethodIDOf( + _classRef, + r"stringStaticParent", + r"()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); + + /// 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() { + return const $GrandParent_StaticParentType(jni.JStringType()).fromRef( + jniAccessors.callStaticMethodWithArgs(_classRef, _id_stringStaticParent, + jni.JniCallType.objectType, []).object); + } + + static final _id_varStaticParent = jniAccessors.getStaticMethodIDOf( + _classRef, + r"varStaticParent", + r"(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); + + /// 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>( + $S value, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$S>; + return $GrandParent_StaticParentType(S).fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_varStaticParent, + jni.JniCallType.objectType, [value.reference]).object); + } + + static final _id_staticParentWithSameType = jniAccessors.getMethodIDOf( + _classRef, + r"staticParentWithSameType", + r"()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); + + /// 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() { + return $GrandParent_StaticParentType(T).fromRef(jniAccessors + .callMethodWithArgs(reference, _id_staticParentWithSameType, + jni.JniCallType.objectType, []).object); + } +} + +class $GrandParentType<$T extends jni.JObject> + extends jni.JObjType<GrandParent<$T>> { + final jni.JObjType<$T> T; + + const $GrandParentType( + 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); + + @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> + extends jni.JObject { + @override + late final jni.JObjType $type = type(T, S); + + final jni.JObjType<$T> T; + final jni.JObjType<$S> S; + + GrandParent_Parent.fromRef( + this.T, + this.S, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/GrandParent$Parent"); + + /// 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, + ) { + return $GrandParent_ParentType( + T, + S, + ); + } + + static final _id_parentValue = jniAccessors.getFieldIDOf( + _classRef, + r"parentValue", + r"Ljava/lang/Object;", + ); + + /// from: public T parentValue + /// The returned object must be deleted after use, by calling the `delete` method. + $T get parentValue => T.fromRef(jniAccessors + .getField(reference, _id_parentValue, jni.JniCallType.objectType) + .object); + + /// from: public T parentValue + /// The returned object must be deleted after use, by calling the `delete` method. + set parentValue($T value) => + jniEnv.SetObjectField(reference, _id_parentValue, value.reference); + + static final _id_value = jniAccessors.getFieldIDOf( + _classRef, + r"value", + r"Ljava/lang/Object;", + ); + + /// from: public S value + /// The returned object must be deleted after use, by calling the `delete` method. + $S get value => S.fromRef(jniAccessors + .getField(reference, _id_value, jni.JniCallType.objectType) + .object); + + /// from: public S value + /// The returned object must be deleted after use, by calling the `delete` method. + set value($S value) => + jniEnv.SetObjectField(reference, _id_value, value.reference); + + static final _id_ctor = jniAccessors.getMethodIDOf( + _classRef, r"<init>", r"(Ljava/lang/Object;Ljava/lang/Object;)V"); + + /// from: public void <init>(T parentValue, S value) + /// The returned object must be deleted after use, by calling the `delete` method. + 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, + jniAccessors.newObjectWithArgs(_classRef, _id_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; + + const $GrandParent_ParentType( + this.T, + this.S, + ); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;"; + + @override + 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 { + @override + late final jni.JObjType $type = type(T, S, 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, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors.getClassOf( + r"com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); + + /// 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, + ) { + return $GrandParent_Parent_ChildType( + T, + S, + U, + ); + } + + static final _id_grandParentValue = jniAccessors.getFieldIDOf( + _classRef, + r"grandParentValue", + r"Ljava/lang/Object;", + ); + + /// from: public T grandParentValue + /// The returned object must be deleted after use, by calling the `delete` method. + $T get grandParentValue => T.fromRef(jniAccessors + .getField(reference, _id_grandParentValue, jni.JniCallType.objectType) + .object); + + /// from: public T grandParentValue + /// The returned object must be deleted after use, by calling the `delete` method. + set grandParentValue($T value) => + jniEnv.SetObjectField(reference, _id_grandParentValue, value.reference); + + static final _id_parentValue = jniAccessors.getFieldIDOf( + _classRef, + r"parentValue", + r"Ljava/lang/Object;", + ); + + /// from: public S parentValue + /// The returned object must be deleted after use, by calling the `delete` method. + $S get parentValue => S.fromRef(jniAccessors + .getField(reference, _id_parentValue, jni.JniCallType.objectType) + .object); + + /// from: public S parentValue + /// The returned object must be deleted after use, by calling the `delete` method. + set parentValue($S value) => + jniEnv.SetObjectField(reference, _id_parentValue, value.reference); + + static final _id_value = jniAccessors.getFieldIDOf( + _classRef, + r"value", + r"Ljava/lang/Object;", + ); + + /// from: public U value + /// The returned object must be deleted after use, by calling the `delete` method. + $U get value => U.fromRef(jniAccessors + .getField(reference, _id_value, jni.JniCallType.objectType) + .object); + + /// from: public U value + /// The returned object must be deleted after use, by calling the `delete` method. + set value($U value) => + jniEnv.SetObjectField(reference, _id_value, value.reference); + + static final _id_ctor = jniAccessors.getMethodIDOf(_classRef, r"<init>", + r"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"); + + /// from: public void <init>(T grandParentValue, S parentValue, U value) + /// The returned object must be deleted after use, by calling the `delete` method. + 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, + jniAccessors.newObjectWithArgs(_classRef, _id_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; + + const $GrandParent_Parent_ChildType( + this.T, + this.S, + this.U, + ); + + @override + String get signature => + 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); + + @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 { + @override + late final jni.JObjType $type = type(S); + + final jni.JObjType<$S> S; + + GrandParent_StaticParent.fromRef( + this.S, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors.getClassOf( + r"com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); + + /// 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, + ) { + return $GrandParent_StaticParentType( + S, + ); + } + + static final _id_value = jniAccessors.getFieldIDOf( + _classRef, + r"value", + r"Ljava/lang/Object;", + ); + + /// from: public S value + /// The returned object must be deleted after use, by calling the `delete` method. + $S get value => S.fromRef(jniAccessors + .getField(reference, _id_value, jni.JniCallType.objectType) + .object); + + /// from: public S value + /// The returned object must be deleted after use, by calling the `delete` method. + set value($S value) => + jniEnv.SetObjectField(reference, _id_value, value.reference); + + static final _id_ctor = jniAccessors.getMethodIDOf( + _classRef, r"<init>", r"(Ljava/lang/Object;)V"); + + /// from: public void <init>(S value) + /// The returned object must be deleted after use, by calling the `delete` method. + factory GrandParent_StaticParent( + $S value, { + jni.JObjType<$S>? S, + }) { + S ??= jni.lowestCommonSuperType([ + value.$type, + ]) as jni.JObjType<$S>; + return GrandParent_StaticParent.fromRef( + S, + jniAccessors + .newObjectWithArgs(_classRef, _id_ctor, [value.reference]).object); + } +} + +class $GrandParent_StaticParentType<$S extends jni.JObject> + extends jni.JObjType<GrandParent_StaticParent<$S>> { + final jni.JObjType<$S> S; + + const $GrandParent_StaticParentType( + this.S, + ); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"; + + @override + 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 { + @override + late final jni.JObjType $type = type(S, U); + + final jni.JObjType<$S> S; + final jni.JObjType<$U> U; + + GrandParent_StaticParent_Child.fromRef( + this.S, + this.U, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors.getClassOf( + r"com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); + + /// 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, + ) { + return $GrandParent_StaticParent_ChildType( + S, + U, + ); + } + + static final _id_parentValue = jniAccessors.getFieldIDOf( + _classRef, + r"parentValue", + r"Ljava/lang/Object;", + ); + + /// from: public S parentValue + /// The returned object must be deleted after use, by calling the `delete` method. + $S get parentValue => S.fromRef(jniAccessors + .getField(reference, _id_parentValue, jni.JniCallType.objectType) + .object); + + /// from: public S parentValue + /// The returned object must be deleted after use, by calling the `delete` method. + set parentValue($S value) => + jniEnv.SetObjectField(reference, _id_parentValue, value.reference); + + static final _id_value = jniAccessors.getFieldIDOf( + _classRef, + r"value", + r"Ljava/lang/Object;", + ); + + /// from: public U value + /// The returned object must be deleted after use, by calling the `delete` method. + $U get value => U.fromRef(jniAccessors + .getField(reference, _id_value, jni.JniCallType.objectType) + .object); + + /// from: public U value + /// The returned object must be deleted after use, by calling the `delete` method. + set value($U value) => + jniEnv.SetObjectField(reference, _id_value, value.reference); + + static final _id_ctor = jniAccessors.getMethodIDOf( + _classRef, r"<init>", r"(Ljava/lang/Object;Ljava/lang/Object;)V"); + + /// from: public void <init>(S parentValue, U value) + /// The returned object must be deleted after use, by calling the `delete` method. + 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, + jniAccessors.newObjectWithArgs(_classRef, _id_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; + + const $GrandParent_StaticParent_ChildType( + this.S, + this.U, + ); + + @override + String get signature => + 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); + + @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 { + @override + late final jni.JObjType $type = type(K, V); + + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; + + MyMap.fromRef( + this.K, + this.V, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = + jniAccessors.getClassOf(r"com/github/dart_lang/jnigen/generics/MyMap"); + + /// 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, + ) { + return $MyMapType( + K, + V, + ); + } + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory MyMap({ + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return MyMap.fromRef( + K, V, jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } + + static final _id_get0 = jniAccessors.getMethodIDOf( + _classRef, r"get", r"(Ljava/lang/Object;)Ljava/lang/Object;"); + + /// from: public V get(K key) + /// The returned object must be deleted after use, by calling the `delete` method. + $V get0( + $K key, + ) { + return V.fromRef(jniAccessors.callMethodWithArgs(reference, _id_get0, + jni.JniCallType.objectType, [key.reference]).object); + } + + static final _id_put = jniAccessors.getMethodIDOf(_classRef, r"put", + r"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + + /// 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, + ) { + return V.fromRef(jniAccessors.callMethodWithArgs(reference, _id_put, + jni.JniCallType.objectType, [key.reference, value.reference]).object); + } + + static final _id_entryStack = jniAccessors.getMethodIDOf(_classRef, + r"entryStack", r"()Lcom/github/dart_lang/jnigen/generics/MyStack;"); + + /// 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() { + return const $MyStackType( + $MyMap_MyEntryType(jni.JObjectType(), jni.JObjectType())) + .fromRef(jniAccessors.callMethodWithArgs( + reference, _id_entryStack, jni.JniCallType.objectType, []).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; + + const $MyMapType( + 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); + + @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> + extends jni.JObject { + @override + late final jni.JObjType $type = type(K, V); + + final jni.JObjType<$K> K; + final jni.JObjType<$V> V; + + MyMap_MyEntry.fromRef( + this.K, + this.V, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); + + /// 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, + ) { + return $MyMap_MyEntryType( + K, + V, + ); + } + + static final _id_key = jniAccessors.getFieldIDOf( + _classRef, + r"key", + r"Ljava/lang/Object;", + ); + + /// from: public K key + /// The returned object must be deleted after use, by calling the `delete` method. + $K get key => K.fromRef(jniAccessors + .getField(reference, _id_key, jni.JniCallType.objectType) + .object); + + /// from: public K key + /// The returned object must be deleted after use, by calling the `delete` method. + set key($K value) => + jniEnv.SetObjectField(reference, _id_key, value.reference); + + static final _id_value = jniAccessors.getFieldIDOf( + _classRef, + r"value", + r"Ljava/lang/Object;", + ); + + /// from: public V value + /// The returned object must be deleted after use, by calling the `delete` method. + $V get value => V.fromRef(jniAccessors + .getField(reference, _id_value, jni.JniCallType.objectType) + .object); + + /// from: public V value + /// The returned object must be deleted after use, by calling the `delete` method. + set value($V value) => + jniEnv.SetObjectField(reference, _id_value, value.reference); + + static final _id_ctor = jniAccessors.getMethodIDOf( + _classRef, r"<init>", r"(Ljava/lang/Object;Ljava/lang/Object;)V"); + + /// from: public void <init>(K key, V value) + /// The returned object must be deleted after use, by calling the `delete` method. + 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, + jniAccessors.newObjectWithArgs( + _classRef, _id_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; + + const $MyMap_MyEntryType( + this.K, + this.V, + ); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/generics/MyMap$MyEntry;"; + + @override + 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 { + @override + late final jni.JObjType $type = type(T); + + final jni.JObjType<$T> T; + + MyStack.fromRef( + this.T, + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = + jniAccessors.getClassOf(r"com/github/dart_lang/jnigen/generics/MyStack"); + + /// The type which includes information such as the signature of this class. + static $MyStackType<$T> type<$T extends jni.JObject>( + jni.JObjType<$T> T, + ) { + return $MyStackType( + T, + ); + } + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory MyStack({ + required jni.JObjType<$T> T, + }) { + return MyStack.fromRef( + T, jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } + + static final _id_fromArray = jniAccessors.getStaticMethodIDOf( + _classRef, + r"fromArray", + r"([Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;"); + + /// 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(jniAccessors.callStaticMethodWithArgs( + _classRef, + _id_fromArray, + jni.JniCallType.objectType, + [arr.reference]).object); + } + + static final _id_fromArrayOfArrayOfGrandParents = + jniAccessors.getStaticMethodIDOf( + _classRef, + r"fromArrayOfArrayOfGrandParents", + r"([[Lcom/github/dart_lang/jnigen/generics/GrandParent;)Lcom/github/dart_lang/jnigen/generics/MyStack;"); + + /// 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(jniAccessors.callStaticMethodWithArgs( + _classRef, + _id_fromArrayOfArrayOfGrandParents, + jni.JniCallType.objectType, + [arr.reference]).object); + } + + static final _id_of = jniAccessors.getStaticMethodIDOf( + _classRef, r"of", r"()Lcom/github/dart_lang/jnigen/generics/MyStack;"); + + /// 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(jniAccessors.callStaticMethodWithArgs( + _classRef, _id_of, jni.JniCallType.objectType, []).object); + } + + static final _id_of1 = jniAccessors.getStaticMethodIDOf(_classRef, r"of", + r"(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;"); + + /// 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(jniAccessors.callStaticMethodWithArgs( + _classRef, + _id_of1, + jni.JniCallType.objectType, + [obj.reference]).object); + } + + static final _id_of2 = jniAccessors.getStaticMethodIDOf(_classRef, r"of", + r"(Ljava/lang/Object;Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/MyStack;"); + + /// 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(jniAccessors.callStaticMethodWithArgs( + _classRef, + _id_of2, + jni.JniCallType.objectType, + [obj.reference, obj2.reference]).object); + } + + static final _id_push = + jniAccessors.getMethodIDOf(_classRef, r"push", r"(Ljava/lang/Object;)V"); + + /// from: public void push(T item) + void push( + $T item, + ) { + return jniAccessors.callMethodWithArgs(reference, _id_push, + jni.JniCallType.voidType, [item.reference]).check(); + } + + static final _id_pop = + jniAccessors.getMethodIDOf(_classRef, r"pop", r"()Ljava/lang/Object;"); + + /// from: public T pop() + /// The returned object must be deleted after use, by calling the `delete` method. + $T pop() { + return T.fromRef(jniAccessors.callMethodWithArgs( + reference, _id_pop, jni.JniCallType.objectType, []).object); + } + + static final _id_size = + jniAccessors.getMethodIDOf(_classRef, r"size", r"()I"); + + /// from: public int size() + int size() { + return jniAccessors.callMethodWithArgs( + reference, _id_size, jni.JniCallType.intType, []).integer; + } +} + +class $MyStackType<$T extends jni.JObject> extends jni.JObjType<MyStack<$T>> { + final jni.JObjType<$T> T; + + const $MyStackType( + 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); + + @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> { + @override + late final jni.JObjType $type = type(V); + + final jni.JObjType<$V> V; + + StringKeyedMap.fromRef( + this.V, + jni.JObjectPtr ref, + ) : super.fromRef(const jni.JStringType(), V, ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/StringKeyedMap"); + + /// The type which includes information such as the signature of this class. + static $StringKeyedMapType<$V> type<$V extends jni.JObject>( + jni.JObjType<$V> V, + ) { + return $StringKeyedMapType( + V, + ); + } + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory StringKeyedMap({ + required jni.JObjType<$V> V, + }) { + return StringKeyedMap.fromRef( + V, jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $StringKeyedMapType<$V extends jni.JObject> + extends jni.JObjType<StringKeyedMap<$V>> { + final jni.JObjType<$V> V; + + const $StringKeyedMapType( + this.V, + ); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/generics/StringKeyedMap;"; + + @override + 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); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/StringMap"); + + /// The type which includes information such as the signature of this class. + static const type = $StringMapType(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory StringMap() { + return StringMap.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_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> { + @override + late final jni.JObjType $type = type; + + StringStack.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(const jni.JStringType(), ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/StringStack"); + + /// The type which includes information such as the signature of this class. + static const type = $StringStackType(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory StringStack() { + return StringStack.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $StringStackType extends jni.JObjType<StringStack> { + const $StringStackType(); + + @override + String get signature => r"Lcom/github/dart_lang/jnigen/generics/StringStack;"; + + @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> { + @override + late final jni.JObjType $type = type(K); + + final jni.JObjType<$K> K; + + StringValuedMap.fromRef( + this.K, + jni.JObjectPtr ref, + ) : super.fromRef(K, const jni.JStringType(), ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/generics/StringValuedMap"); + + /// The type which includes information such as the signature of this class. + static $StringValuedMapType<$K> type<$K extends jni.JObject>( + jni.JObjType<$K> K, + ) { + return $StringValuedMapType( + K, + ); + } + + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory StringValuedMap({ + required jni.JObjType<$K> K, + }) { + return StringValuedMap.fromRef( + K, jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $StringValuedMapType<$K extends jni.JObject> + extends jni.JObjType<StringValuedMap<$K>> { + final jni.JObjType<$K> K; + + const $StringValuedMapType( + this.K, + ); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/generics/StringValuedMap;"; + + @override + 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 { + @override + late final jni.JObjType $type = type; + + JsonSerializable_Case.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors.getClassOf( + r"com/github/dart_lang/jnigen/annotations/JsonSerializable$Case"); + + /// The type which includes information such as the signature of this class. + static const type = $JsonSerializable_CaseType(); + static final _id_values = jniAccessors.getStaticMethodIDOf( + _classRef, + r"values", + r"()[Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;"); + + /// 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() { + return const jni.JArrayType($JsonSerializable_CaseType()).fromRef( + jniAccessors.callStaticMethodWithArgs( + _classRef, _id_values, jni.JniCallType.objectType, []).object); + } + + static final _id_valueOf = jniAccessors.getStaticMethodIDOf( + _classRef, + r"valueOf", + r"(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;"); + + /// 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, + ) { + return const $JsonSerializable_CaseType().fromRef(jniAccessors + .callStaticMethodWithArgs(_classRef, _id_valueOf, + jni.JniCallType.objectType, [name.reference]).object); + } +} + +class $JsonSerializable_CaseType extends jni.JObjType<JsonSerializable_Case> { + const $JsonSerializable_CaseType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;"; + + @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 { + @override + late final jni.JObjType $type = type; + + MyDataClass.fromRef( + jni.JObjectPtr ref, + ) : super.fromRef(ref); + + static final _classRef = jniAccessors + .getClassOf(r"com/github/dart_lang/jnigen/annotations/MyDataClass"); + + /// The type which includes information such as the signature of this class. + static const type = $MyDataClassType(); + static final _id_ctor = + jniAccessors.getMethodIDOf(_classRef, r"<init>", r"()V"); + + /// from: public void <init>() + /// The returned object must be deleted after use, by calling the `delete` method. + factory MyDataClass() { + return MyDataClass.fromRef( + jniAccessors.newObjectWithArgs(_classRef, _id_ctor, []).object); + } +} + +class $MyDataClassType extends jni.JObjType<MyDataClass> { + const $MyDataClassType(); + + @override + String get signature => + r"Lcom/github/dart_lang/jnigen/annotations/MyDataClass;"; + + @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/generate.dart b/pkgs/jnigen/test/simple_package_test/generate.dart index 962fe17..18c38e0 100644 --- a/pkgs/jnigen/test/simple_package_test/generate.dart +++ b/pkgs/jnigen/test/simple_package_test/generate.dart
@@ -45,8 +45,11 @@ Config getConfig([BindingsType bindingsType = BindingsType.cBased]) { compileJavaSources(javaPath, javaFiles); - final cWrapperDir = Uri.directory(join(testRoot, "src")); - final dartWrappersRoot = Uri.directory(join(testRoot, "lib")); + final typeDir = bindingsType.getConfigString(); + final cWrapperDir = Uri.directory(join(testRoot, typeDir, "c_bindings")); + final dartWrappersRoot = Uri.directory( + join(testRoot, typeDir, "dart_bindings"), + ); final config = Config( sourcePath: [Uri.directory(javaPath)], classPath: [Uri.directory(javaPath)], @@ -73,4 +76,7 @@ return config; } -void main() async => await generateJniBindings(getConfig()); +void main() async { + await generateJniBindings(getConfig(BindingsType.cBased)); + await generateJniBindings(getConfig(BindingsType.dartOnly)); +}
diff --git a/pkgs/jnigen/test/simple_package_test/generated_files_test.dart b/pkgs/jnigen/test/simple_package_test/generated_files_test.dart index 084afe0..0f595d2 100644 --- a/pkgs/jnigen/test/simple_package_test/generated_files_test.dart +++ b/pkgs/jnigen/test/simple_package_test/generated_files_test.dart
@@ -4,7 +4,6 @@ import 'package:jnigen/jnigen.dart'; import 'package:test/test.dart'; -import 'package:path/path.dart' hide equals; import 'generate.dart'; import '../test_util/test_util.dart'; @@ -12,13 +11,12 @@ void main() async { await checkLocallyBuiltDependencies(); - test("Generate and compare bindings for simple_package", () async { - await generateAndCompareBindings( - getConfig(), - join(testRoot, "lib", "simple_package.dart"), - join(testRoot, "src"), - ); - }); // test if generated file == expected file + generateAndCompareBothModes( + 'Generate and compare bindings for simple_package java files', + getConfig(BindingsType.cBased), + getConfig(BindingsType.dartOnly), + ); + test("Generate and analyze bindings for simple_package - pure dart", () async { await generateAndAnalyzeBindings(
diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Example.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Example.java index abd87c4..edb2748 100644 --- a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Example.java +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Example.java
@@ -4,36 +4,151 @@ package com.github.dart_lang.jnigen.simple_package; -import java.util.Arrays; +import java.util.*; public class Example { + // static fields - primitive & string public static final int ON = 1; public static final int OFF = 0; + public static final double PI = 3.14159; + public static final char SEMICOLON = ';'; + public static final String SEMICOLON_STRING = ";"; - public static Aux aux; - public static int num; + private static int amount = 500; + private static double pi = 3.14159; + private static char asterisk = '*'; + private static String name = "Ragnar Lothbrok"; - private int internal = 0; + // Static fields - object + private static Nested nested = new Nested(true); - public Example() {} - - public Example(int internal) { - this.internal = internal; + // static methods + public static int getAmount() { + return amount; } - static { - aux = new Aux(true); - num = 121; + public static double getPi() { + return pi; + } + + public static char getAsterisk() { + return asterisk; + } + + public static String getName() { + return name; + } + + public static Nested getNestedInstance() { + return nested; + } + + // void functions with 1 parameter + public static void setAmount(int newAmount) { + amount = newAmount; + } + + public static void setName(String newName) { + name = newName; + } + + public static void setNestedInstance(Nested newNested) { + nested = newNested; + } + + // void functions with many parameters + public static int max4(int a, int b, int c, int d) { + return Integer.max(Integer.max(a, b), Integer.max(c, d)); + } + + public static int max8(int a, int b, int c, int d, int e, int f, int g, int h) { + return Integer.max(max4(a, b, c, d), max4(e, f, g, h)); + } + + // Instance fields - primitive and string + private int number = 0; + private boolean isUp = false; + private String codename = "achilles"; + + // Instance fields - object + private Random random = new Random(); + + // Instance methods + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + public boolean getIsUp() { + return isUp; + } + + public void setUp(boolean isUp) { + this.isUp = isUp; + } + + public String getCodename() { + return codename; + } + + public void setCodename(String codename) { + this.codename = codename; + } + + public Random getRandom() { + return random; + } + + public void setRandom(Random random) { + this.random = random; + } + + public long getRandomLong() { + return random.nextLong(); + } + + public long add4Longs(long a, long b, long c, long d) { + return a + b + c + d; + } + + public long add8Longs(long a, long b, long c, long d, long e, long f, long g, long h) { + return a + b + c + d + e + f + g + h; + } + + public String getRandomNumericString(Random random) { + return String.format( + "%d%d%d%d", random.nextInt(10), random.nextInt(10), random.nextInt(10), random.nextInt(10)); + } + + public Example() { + this(0); + } + + public Example(int number) { + this(number, true); + } + + public Example(int number, boolean isUp) { + this(number, isUp, "achilles"); + } + + public Example(int number, boolean isUp, String codename) { + this.number = number; + this.isUp = isUp; + this.codename = codename; + } + + public Example(int a, int b, int c, int d, int e, int f, int g, int h) { + this(a + b + c + d + e + f + g + h); } public int whichExample() { return 0; } - public static Aux getAux() { - return aux; - } - public static int addInts(int a, int b) { return a + b; } @@ -50,30 +165,14 @@ return this; } - public int getNum() { - return num; - } - - public void setNum(int num) { - this.num = num; - } - - public int getInternal() { - return internal; - } - - public void setInternal(int internal) { - this.internal = internal; - } - public static void throwException() { throw new RuntimeException("Hello"); } - public static class Aux { - public boolean value; + public static class Nested { + private boolean value; - public Aux(boolean value) { + public Nested(boolean value) { this.value = value; }
diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Exceptions.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Exceptions.java new file mode 100644 index 0000000..2949089 --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Exceptions.java
@@ -0,0 +1,81 @@ +// 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.simple_package; + +import java.io.*; +import java.util.*; + +public class Exceptions { + public Exceptions() {} + // constructor throwing exception + public Exceptions(float x) { + throw new IllegalArgumentException("Float is not a serious type"); + } + + public Exceptions(int a, int b, int c, int d, int e, int f) { + throw new IllegalArgumentException("Too many arguments, but none in your favor"); + } + + public static Object staticObjectMethod() { + throw new RuntimeException(":-/"); + } + + public static int staticIntMethod() { + throw new RuntimeException("\\-:"); + } + + public static Object[] staticObjectArrayMethod() { + throw new RuntimeException(":-/[]"); + } + + public static int[] staticIntArrayMethod() { + throw new RuntimeException("\\-:[]"); + } + + public Object objectMethod() { + throw new RuntimeException("['--']"); + } + + public int intMethod() { + throw new RuntimeException("[-_-]"); + } + + public Object[] objectArrayMethod() { + throw new RuntimeException(":-/[]"); + } + + public int[] intArrayMethod() { + throw new RuntimeException("\\-:[]"); + } + + public int throwNullPointerException() { + Random random = null; + return random.nextInt(); + } + + public InputStream throwFileNotFoundException() throws IOException { + return new FileInputStream("/dev/nulll/59613/287"); + } + + public FileInputStream throwClassCastException() { + InputStream x = System.in; + return (FileInputStream) x; + } + + public int throwArrayIndexException() { + int[] nums = {1, 2}; + return nums[4]; + } + + public int throwArithmeticException() { + int x = 10; + int y = 100 - 100 + 1 - 1; + return x / y; + } + + public static void throwLoremIpsum() { + throw new RuntimeException("Lorem Ipsum"); + } +}
diff --git a/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Fields.java b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Fields.java new file mode 100644 index 0000000..face69c --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Fields.java
@@ -0,0 +1,34 @@ +// Copyright (c) 2022, 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.simple_package; + +import java.util.*; + +public class Fields { + // static fields - non-final primitive & string + public static int amount = 500; + public static double pi = 3.14159; + public static char asterisk = '*'; + public static String name = "Earl Haraldson"; + + // Static fields - object + public Integer i = 100; + + // Instance fields - primitive and string + public long trillion = 1024L * 1024L * 1024L * 1024L; + public boolean isAchillesDead = false; + public String bestFighterInGreece = "Achilles"; + + // Instance fields - object + public Random random = new Random(); + + // Static and instance fields in nested class. + public static class Nested { + public long hundred = 100L; + public static String BEST_GOD = "Pallas Athena"; + } + + public static char euroSymbol = '\u20ac'; +}
diff --git a/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart b/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart new file mode 100644 index 0000000..41747e0 --- /dev/null +++ b/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart
@@ -0,0 +1,559 @@ +// Copyright (c) 2022, 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:io'; + +import 'package:test/test.dart'; +import 'package:jni/jni.dart'; + +import '../test_util/callback_types.dart'; + +import 'c_based/dart_bindings/simple_package.dart'; + +const pi = 3.14159; +const fpDelta = 0.001; +const trillion = 1024 * 1024 * 1024 * 1024; + +void registerTests(String groupName, TestRunnerCallback test) { + group(groupName, () { + test('static final fields - int', () { + expect(Example.ON, equals(1)); + expect(Example.OFF, equals(0)); + expect(Example.PI, closeTo(pi, fpDelta)); + expect(Example.SEMICOLON, equals(';')); + expect(Example.SEMICOLON_STRING, equals(';')); + }); + + test('Static methods - primitive', () { + // same test can be run at a replicated (dart-only) test, check for both + // possible values. + expect(Example.getAmount(), isIn([1012, 500])); + Example.setAmount(1012); + expect(Example.getAmount(), equals(1012)); + expect(Example.getAsterisk(), equals('*'.codeUnitAt(0))); + expect(C2.CONSTANT, equals(12)); + }); + + test('Static fields & methods - string', () { + expect( + Example.getName().toDartString(deleteOriginal: true), + isIn(["Ragnar Lothbrok", "Theseus"]), + ); + Example.setName("Theseus".toJString()); + expect( + Example.getName().toDartString(deleteOriginal: true), + equals("Theseus"), + ); + }); + + test('Static fields and methods - Object', () { + final nested = Example.getNestedInstance(); + expect(nested.getValue(), isIn([true, false])); + nested.setValue(false); + expect(nested.getValue(), isFalse); + }); + + test('static methods with several arguments', () { + expect(Example.addInts(10, 15), equals(25)); + expect(Example.max4(-1, 15, 30, 12), equals(30)); + expect(Example.max8(1, 4, 8, 2, 4, 10, 8, 6), equals(10)); + }); + + test('Instance methods (getters & setters)', () { + final e = Example(); + expect(e.getNumber(), equals(0)); + expect(e.getIsUp(), true); + expect(e.getCodename().toDartString(), equals("achilles")); + e.setNumber(1); + e.setUp(false); + e.setCodename("spartan".toJString()); + expect(e.getIsUp(), false); + expect(e.getNumber(), 1); + expect(e.getCodename().toDartString(), equals("spartan")); + e.delete(); + }); + + test('Instance methods with several arguments', () { + final e = Example(); + expect(e.add4Longs(1, 2, 3, 4), equals(10)); + expect(e.add8Longs(1, 1, 2, 2, 3, 3, 12, 24), equals(48)); + expect( + e.add4Longs(trillion, trillion, trillion, trillion), + equals(4 * trillion), + ); + expect( + e.add8Longs(trillion, -trillion, trillion, -trillion, trillion, + -trillion, -trillion, -trillion), + equals(2 * -trillion), + ); + e.delete(); + }); + + test('Misc. instance methods', () { + final e = Example(); + final rand = e.getRandom(); + expect(rand.isNull, isFalse); + final _ = e.getRandomLong(); + final id = + e.getRandomNumericString(rand).toDartString(deleteOriginal: true); + expect(int.parse(id), lessThan(10000)); + e.setNumber(145); + expect( + e.getSelf().getSelf().getSelf().getSelf().getNumber(), + equals(145), + ); + e.delete(); + }); + + test('Constructors', () { + final e0 = Example(); + expect(e0.getNumber(), 0); + expect(e0.getIsUp(), true); + expect(e0.getCodename().toDartString(), equals('achilles')); + final e1 = Example.ctor1(111); + expect(e1.getNumber(), equals(111)); + expect(e1.getIsUp(), true); + expect(e1.getCodename().toDartString(), "achilles"); + final e2 = Example.ctor2(122, false); + expect(e2.getNumber(), equals(122)); + expect(e2.getIsUp(), false); + expect(e2.getCodename().toDartString(), "achilles"); + final e3 = Example.ctor3(133, false, "spartan".toJString()); + expect(e3.getNumber(), equals(133)); + expect(e3.getIsUp(), false); + expect(e3.getCodename().toDartString(), "spartan"); + }); + + test('Static (non-final) fields', () { + // Other replica test may already have modified this, so assert both + // values. + expect(Fields.amount, isIn([500, 101])); + Fields.amount = 101; + expect(Fields.amount, equals(101)); + + expect(Fields.asterisk, equals('*'.codeUnitAt(0))); + + expect( + Fields.name.toDartString(), + isIn(["Earl Haraldson", "Ragnar Lothbrok"]), + ); + + Fields.name = "Ragnar Lothbrok".toJString(); + expect(Fields.name.toDartString(), equals("Ragnar Lothbrok")); + + expect(Fields.pi, closeTo(pi, fpDelta)); + }); + + test('Instance fields', () { + final f = Fields(); + expect(f.trillion, equals(trillion)); + + expect(f.isAchillesDead, isFalse); + expect(f.bestFighterInGreece.toDartString(), equals("Achilles")); + // "For your glory walks hand-in-hand with your doom." - Thetis. + f.isAchillesDead = true; + // I don't know much Greek mythology. But Troy was released in 2004, + // and 300 was released in 2006, so it's Leonidas I. + f.bestFighterInGreece = "Leonidas I".toJString(); + expect(f.isAchillesDead, isTrue); + expect(f.bestFighterInGreece.toDartString(), "Leonidas I"); + }); + + test('Fields from nested class', () { + expect(Fields_Nested().hundred, equals(100)); + // Hector of Troy may disagree. + expect(Fields_Nested.BEST_GOD.toDartString(), equals('Pallas Athena')); + }); + + test('static methods arrays', () { + final array = Example.getArr(); + expect(array[0], 1); + expect(array[1], 2); + expect(array[2], 3); + expect(Example.addAll(array), 6); + array[0] = 4; + expect(Example.addAll(array), 9); + }); + + test('array of the class', () { + final ex1 = Example(); + final ex2 = Example(); + ex1.setNumber(1); + ex2.setNumber(2); + final array = JArray(Example.type, 2); + array[0] = ex1; + array[1] = ex2; + expect(array[0].getNumber(), 1); + expect(array[1].getNumber(), 2); + array.delete(); + ex1.delete(); + ex2.delete(); + }); + + test("Check bindings for same-named classes", () { + expect(Example().whichExample(), 0); + expect(Example1().whichExample(), 1); + }); + + test('Unicode char', () { + expect(Fields.euroSymbol, equals('\u20AC'.codeUnitAt(0))); + }); + + group('exception tests', () { + void throwsException(void Function() f) { + expect(f, throwsA(isA<JniException>())); + } + + test('Example throw exception', () { + throwsException(Example.throwException); + }); + + test('Exception from method returning Object', () { + throwsException(Exceptions.staticObjectMethod); + throwsException(Exceptions.staticObjectArrayMethod); + final x = Exceptions(); + throwsException(x.objectMethod); + throwsException(x.objectArrayMethod); + }); + + test('Exception from method returning int', () { + throwsException(Exceptions.staticIntMethod); + throwsException(Exceptions.staticIntArrayMethod); + final x = Exceptions(); + throwsException(x.intMethod); + throwsException(x.intArrayMethod); + }); + + test('Exception from constructor', () { + throwsException(() => Exceptions.ctor1(6.8)); + throwsException(() => Exceptions.ctor2(1, 2, 3, 4, 5, 6)); + }); + + test('Exception contains error message & stack trace', () { + try { + Exceptions.throwLoremIpsum(); + } on JniException catch (e) { + expect(e.message, stringContainsInOrder(["Lorem Ipsum"])); + expect( + e.toString(), + stringContainsInOrder(["Lorem Ipsum", "throwLoremIpsum"]), + ); + return; + } + throw AssertionError("No exception was thrown"); + }); + }); + + 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(T: JString.type)..deletedIn(arena); + stack.push('Hello'.toJString()..deletedIn(arena)); + stack.push('World'.toJString()..deletedIn(arena)); + expect(stack.pop().toDartString(deleteOriginal: true), 'World'); + expect(stack.pop().toDartString(deleteOriginal: true), 'Hello'); + }); + }); + test('MyMap<K, V>', () { + using((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); + map.put('World'.toJString()..deletedIn(arena), worldExample); + expect( + (map.get0('Hello'.toJString()..deletedIn(arena))..deletedIn(arena)) + .getNumber(), + 1, + ); + expect( + (map.get0('World'.toJString()..deletedIn(arena))..deletedIn(arena)) + .getNumber(), + 2, + ); + expect( + ((map.entryStack()..deletedIn(arena)).pop()..deletedIn(arena)) + .key + .castTo(JString.type, deleteOriginal: true) + .toDartString(deleteOriginal: true), + anyOf('Hello', 'World'), + ); + }); + }); + group('classes extending generics', () { + test('StringStack', () { + using((arena) { + final stringStack = StringStack()..deletedIn(arena); + stringStack.push('Hello'.toJString()..deletedIn(arena)); + expect( + stringStack.pop().toDartString(deleteOriginal: true), 'Hello'); + }); + }); + test('StringKeyedMap', () { + using((arena) { + final map = StringKeyedMap(V: Example.type)..deletedIn(arena); + final example = Example()..deletedIn(arena); + map.put('Hello'.toJString()..deletedIn(arena), example); + expect( + (map.get0('Hello'.toJString()..deletedIn(arena)) + ..deletedIn(arena)) + .getNumber(), + 0, + ); + }); + }); + test('StringValuedMap', () { + using((arena) { + final map = StringValuedMap(K: Example.type)..deletedIn(arena); + final example = Example()..deletedIn(arena); + map.put(example, 'Hello'.toJString()..deletedIn(arena)); + expect( + map.get0(example).toDartString(deleteOriginal: true), + 'Hello', + ); + }); + }); + 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(T: JString.type, "!".toJString()..deletedIn(arena)) + ..deletedIn(arena); + expect( + grandParent.value.toDartString(deleteOriginal: true), + "!", + ); + + final strStaticParent = GrandParent.stringStaticParent() + ..deletedIn(arena); + expect( + strStaticParent.value.toDartString(deleteOriginal: true), + "Hello", + ); + + final exampleStaticParent = GrandParent.varStaticParent( + S: Example.type, Example()..deletedIn(arena)) + ..deletedIn(arena); + expect( + (exampleStaticParent.value..deletedIn(arena)).getNumber(), + 0, + ); + + final strParent = grandParent.stringParent()..deletedIn(arena); + expect( + strParent.parentValue + .castTo(JString.type, deleteOriginal: true) + .toDartString(deleteOriginal: true), + "!", + ); + expect( + strParent.value.toDartString(deleteOriginal: true), + "Hello", + ); + + final exampleParent = grandParent.varParent( + S: Example.type, Example()..deletedIn(arena)) + ..deletedIn(arena); + expect( + exampleParent.parentValue + .castTo(JString.type, deleteOriginal: true) + .toDartString(deleteOriginal: true), + "!", + ); + expect( + (exampleParent.value..deletedIn(arena)).getNumber(), + 0, + ); + // TODO(#139): test constructing Child, currently does not work due + // to a problem with C-bindings. + }); + }); + }); + 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('$groupName (load tests)', () { + const k4 = 4 * 1024; // This is a round number, unlike say 4000 + const k256 = 256 * 1024; + test('create large number of JNI references without deleting', () { + for (int i = 0; i < k4; i++) { + final e = Example.ctor1(i); + expect(e.getNumber(), equals(i)); + } + }); + test('Create many JNI refs with scoped deletion', () { + for (int i = 0; i < k256; i++) { + using((arena) { + final e = Example.ctor1(i)..deletedIn(arena); + expect(e.getNumber(), equals(i)); + }); + } + }); + test('Create many JNI refs with scoped deletion, in batches', () { + for (int i = 0; i < 256; i++) { + using((arena) { + for (int i = 0; i < 1024; i++) { + final e = Example.ctor1(i)..deletedIn(arena); + expect(e.getNumber(), equals(i)); + } + }); + } + }); + test('Create large number of JNI refs with manual delete', () { + for (int i = 0; i < k256; i++) { + final e = Example.ctor1(i); + expect(e.getNumber(), equals(i)); + e.delete(); + } + }); + test('Method returning primitive type does not create references', () { + using((arena) { + final e = Example.ctor1(64)..deletedIn(arena); + for (int i = 0; i < k256; i++) { + expect(e.getNumber(), equals(64)); + } + }); + }); + test('Class references are cached', () { + final asterisk = '*'.codeUnitAt(0); + for (int i = 0; i < k256; i++) { + expect(Fields.asterisk, equals(asterisk)); + } + }); + void testPassageOfTime(int n) { + test('Refs are not inadvertently deleted after $n seconds', () { + final f = Fields(); + expect(f.trillion, equals(trillion)); + sleep(Duration(seconds: n)); + expect(f.trillion, equals(trillion)); + }); + } + + if (!Platform.isAndroid) { + testPassageOfTime(1); + testPassageOfTime(4); + } + }); +}
diff --git a/pkgs/jnigen/test/simple_package_test/src/dartjni.h b/pkgs/jnigen/test/simple_package_test/src/dartjni.h deleted file mode 100644 index 21cef20..0000000 --- a/pkgs/jnigen/test/simple_package_test/src/dartjni.h +++ /dev/null
@@ -1,367 +0,0 @@ -// Copyright (c) 2022, 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. - -#pragma once - -// Note: include appropriate system jni.h as found by CMake, not third_party/jni.h. -#include <jni.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> - -#if _WIN32 -#include <windows.h> -#else -#include <pthread.h> -#include <unistd.h> -#endif - -#if _WIN32 -#define FFI_PLUGIN_EXPORT __declspec(dllexport) -#else -#define FFI_PLUGIN_EXPORT -#endif - -#if defined _WIN32 -#define thread_local __declspec(thread) -#else -#define thread_local __thread -#endif - -#ifdef __ANDROID__ -#include <android/log.h> -#endif - -#ifdef __ANDROID__ -#define __ENVP_CAST (JNIEnv**) -#else -#define __ENVP_CAST (void**) -#endif - -/// Locking functions for windows and pthread. - -#if defined _WIN32 -#include <windows.h> - -typedef CRITICAL_SECTION MutexLock; - -static inline void init_lock(MutexLock* lock) { - InitializeCriticalSection(lock); -} - -static inline void acquire_lock(MutexLock* lock) { - EnterCriticalSection(lock); -} - -static inline void release_lock(MutexLock* lock) { - LeaveCriticalSection(lock); -} - -static inline void _destroyLock(MutexLock* lock) { - DeleteCriticalSection(lock); -} - -#elif defined __DARWIN__ || defined __LINUX__ || defined __ANDROID__ || \ - defined __GNUC__ -#include <pthread.h> - -typedef pthread_mutex_t MutexLock; - -static inline void init_lock(MutexLock* lock) { - pthread_mutex_init(lock, NULL); -} - -static inline void acquire_lock(MutexLock* lock) { - pthread_mutex_lock(lock); -} - -static inline void release_lock(MutexLock* lock) { - pthread_mutex_unlock(lock); -} - -static inline void _destroyLock(MutexLock* lock) { - pthread_mutex_destroy(lock); -} - -#else - -#error "No locking support; Possibly unsupported platform" - -#endif - -typedef struct JniLocks { - MutexLock classLoadingLock; - MutexLock methodLoadingLock; - MutexLock fieldLoadingLock; -} JniLocks; - -/// Represents the error when dart-jni layer has already spawned singleton VM. -#define DART_JNI_SINGLETON_EXISTS (-99); - -/// Stores the global state of the JNI. -typedef struct JniContext { - JavaVM* jvm; - jobject classLoader; - jmethodID loadClassMethod; - jobject currentActivity; - jobject appContext; - JniLocks locks; -} JniContext; - -// jniEnv for this thread, used by inline functions in this header, -// therefore declared as extern. -extern thread_local JNIEnv* jniEnv; - -extern JniContext* jni; - -/// Types used by JNI API to distinguish between primitive types. -enum JniType { - booleanType = 0, - byteType = 1, - shortType = 2, - charType = 3, - intType = 4, - longType = 5, - floatType = 6, - doubleType = 7, - objectType = 8, - voidType = 9, -}; - -/// Result type for use by JNI. -/// -/// If [exception] is null, it means the result is valid. -/// It's assumed that the caller knows the expected type in [result]. -typedef struct JniResult { - jvalue value; - jthrowable exception; -} JniResult; - -/// Similar to [JniResult] but for class lookups. -typedef struct JniClassLookupResult { - jclass value; - jthrowable exception; -} JniClassLookupResult; - -/// Similar to [JniResult] but for method/field ID lookups. -typedef struct JniPointerResult { - const void* value; - jthrowable exception; -} JniPointerResult; - -/// JniExceptionDetails holds 2 jstring objects, one is the result of -/// calling `toString` on exception object, other is stack trace; -typedef struct JniExceptionDetails { - jstring message; - jstring stacktrace; -} JniExceptionDetails; - -/// This struct contains functions which wrap method call / field access conveniently along with -/// exception checking. -/// -/// Flutter embedding checks for pending JNI exceptions before an FFI transition, which requires us -/// to check for and clear the exception before returning to dart code, which requires these functions -/// to return result types. -typedef struct JniAccessorsStruct { - JniClassLookupResult (*getClass)(char* internalName); - JniPointerResult (*getFieldID)(jclass cls, char* fieldName, char* signature); - JniPointerResult (*getStaticFieldID)(jclass cls, - char* fieldName, - char* signature); - JniPointerResult (*getMethodID)(jclass cls, - char* methodName, - char* signature); - JniPointerResult (*getStaticMethodID)(jclass cls, - char* methodName, - char* signature); - JniResult (*newObject)(jclass cls, jmethodID ctor, jvalue* args); - JniPointerResult (*newPrimitiveArray)(jsize length, int type); - JniPointerResult (*newObjectArray)(jsize length, - jclass elementClass, - jobject initialElement); - JniResult (*getArrayElement)(jarray array, int index, int type); - JniResult (*callMethod)(jobject obj, - jmethodID methodID, - int callType, - jvalue* args); - JniResult (*callStaticMethod)(jclass cls, - jmethodID methodID, - int callType, - jvalue* args); - JniResult (*getField)(jobject obj, jfieldID fieldID, int callType); - JniResult (*getStaticField)(jclass cls, jfieldID fieldID, int callType); - JniExceptionDetails (*getExceptionDetails)(jthrowable exception); -} JniAccessorsStruct; - -FFI_PLUGIN_EXPORT JniAccessorsStruct* GetAccessors(); - -FFI_PLUGIN_EXPORT JavaVM* GetJavaVM(void); - -FFI_PLUGIN_EXPORT JNIEnv* GetJniEnv(void); - -/// Spawn a JVM with given arguments. -/// -/// Returns JNI_OK on success, and one of the documented JNI error codes on -/// failure. It returns DART_JNI_SINGLETON_EXISTS if an attempt to spawn multiple -/// JVMs is made, even if the underlying API potentially supports multiple VMs. -FFI_PLUGIN_EXPORT int SpawnJvm(JavaVMInitArgs* args); - -/// Load class through platform-specific mechanism. -/// -/// Currently uses application classloader on android, -/// and JNIEnv->FindClass on other platforms. -FFI_PLUGIN_EXPORT jclass FindClass(const char* name); - -/// Returns Application classLoader (on Android), -/// which can be used to load application and platform classes. -/// -/// On other platforms, NULL is returned. -FFI_PLUGIN_EXPORT jobject GetClassLoader(void); - -/// Returns application context on Android. -/// -/// On other platforms, NULL is returned. -FFI_PLUGIN_EXPORT jobject GetApplicationContext(void); - -/// Returns current activity of the app on Android. -FFI_PLUGIN_EXPORT jobject GetCurrentActivity(void); - -static inline void attach_thread() { - if (jniEnv == NULL) { - (*jni->jvm)->AttachCurrentThread(jni->jvm, __ENVP_CAST & jniEnv, NULL); - } -} - -/// Load class into [cls] using platform specific mechanism -static inline void load_class_platform(jclass* cls, const char* name) { -#ifdef __ANDROID__ - jstring className = (*jniEnv)->NewStringUTF(jniEnv, name); - *cls = (*jniEnv)->CallObjectMethod(jniEnv, jni->classLoader, - jni->loadClassMethod, className); - (*jniEnv)->DeleteLocalRef(jniEnv, className); -#else - *cls = (*jniEnv)->FindClass(jniEnv, name); -#endif -} - -static inline void load_class_local_ref(jclass* cls, const char* name) { - if (*cls == NULL) { - acquire_lock(&jni->locks.classLoadingLock); - if (*cls == NULL) { - load_class_platform(cls, name); - } - release_lock(&jni->locks.classLoadingLock); - } -} - -static inline void load_class_global_ref(jclass* cls, const char* name) { - if (*cls == NULL) { - jclass tmp = NULL; - acquire_lock(&jni->locks.classLoadingLock); - if (*cls == NULL) { - load_class_platform(&tmp, name); - *cls = (*jniEnv)->NewGlobalRef(jniEnv, tmp); - (*jniEnv)->DeleteLocalRef(jniEnv, tmp); - } - release_lock(&jni->locks.classLoadingLock); - } -} - -static inline void load_method(jclass cls, - jmethodID* res, - const char* name, - const char* sig) { - if (*res == NULL) { - acquire_lock(&jni->locks.methodLoadingLock); - if (*res == NULL) { - *res = (*jniEnv)->GetMethodID(jniEnv, cls, name, sig); - } - release_lock(&jni->locks.methodLoadingLock); - } -} - -static inline void load_static_method(jclass cls, - jmethodID* res, - const char* name, - const char* sig) { - if (*res == NULL) { - acquire_lock(&jni->locks.methodLoadingLock); - if (*res == NULL) { - *res = (*jniEnv)->GetStaticMethodID(jniEnv, cls, name, sig); - } - release_lock(&jni->locks.methodLoadingLock); - } -} - -static inline void load_field(jclass cls, - jfieldID* res, - const char* name, - const char* sig) { - if (*res == NULL) { - acquire_lock(&jni->locks.fieldLoadingLock); - if (*res == NULL) { - *res = (*jniEnv)->GetFieldID(jniEnv, cls, name, sig); - } - release_lock(&jni->locks.fieldLoadingLock); - } -} - -static inline void load_static_field(jclass cls, - jfieldID* res, - const char* name, - const char* sig) { - if (*res == NULL) { - acquire_lock(&jni->locks.fieldLoadingLock); - if (*res == NULL) { - *res = (*jniEnv)->GetStaticFieldID(jniEnv, cls, name, sig); - } - release_lock(&jni->locks.fieldLoadingLock); - } -} - -static inline jobject to_global_ref(jobject ref) { - jobject g = (*jniEnv)->NewGlobalRef(jniEnv, ref); - (*jniEnv)->DeleteLocalRef(jniEnv, ref); - return g; -} - -// These functions are useful for C+Dart bindings, and not required for pure dart bindings. - -FFI_PLUGIN_EXPORT JniContext* GetJniContextPtr(); - -/// For use by jni_gen's generated code -/// don't use these. - -// these 2 fn ptr vars will be defined by generated code library -extern JniContext* (*context_getter)(void); -extern JNIEnv* (*env_getter)(void); - -// this function will be exported by generated code library -// it will set above 2 variables. -FFI_PLUGIN_EXPORT void setJniGetters(struct JniContext* (*cg)(void), - JNIEnv* (*eg)(void)); - -static inline void load_env() { - if (jniEnv == NULL) { - jni = context_getter(); - jniEnv = env_getter(); - } -} - -static inline jthrowable check_exception() { - jthrowable exception = (*jniEnv)->ExceptionOccurred(jniEnv); - if (exception != NULL) (*jniEnv)->ExceptionClear(jniEnv); - if (exception == NULL) return NULL; - return to_global_ref(exception); -} - -FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); - -JNIEXPORT void JNICALL -Java_com_github_dart_1lang_jni_PortContinuation__1resumeWith(JNIEnv* env, - jobject thiz, - jlong port, - jobject result); -FFI_PLUGIN_EXPORT -JniResult PortContinuation__ctor(int64_t j);
diff --git a/pkgs/jnigen/test/simple_package_test/src/simple_package.c b/pkgs/jnigen/test/simple_package_test/src/simple_package.c deleted file mode 100644 index be68002..0000000 --- a/pkgs/jnigen/test/simple_package_test/src/simple_package.c +++ /dev/null
@@ -1,1407 +0,0 @@ -// Copyright (c) 2022, 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. - -// Autogenerated by jnigen. DO NOT EDIT! - -#include <stdint.h> -#include "dartjni.h" -#include "jni.h" - -thread_local JNIEnv* jniEnv; -JniContext* jni; - -JniContext* (*context_getter)(void); -JNIEnv* (*env_getter)(void); - -void setJniGetters(JniContext* (*cg)(void), JNIEnv* (*eg)(void)) { - context_getter = cg; - env_getter = eg; -} - -// com.github.dart_lang.jnigen.simple_package.Example -jclass _c_Example = NULL; - -jmethodID _m_Example__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__ctor() { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__ctor, "<init>", "()V"); - if (_m_Example__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example__ctor1 = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__ctor1(int32_t internal) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__ctor1, "<init>", "(I)V"); - if (_m_Example__ctor1 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_Example, _m_Example__ctor1, internal); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example__whichExample = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__whichExample(jobject self_) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__whichExample, "whichExample", "()I"); - if (_m_Example__whichExample == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = - (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example__whichExample); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -jmethodID _m_Example__getAux = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__getAux() { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method( - _c_Example, &_m_Example__getAux, "getAux", - "()Lcom/github/dart_lang/jnigen/simple_package/Example$Aux;"); - if (_m_Example__getAux == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_Example, _m_Example__getAux); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example__addInts = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__addInts(int32_t a, int32_t b) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method(_c_Example, &_m_Example__addInts, "addInts", "(II)I"); - if (_m_Example__addInts == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = (*jniEnv)->CallStaticIntMethod(jniEnv, _c_Example, - _m_Example__addInts, a, b); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -jmethodID _m_Example__getArr = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__getArr() { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method(_c_Example, &_m_Example__getArr, "getArr", "()[I"); - if (_m_Example__getArr == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_Example, _m_Example__getArr); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example__addAll = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__addAll(jobject arr) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method(_c_Example, &_m_Example__addAll, "addAll", "([I)I"); - if (_m_Example__addAll == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = (*jniEnv)->CallStaticIntMethod(jniEnv, _c_Example, - _m_Example__addAll, arr); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -jmethodID _m_Example__getSelf = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__getSelf(jobject self_) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__getSelf, "getSelf", - "()Lcom/github/dart_lang/jnigen/simple_package/Example;"); - if (_m_Example__getSelf == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_Example__getSelf); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example__getNum = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__getNum(jobject self_) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__getNum, "getNum", "()I"); - if (_m_Example__getNum == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example__getNum); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -jmethodID _m_Example__setNum = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__setNum(jobject self_, int32_t num) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__setNum, "setNum", "(I)V"); - if (_m_Example__setNum == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example__setNum, num); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jmethodID _m_Example__getInternal = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__getInternal(jobject self_) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__getInternal, "getInternal", "()I"); - if (_m_Example__getInternal == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = - (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example__getInternal); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -jmethodID _m_Example__setInternal = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__setInternal(jobject self_, int32_t internal) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example, &_m_Example__setInternal, "setInternal", "(I)V"); - if (_m_Example__setInternal == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example__setInternal, internal); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jmethodID _m_Example__throwException = NULL; -FFI_PLUGIN_EXPORT -JniResult Example__throwException() { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method(_c_Example, &_m_Example__throwException, "throwException", - "()V"); - if (_m_Example__throwException == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - (*jniEnv)->CallStaticVoidMethod(jniEnv, _c_Example, - _m_Example__throwException); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_Example__aux = NULL; -FFI_PLUGIN_EXPORT -JniResult get_Example__aux() { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_field(_c_Example, &_f_Example__aux, "aux", - "Lcom/github/dart_lang/jnigen/simple_package/Example$Aux;"); - jobject _result = to_global_ref( - (*jniEnv)->GetStaticObjectField(jniEnv, _c_Example, _f_Example__aux)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_Example__aux(jobject value) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_field(_c_Example, &_f_Example__aux, "aux", - "Lcom/github/dart_lang/jnigen/simple_package/Example$Aux;"); - (*jniEnv)->SetStaticObjectField(jniEnv, _c_Example, _f_Example__aux, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_Example__num = NULL; -FFI_PLUGIN_EXPORT -JniResult get_Example__num() { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_field(_c_Example, &_f_Example__num, "num", "I"); - int32_t _result = - (*jniEnv)->GetStaticIntField(jniEnv, _c_Example, _f_Example__num); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_Example__num(int32_t value) { - load_env(); - load_class_global_ref(&_c_Example, - "com/github/dart_lang/jnigen/simple_package/Example"); - if (_c_Example == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_field(_c_Example, &_f_Example__num, "num", "I"); - (*jniEnv)->SetStaticIntField(jniEnv, _c_Example, _f_Example__num, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.simple_package.Example$Aux -jclass _c_Example_Aux = NULL; - -jmethodID _m_Example_Aux__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult Example_Aux__ctor(uint8_t value) { - load_env(); - load_class_global_ref( - &_c_Example_Aux, - "com/github/dart_lang/jnigen/simple_package/Example$Aux"); - if (_c_Example_Aux == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example_Aux, &_m_Example_Aux__ctor, "<init>", "(Z)V"); - if (_m_Example_Aux__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_Example_Aux, _m_Example_Aux__ctor, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example_Aux__getValue = NULL; -FFI_PLUGIN_EXPORT -JniResult Example_Aux__getValue(jobject self_) { - load_env(); - load_class_global_ref( - &_c_Example_Aux, - "com/github/dart_lang/jnigen/simple_package/Example$Aux"); - if (_c_Example_Aux == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example_Aux, &_m_Example_Aux__getValue, "getValue", "()Z"); - if (_m_Example_Aux__getValue == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - uint8_t _result = - (*jniEnv)->CallBooleanMethod(jniEnv, self_, _m_Example_Aux__getValue); - return (JniResult){.value = {.z = _result}, .exception = check_exception()}; -} - -jmethodID _m_Example_Aux__setValue = NULL; -FFI_PLUGIN_EXPORT -JniResult Example_Aux__setValue(jobject self_, uint8_t value) { - load_env(); - load_class_global_ref( - &_c_Example_Aux, - "com/github/dart_lang/jnigen/simple_package/Example$Aux"); - if (_c_Example_Aux == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example_Aux, &_m_Example_Aux__setValue, "setValue", "(Z)V"); - if (_m_Example_Aux__setValue == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_Example_Aux__setValue, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_Example_Aux__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_Example_Aux__value(jobject self_) { - load_env(); - load_class_global_ref( - &_c_Example_Aux, - "com/github/dart_lang/jnigen/simple_package/Example$Aux"); - if (_c_Example_Aux == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_Example_Aux, &_f_Example_Aux__value, "value", "Z"); - uint8_t _result = - (*jniEnv)->GetBooleanField(jniEnv, self_, _f_Example_Aux__value); - return (JniResult){.value = {.z = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_Example_Aux__value(jobject self_, uint8_t value) { - load_env(); - load_class_global_ref( - &_c_Example_Aux, - "com/github/dart_lang/jnigen/simple_package/Example$Aux"); - if (_c_Example_Aux == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_Example_Aux, &_f_Example_Aux__value, "value", "Z"); - (*jniEnv)->SetBooleanField(jniEnv, self_, _f_Example_Aux__value, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.pkg2.C2 -jclass _c_C2 = NULL; - -jmethodID _m_C2__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult C2__ctor() { - load_env(); - load_class_global_ref(&_c_C2, "com/github/dart_lang/jnigen/pkg2/C2"); - if (_c_C2 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_C2, &_m_C2__ctor, "<init>", "()V"); - if (_m_C2__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_C2, _m_C2__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_C2__CONSTANT = NULL; -FFI_PLUGIN_EXPORT -JniResult get_C2__CONSTANT() { - load_env(); - load_class_global_ref(&_c_C2, "com/github/dart_lang/jnigen/pkg2/C2"); - if (_c_C2 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_field(_c_C2, &_f_C2__CONSTANT, "CONSTANT", "I"); - int32_t _result = - (*jniEnv)->GetStaticIntField(jniEnv, _c_C2, _f_C2__CONSTANT); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_C2__CONSTANT(int32_t value) { - load_env(); - load_class_global_ref(&_c_C2, "com/github/dart_lang/jnigen/pkg2/C2"); - if (_c_C2 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_field(_c_C2, &_f_C2__CONSTANT, "CONSTANT", "I"); - (*jniEnv)->SetStaticIntField(jniEnv, _c_C2, _f_C2__CONSTANT, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.pkg2.Example -jclass _c_Example1 = NULL; - -jmethodID _m_Example1__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult Example1__ctor() { - load_env(); - load_class_global_ref(&_c_Example1, - "com/github/dart_lang/jnigen/pkg2/Example"); - if (_c_Example1 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example1, &_m_Example1__ctor, "<init>", "()V"); - if (_m_Example1__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_Example1, _m_Example1__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_Example1__whichExample = NULL; -FFI_PLUGIN_EXPORT -JniResult Example1__whichExample(jobject self_) { - load_env(); - load_class_global_ref(&_c_Example1, - "com/github/dart_lang/jnigen/pkg2/Example"); - if (_c_Example1 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_Example1, &_m_Example1__whichExample, "whichExample", "()I"); - if (_m_Example1__whichExample == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = - (*jniEnv)->CallIntMethod(jniEnv, self_, _m_Example1__whichExample); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.GrandParent -jclass _c_GrandParent = NULL; - -jmethodID _m_GrandParent__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent__ctor(jobject value) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent, &_m_GrandParent__ctor, "<init>", - "(Ljava/lang/Object;)V"); - if (_m_GrandParent__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_GrandParent, _m_GrandParent__ctor, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_GrandParent__stringParent = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent__stringParent(jobject self_) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent, &_m_GrandParent__stringParent, "stringParent", - "()Lcom/github/dart_lang/jnigen/generics/GrandParent$Parent;"); - if (_m_GrandParent__stringParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_GrandParent__stringParent); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_GrandParent__varParent = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent__varParent(jobject self_, jobject nestedValue) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent, &_m_GrandParent__varParent, "varParent", - "(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/generics/" - "GrandParent$Parent;"); - if (_m_GrandParent__varParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallObjectMethod( - jniEnv, self_, _m_GrandParent__varParent, nestedValue); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_GrandParent__stringStaticParent = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent__stringStaticParent() { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method( - _c_GrandParent, &_m_GrandParent__stringStaticParent, "stringStaticParent", - "()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); - if (_m_GrandParent__stringStaticParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_GrandParent, _m_GrandParent__stringStaticParent); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_GrandParent__varStaticParent = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent__varStaticParent(jobject value) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method(_c_GrandParent, &_m_GrandParent__varStaticParent, - "varStaticParent", - "(Ljava/lang/Object;)Lcom/github/dart_lang/jnigen/" - "generics/GrandParent$StaticParent;"); - if (_m_GrandParent__varStaticParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_GrandParent, _m_GrandParent__varStaticParent, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_GrandParent__staticParentWithSameType = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent__staticParentWithSameType(jobject self_) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method( - _c_GrandParent, &_m_GrandParent__staticParentWithSameType, - "staticParentWithSameType", - "()Lcom/github/dart_lang/jnigen/generics/GrandParent$StaticParent;"); - if (_m_GrandParent__staticParentWithSameType == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallObjectMethod( - jniEnv, self_, _m_GrandParent__staticParentWithSameType); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_GrandParent__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent__value(jobject self_) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent, &_f_GrandParent__value, "value", - "Ljava/lang/Object;"); - jobject _result = to_global_ref( - (*jniEnv)->GetObjectField(jniEnv, self_, _f_GrandParent__value)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent__value(jobject self_, jobject value) { - load_env(); - load_class_global_ref(&_c_GrandParent, - "com/github/dart_lang/jnigen/generics/GrandParent"); - if (_c_GrandParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent, &_f_GrandParent__value, "value", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent__value, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.GrandParent$Parent -jclass _c_GrandParent_Parent = NULL; - -jmethodID _m_GrandParent_Parent__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent_Parent__ctor(jobject parentValue, jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); - if (_c_GrandParent_Parent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent_Parent, &_m_GrandParent_Parent__ctor, "<init>", - "(Ljava/lang/Object;Ljava/lang/Object;)V"); - if (_m_GrandParent_Parent__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_GrandParent_Parent, - _m_GrandParent_Parent__ctor, parentValue, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_GrandParent_Parent__parentValue = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_Parent__parentValue(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); - if (_c_GrandParent_Parent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__parentValue, - "parentValue", "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_Parent__parentValue)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_Parent__parentValue(jobject self_, jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); - if (_c_GrandParent_Parent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__parentValue, - "parentValue", "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_Parent__parentValue, - value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_GrandParent_Parent__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_Parent__value(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); - if (_c_GrandParent_Parent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__value, "value", - "Ljava/lang/Object;"); - jobject _result = to_global_ref( - (*jniEnv)->GetObjectField(jniEnv, self_, _f_GrandParent_Parent__value)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_Parent__value(jobject self_, jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent"); - if (_c_GrandParent_Parent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent, &_f_GrandParent_Parent__value, "value", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_Parent__value, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.GrandParent$Parent$Child -jclass _c_GrandParent_Parent_Child = NULL; - -jmethodID _m_GrandParent_Parent_Child__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent_Parent_Child__ctor(jobject grandParentValue, - jobject parentValue, - jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent_Parent_Child, &_m_GrandParent_Parent_Child__ctor, - "<init>", - "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"); - if (_m_GrandParent_Parent_Child__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_GrandParent_Parent_Child, - _m_GrandParent_Parent_Child__ctor, - grandParentValue, parentValue, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_GrandParent_Parent_Child__grandParentValue = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_Parent_Child__grandParentValue(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent_Child, - &_f_GrandParent_Parent_Child__grandParentValue, "grandParentValue", - "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_Parent_Child__grandParentValue)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_Parent_Child__grandParentValue(jobject self_, - jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent_Child, - &_f_GrandParent_Parent_Child__grandParentValue, "grandParentValue", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField( - jniEnv, self_, _f_GrandParent_Parent_Child__grandParentValue, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_GrandParent_Parent_Child__parentValue = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_Parent_Child__parentValue(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent_Child, - &_f_GrandParent_Parent_Child__parentValue, "parentValue", - "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_Parent_Child__parentValue)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_Parent_Child__parentValue(jobject self_, - jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent_Child, - &_f_GrandParent_Parent_Child__parentValue, "parentValue", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, - _f_GrandParent_Parent_Child__parentValue, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_GrandParent_Parent_Child__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_Parent_Child__value(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent_Child, &_f_GrandParent_Parent_Child__value, - "value", "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_Parent_Child__value)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_Parent_Child__value(jobject self_, jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_Parent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child"); - if (_c_GrandParent_Parent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_Parent_Child, &_f_GrandParent_Parent_Child__value, - "value", "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_Parent_Child__value, - value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.GrandParent$StaticParent -jclass _c_GrandParent_StaticParent = NULL; - -jmethodID _m_GrandParent_StaticParent__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent_StaticParent__ctor(jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); - if (_c_GrandParent_StaticParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent_StaticParent, &_m_GrandParent_StaticParent__ctor, - "<init>", "(Ljava/lang/Object;)V"); - if (_m_GrandParent_StaticParent__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_GrandParent_StaticParent, - _m_GrandParent_StaticParent__ctor, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_GrandParent_StaticParent__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_StaticParent__value(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); - if (_c_GrandParent_StaticParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_StaticParent, &_f_GrandParent_StaticParent__value, - "value", "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_StaticParent__value)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_StaticParent__value(jobject self_, jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent"); - if (_c_GrandParent_StaticParent == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_StaticParent, &_f_GrandParent_StaticParent__value, - "value", "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_GrandParent_StaticParent__value, - value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.GrandParent$StaticParent$Child -jclass _c_GrandParent_StaticParent_Child = NULL; - -jmethodID _m_GrandParent_StaticParent_Child__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult GrandParent_StaticParent_Child__ctor(jobject parentValue, - jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); - if (_c_GrandParent_StaticParent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_GrandParent_StaticParent_Child, - &_m_GrandParent_StaticParent_Child__ctor, "<init>", - "(Ljava/lang/Object;Ljava/lang/Object;)V"); - if (_m_GrandParent_StaticParent_Child__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject( - jniEnv, _c_GrandParent_StaticParent_Child, - _m_GrandParent_StaticParent_Child__ctor, parentValue, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_GrandParent_StaticParent_Child__parentValue = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_StaticParent_Child__parentValue(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); - if (_c_GrandParent_StaticParent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_StaticParent_Child, - &_f_GrandParent_StaticParent_Child__parentValue, "parentValue", - "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_StaticParent_Child__parentValue)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_StaticParent_Child__parentValue(jobject self_, - jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); - if (_c_GrandParent_StaticParent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_StaticParent_Child, - &_f_GrandParent_StaticParent_Child__parentValue, "parentValue", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField( - jniEnv, self_, _f_GrandParent_StaticParent_Child__parentValue, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_GrandParent_StaticParent_Child__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_GrandParent_StaticParent_Child__value(jobject self_) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); - if (_c_GrandParent_StaticParent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_StaticParent_Child, - &_f_GrandParent_StaticParent_Child__value, "value", - "Ljava/lang/Object;"); - jobject _result = to_global_ref((*jniEnv)->GetObjectField( - jniEnv, self_, _f_GrandParent_StaticParent_Child__value)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_GrandParent_StaticParent_Child__value(jobject self_, - jobject value) { - load_env(); - load_class_global_ref( - &_c_GrandParent_StaticParent_Child, - "com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child"); - if (_c_GrandParent_StaticParent_Child == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_GrandParent_StaticParent_Child, - &_f_GrandParent_StaticParent_Child__value, "value", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, - _f_GrandParent_StaticParent_Child__value, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.MyMap -jclass _c_MyMap = NULL; - -jmethodID _m_MyMap__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult MyMap__ctor() { - load_env(); - load_class_global_ref(&_c_MyMap, - "com/github/dart_lang/jnigen/generics/MyMap"); - if (_c_MyMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyMap, &_m_MyMap__ctor, "<init>", "()V"); - if (_m_MyMap__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_MyMap, _m_MyMap__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyMap__get0 = NULL; -FFI_PLUGIN_EXPORT -JniResult MyMap__get0(jobject self_, jobject key) { - load_env(); - load_class_global_ref(&_c_MyMap, - "com/github/dart_lang/jnigen/generics/MyMap"); - if (_c_MyMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyMap, &_m_MyMap__get0, "get", - "(Ljava/lang/Object;)Ljava/lang/Object;"); - if (_m_MyMap__get0 == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyMap__get0, key); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyMap__put = NULL; -FFI_PLUGIN_EXPORT -JniResult MyMap__put(jobject self_, jobject key, jobject value) { - load_env(); - load_class_global_ref(&_c_MyMap, - "com/github/dart_lang/jnigen/generics/MyMap"); - if (_c_MyMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyMap, &_m_MyMap__put, "put", - "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); - if (_m_MyMap__put == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyMap__put, key, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyMap__entryStack = NULL; -FFI_PLUGIN_EXPORT -JniResult MyMap__entryStack(jobject self_) { - load_env(); - load_class_global_ref(&_c_MyMap, - "com/github/dart_lang/jnigen/generics/MyMap"); - if (_c_MyMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyMap, &_m_MyMap__entryStack, "entryStack", - "()Lcom/github/dart_lang/jnigen/generics/MyStack;"); - if (_m_MyMap__entryStack == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyMap__entryStack); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.MyMap$MyEntry -jclass _c_MyMap_MyEntry = NULL; - -jmethodID _m_MyMap_MyEntry__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult MyMap_MyEntry__ctor(jobject key, jobject value) { - load_env(); - load_class_global_ref(&_c_MyMap_MyEntry, - "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); - if (_c_MyMap_MyEntry == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyMap_MyEntry, &_m_MyMap_MyEntry__ctor, "<init>", - "(Ljava/lang/Object;Ljava/lang/Object;)V"); - if (_m_MyMap_MyEntry__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_MyMap_MyEntry, - _m_MyMap_MyEntry__ctor, key, value); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jfieldID _f_MyMap_MyEntry__key = NULL; -FFI_PLUGIN_EXPORT -JniResult get_MyMap_MyEntry__key(jobject self_) { - load_env(); - load_class_global_ref(&_c_MyMap_MyEntry, - "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); - if (_c_MyMap_MyEntry == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__key, "key", - "Ljava/lang/Object;"); - jobject _result = to_global_ref( - (*jniEnv)->GetObjectField(jniEnv, self_, _f_MyMap_MyEntry__key)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_MyMap_MyEntry__key(jobject self_, jobject value) { - load_env(); - load_class_global_ref(&_c_MyMap_MyEntry, - "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); - if (_c_MyMap_MyEntry == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__key, "key", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_MyMap_MyEntry__key, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jfieldID _f_MyMap_MyEntry__value = NULL; -FFI_PLUGIN_EXPORT -JniResult get_MyMap_MyEntry__value(jobject self_) { - load_env(); - load_class_global_ref(&_c_MyMap_MyEntry, - "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); - if (_c_MyMap_MyEntry == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__value, "value", - "Ljava/lang/Object;"); - jobject _result = to_global_ref( - (*jniEnv)->GetObjectField(jniEnv, self_, _f_MyMap_MyEntry__value)); - return (JniResult){.value = {.l = _result}, .exception = check_exception()}; -} - -FFI_PLUGIN_EXPORT -JniResult set_MyMap_MyEntry__value(jobject self_, jobject value) { - load_env(); - load_class_global_ref(&_c_MyMap_MyEntry, - "com/github/dart_lang/jnigen/generics/MyMap$MyEntry"); - if (_c_MyMap_MyEntry == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_field(_c_MyMap_MyEntry, &_f_MyMap_MyEntry__value, "value", - "Ljava/lang/Object;"); - (*jniEnv)->SetObjectField(jniEnv, self_, _f_MyMap_MyEntry__value, value); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.MyStack -jclass _c_MyStack = NULL; - -jmethodID _m_MyStack__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult MyStack__ctor() { - load_env(); - load_class_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyStack, &_m_MyStack__ctor, "<init>", "()V"); - if (_m_MyStack__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_MyStack, _m_MyStack__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyStack__fromArray = NULL; -FFI_PLUGIN_EXPORT -JniResult MyStack__fromArray(jobject arr) { - load_env(); - load_class_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_MyStack, _m_MyStack__fromArray, arr); - return (JniResult){.value = {.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_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_MyStack, _m_MyStack__fromArrayOfArrayOfGrandParents, arr); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyStack__of = NULL; -FFI_PLUGIN_EXPORT -JniResult MyStack__of() { - load_env(); - load_class_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_MyStack, _m_MyStack__of); - return (JniResult){.value = {.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_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod(jniEnv, _c_MyStack, - _m_MyStack__of1, obj); - return (JniResult){.value = {.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_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.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){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_MyStack, _m_MyStack__of2, obj, obj2); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyStack__push = NULL; -FFI_PLUGIN_EXPORT -JniResult MyStack__push(jobject self_, jobject item) { - load_env(); - load_class_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyStack, &_m_MyStack__push, "push", "(Ljava/lang/Object;)V"); - if (_m_MyStack__push == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - (*jniEnv)->CallVoidMethod(jniEnv, self_, _m_MyStack__push, item); - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; -} - -jmethodID _m_MyStack__pop = NULL; -FFI_PLUGIN_EXPORT -JniResult MyStack__pop(jobject self_) { - load_env(); - load_class_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyStack, &_m_MyStack__pop, "pop", "()Ljava/lang/Object;"); - if (_m_MyStack__pop == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallObjectMethod(jniEnv, self_, _m_MyStack__pop); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_MyStack__size = NULL; -FFI_PLUGIN_EXPORT -JniResult MyStack__size(jobject self_) { - load_env(); - load_class_global_ref(&_c_MyStack, - "com/github/dart_lang/jnigen/generics/MyStack"); - if (_c_MyStack == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyStack, &_m_MyStack__size, "size", "()I"); - if (_m_MyStack__size == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - int32_t _result = (*jniEnv)->CallIntMethod(jniEnv, self_, _m_MyStack__size); - return (JniResult){.value = {.i = _result}, .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.StringKeyedMap -jclass _c_StringKeyedMap = NULL; - -jmethodID _m_StringKeyedMap__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult StringKeyedMap__ctor() { - load_env(); - load_class_global_ref(&_c_StringKeyedMap, - "com/github/dart_lang/jnigen/generics/StringKeyedMap"); - if (_c_StringKeyedMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_StringKeyedMap, &_m_StringKeyedMap__ctor, "<init>", "()V"); - if (_m_StringKeyedMap__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_StringKeyedMap, _m_StringKeyedMap__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .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_global_ref(&_c_StringMap, - "com/github/dart_lang/jnigen/generics/StringMap"); - if (_c_StringMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_StringMap, &_m_StringMap__ctor, "<init>", "()V"); - if (_m_StringMap__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_StringMap, _m_StringMap__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.StringStack -jclass _c_StringStack = NULL; - -jmethodID _m_StringStack__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult StringStack__ctor() { - load_env(); - load_class_global_ref(&_c_StringStack, - "com/github/dart_lang/jnigen/generics/StringStack"); - if (_c_StringStack == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_StringStack, &_m_StringStack__ctor, "<init>", "()V"); - if (_m_StringStack__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_StringStack, _m_StringStack__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.generics.StringValuedMap -jclass _c_StringValuedMap = NULL; - -jmethodID _m_StringValuedMap__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult StringValuedMap__ctor() { - load_env(); - load_class_global_ref(&_c_StringValuedMap, - "com/github/dart_lang/jnigen/generics/StringValuedMap"); - if (_c_StringValuedMap == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_StringValuedMap, &_m_StringValuedMap__ctor, "<init>", "()V"); - if (_m_StringValuedMap__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->NewObject(jniEnv, _c_StringValuedMap, - _m_StringValuedMap__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.annotations.JsonSerializable$Case -jclass _c_JsonSerializable_Case = NULL; - -jmethodID _m_JsonSerializable_Case__values = NULL; -FFI_PLUGIN_EXPORT -JniResult JsonSerializable_Case__values() { - load_env(); - load_class_global_ref( - &_c_JsonSerializable_Case, - "com/github/dart_lang/jnigen/annotations/JsonSerializable$Case"); - if (_c_JsonSerializable_Case == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method( - _c_JsonSerializable_Case, &_m_JsonSerializable_Case__values, "values", - "()[Lcom/github/dart_lang/jnigen/annotations/JsonSerializable$Case;"); - if (_m_JsonSerializable_Case__values == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_JsonSerializable_Case, _m_JsonSerializable_Case__values); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -jmethodID _m_JsonSerializable_Case__valueOf = NULL; -FFI_PLUGIN_EXPORT -JniResult JsonSerializable_Case__valueOf(jobject name) { - load_env(); - load_class_global_ref( - &_c_JsonSerializable_Case, - "com/github/dart_lang/jnigen/annotations/JsonSerializable$Case"); - if (_c_JsonSerializable_Case == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_static_method(_c_JsonSerializable_Case, - &_m_JsonSerializable_Case__valueOf, "valueOf", - "(Ljava/lang/String;)Lcom/github/dart_lang/jnigen/" - "annotations/JsonSerializable$Case;"); - if (_m_JsonSerializable_Case__valueOf == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = (*jniEnv)->CallStaticObjectMethod( - jniEnv, _c_JsonSerializable_Case, _m_JsonSerializable_Case__valueOf, - name); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -} - -// com.github.dart_lang.jnigen.annotations.MyDataClass -jclass _c_MyDataClass = NULL; - -jmethodID _m_MyDataClass__ctor = NULL; -FFI_PLUGIN_EXPORT -JniResult MyDataClass__ctor() { - load_env(); - load_class_global_ref(&_c_MyDataClass, - "com/github/dart_lang/jnigen/annotations/MyDataClass"); - if (_c_MyDataClass == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - load_method(_c_MyDataClass, &_m_MyDataClass__ctor, "<init>", "()V"); - if (_m_MyDataClass__ctor == NULL) - return (JniResult){.value = {.j = 0}, .exception = check_exception()}; - jobject _result = - (*jniEnv)->NewObject(jniEnv, _c_MyDataClass, _m_MyDataClass__ctor); - return (JniResult){.value = {.l = to_global_ref(_result)}, - .exception = check_exception()}; -}
diff --git a/pkgs/jnigen/test/summary_generation_test.dart b/pkgs/jnigen/test/summary_generation_test.dart index e3582c6..8a4eab1 100644 --- a/pkgs/jnigen/test/summary_generation_test.dart +++ b/pkgs/jnigen/test/summary_generation_test.dart
@@ -42,14 +42,6 @@ } } -List<String> findFiles(Directory dir, String suffix) { - return dir - .listSync(recursive: true) - .map((entry) => relative(entry.path, from: dir.path)) - .where((path) => path.endsWith(suffix)) - .toList(); -} - /// Packs files indicated by [artifacts], each relative to [artifactDir] into /// a JAR file at [jarPath]. Future<void> createJar({ @@ -57,25 +49,11 @@ required List<String> artifacts, required String jarPath, }) async { - final status = await runCommand( + await runCommand( 'jar', ['cf', relative(jarPath, from: artifactDir), ...artifacts], workingDirectory: artifactDir, ); - if (status != 0) { - throw ArgumentError('Cannot create JAR from provided arguments'); - } -} - -Future<void> compileJavaFiles(List<String> paths, Directory target) async { - final status = await runCommand( - 'javac', - ['-d', target.absolute.path, ...paths], - workingDirectory: simplePackagePath, - ); - if (status != 0) { - throw ArgumentError('Cannot compile Java sources'); - } } String getClassNameFromPath(String path) { @@ -90,7 +68,7 @@ final simplePackagePath = join('test', 'simple_package_test', 'java'); final simplePackageDir = Directory(simplePackagePath); -final javaFiles = findFiles(simplePackageDir, '.java'); +final javaFiles = findFilesWithSuffix(simplePackageDir, '.java'); final javaClasses = javaFiles.map(getClassNameFromPath).toList(); Config getConfig({List<String>? sourcePath, List<String>? classPath}) { @@ -118,8 +96,8 @@ test('Test summary generation from compiled JAR', () async { final targetDir = tempDir.createTempSync("compiled_jar_test_"); - await compileJavaFiles(javaFiles, targetDir); - final classFiles = findFiles(targetDir, '.class'); + await compileJavaFiles(simplePackageDir, targetDir); + final classFiles = findFilesWithSuffix(targetDir, '.class'); final jarPath = join(targetDir.absolute.path, 'classes.jar'); await createJar( artifactDir: targetDir.path, artifacts: classFiles, jarPath: jarPath); @@ -148,7 +126,7 @@ test('Test summary generation from compiled classes in directory', () async { final targetDir = tempDir.createTempSync("compiled_classes_test_"); - await compileJavaFiles(javaFiles, targetDir); + await compileJavaFiles(simplePackageDir, targetDir); final config = getConfig(classPath: [targetDir.path]); final summaryClasses = await getSummary(config); expectNonEmptySummary(summaryClasses); @@ -168,8 +146,8 @@ jarPath: sourceJarPath, ); - await compileJavaFiles(javaFiles, targetDir); - final classFiles = findFiles(targetDir, '.class'); + await compileJavaFiles(simplePackageDir, targetDir); + final classFiles = findFilesWithSuffix(targetDir, '.class'); final classesJarPath = join(targetDir.path, 'classes.jar'); await createJar( artifactDir: targetDir.path,
diff --git a/pkgs/jnigen/test/test_util/bindings_test_setup.dart b/pkgs/jnigen/test/test_util/bindings_test_setup.dart new file mode 100644 index 0000000..b4d292c --- /dev/null +++ b/pkgs/jnigen/test/test_util/bindings_test_setup.dart
@@ -0,0 +1,77 @@ +// Copyright (c) 2022, 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. + +// Tests on generated code. +// +// Both the simple java example & jackson core classes example have tests in +// same file, because the test runner will reuse the process, which leads to +// reuse of the old JVM with old classpath if we have separate tests with +// different classpaths. + +import 'dart:io'; + +import 'package:jni/jni.dart'; +import 'package:path/path.dart' hide equals; + +import 'test_util.dart'; + +final simplePackageTest = join('test', 'simple_package_test'); +final jacksonCoreTest = join('test', 'jackson_core_test'); +final kotlinTest = join('test', 'kotlin_test'); +final jniJar = join(kotlinTest, 'jni.jar'); + +final simplePackageTestJava = join(simplePackageTest, 'java'); +final kotlinTestKotlin = join(kotlinTest, 'kotlin'); + +late Directory tempClassDir; + +Future<void> bindingsTestSetup() async { + await runCommand('dart', [ + 'run', + 'jni:setup', + '-p', + 'jni', + '-s', + join(simplePackageTest, 'c_based', 'c_bindings'), + '-s', + join(kotlinTest, 'c_based', 'c_bindings'), + '-s', + join(jacksonCoreTest, 'third_party', 'c_based', 'c_bindings'), + ]); + tempClassDir = + Directory.current.createTempSync("jnigen_runtime_test_classpath_"); + await compileJavaFiles(Directory(simplePackageTestJava), tempClassDir); + await runCommand('dart', [ + 'run', + 'jnigen:download_maven_jars', + '--config', + join(jacksonCoreTest, 'jnigen.yaml') + ]); + + final jacksonJars = await getJarPaths(join(jacksonCoreTest, 'third_party')); + + await runCommand( + 'mvn', + ['package'], + workingDirectory: kotlinTestKotlin, + runInShell: true, + ); + // Jar including Kotlin runtime and dependencies. + final kotlinTestJar = + join(kotlinTestKotlin, 'target', 'kotlin_test-jar-with-dependencies.jar'); + + if (!Platform.isAndroid) { + Jni.spawn(dylibDir: join('build', 'jni_libs'), classPath: [ + jniJar, + tempClassDir.path, + ...jacksonJars, + kotlinTestJar, + ]); + } + Jni.initDLApi(); +} + +void bindingsTestTeardown() { + tempClassDir.deleteSync(recursive: true); +}
diff --git a/pkgs/jnigen/test/test_util/callback_types.dart b/pkgs/jnigen/test/test_util/callback_types.dart new file mode 100644 index 0000000..3b3356e --- /dev/null +++ b/pkgs/jnigen/test/test_util/callback_types.dart
@@ -0,0 +1,12 @@ +// Copyright (c) 2022, 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. + +// These definitions could be in `test_util` but these are imported by android +// integration tests, and we test_util imports several parts of package:jnigen. + +typedef TestCaseCallback = void Function(); +typedef TestRunnerCallback = void Function( + String description, + TestCaseCallback test, +);
diff --git a/pkgs/jnigen/test/test_util/test_util.dart b/pkgs/jnigen/test/test_util/test_util.dart index 450e28a..4ac90ac 100644 --- a/pkgs/jnigen/test/test_util/test_util.dart +++ b/pkgs/jnigen/test/test_util/test_util.dart
@@ -29,7 +29,7 @@ } /// Runs command, and prints output only if the exit status is non-zero. -Future<int> runCommand(String exec, List<String> args, +Future<int> runCommandReturningStatus(String exec, List<String> args, {String? workingDirectory, bool runInShell = false}) async { final proc = await Process.run(exec, args, workingDirectory: workingDirectory, runInShell: runInShell); @@ -42,6 +42,25 @@ return proc.exitCode; } +Future<void> runCommand( + String exec, + List<String> args, { + String? workingDirectory, + bool runInShell = false, + String? messageOnFailure, +}) async { + final status = await runCommandReturningStatus( + exec, + args, + workingDirectory: workingDirectory, + runInShell: runInShell, + ); + if (status != 0) { + final message = messageOnFailure ?? 'Failed to execute $exec'; + throw Exception('$message: Command exited with return code $status'); + } +} + /// List all JAR files in [testRoot]/jar Future<List<String>> getJarPaths(String testRoot) async { final jarPath = join(testRoot, 'jar'); @@ -101,8 +120,10 @@ /// /// If the config generates C code, [cReferenceBindings] must be a non-null /// directory path. -Future<void> generateAndCompareBindings(Config config, - String dartReferenceBindings, String? cReferenceBindings) async { +Future<void> generateAndCompareBindings(Config config) async { + final dartReferenceBindings = + config.outputConfig.dartConfig.path.toFilePath(); + final cReferenceBindings = config.outputConfig.cConfig?.path.toFilePath(); final currentDir = Directory.current; final tempDir = currentDir.createTempSync("jnigen_test_temp"); final tempSrc = tempDir.uri.resolve("src/"); @@ -153,8 +174,74 @@ } } +const bindingTests = [ + 'jackson_core_test', + 'simple_package_test', + 'kotlin_test', +]; + +const registrantName = 'runtime_test_registrant.dart'; +const replicaName = 'runtime_test_registrant_dartonly_generated.dart'; + +void warnIfRuntimeTestsAreOutdated() { + final runtimeTests = join('test', 'generated_runtime_test.dart'); + if (!File(runtimeTests).existsSync()) { + log.fatal('Runtime test files not found. To run binding ' + 'runtime tests, please generate them by running ' + '`dart run tool/generate_runtime_tests.dart`'); + } + const regenInstr = 'Please run `dart run tool/generate_runtime_tests.dart` ' + 'and try again.'; + for (var testName in bindingTests) { + final registrant = File(join('test', testName, registrantName)); + final replica = File(join('test', testName, replicaName)); + if (!replica.existsSync()) { + log.fatal( + 'One or more generated runtime tests do not exist. $regenInstr', + ); + } + if (replica.lastModifiedSync().isBefore(registrant.lastModifiedSync())) { + log.fatal( + 'One or more generated runtime tests are not up-to-date. $regenInstr', + ); + } + } +} + /// Verifies if locally built dependencies (currently `ApiSummarizer`) /// are up-to-date. Future<void> checkLocallyBuiltDependencies() async { await failIfSummarizerNotBuilt(); + warnIfRuntimeTestsAreOutdated(); +} + +void generateAndCompareBothModes( + String description, + Config cBasedConfig, + Config dartOnlyConfig, +) { + test('$description (cBased)', () async { + await generateAndCompareBindings(cBasedConfig); + }); + test('$description (dartOnly)', () async { + await generateAndCompareBindings(dartOnlyConfig); + }); +} + +List<String> findFilesWithSuffix(Directory dir, String suffix) { + return dir + .listSync(recursive: true) + .map((entry) => relative(entry.path, from: dir.path)) + .where((path) => path.endsWith(suffix)) + .toList(); +} + +Future<void> compileJavaFiles(Directory root, Directory target) async { + final javaFiles = findFilesWithSuffix(root, '.java'); + await runCommand( + 'javac', + ['-d', target.absolute.path, ...javaFiles], + workingDirectory: root.path, + messageOnFailure: 'Cannot compile java sources', + ); }
diff --git a/pkgs/jnigen/tool/generate_runtime_tests.dart b/pkgs/jnigen/tool/generate_runtime_tests.dart new file mode 100644 index 0000000..75a1ea2 --- /dev/null +++ b/pkgs/jnigen/tool/generate_runtime_tests.dart
@@ -0,0 +1,183 @@ +// 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:io'; + +import 'package:path/path.dart'; +import 'package:args/args.dart'; + +import 'package:jnigen/src/logging/logging.dart'; + +final lineBreak = Platform.isWindows ? '\r\n' : '\n'; + +void runCommand(String exec, List<String> args) { + final proc = Process.runSync(exec, args, runInShell: true); + log.info('Execute $exec ${args.join(" ")}'); + if (proc.exitCode != 0) { + exitCode = proc.exitCode; + printError(proc.stdout); + printError(proc.stderr); + throw Exception('Command failed: $exec ${args.join(" ")}'); + } +} + +const testPath = 'test'; +const registrantFileName = 'runtime_test_registrant.dart'; +const dartOnlyRegistrantFileName = + 'runtime_test_registrant_dartonly_generated.dart'; + +// Paths of generated files, should not be checked in. +// If you change this, add the corresponding entry to .gitignore as well. +const replicaSuffix = '_dartonly_generated.dart'; +final runnerFilePath = join(testPath, 'generated_runtime_test.dart'); +final androidRunnerFilePath = + join('android_test_runner', 'integration_test', 'runtime_test.dart'); + +final generatedComment = + '// Generated file. Do not edit or check-in to version control.$lineBreak'; +const copyright = ''' +// 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. +'''; + +const bindingTests = [ + 'jackson_core_test', + 'simple_package_test', + 'kotlin_test', +]; + +const hasThirdPartyDir = {'jackson_core_test'}; + +final _generatedFiles = <String>[ + for (var testName in bindingTests) + join(testPath, testName, dartOnlyRegistrantFileName), + runnerFilePath, + androidRunnerFilePath, +]; + +void generateReplicasAndRunner() { + final imports = <String, String>{}; + for (var testName in bindingTests) { + final registrant = join(testName, registrantFileName); + final registrantFile = File(join(testPath, registrant)); + final contents = registrantFile + .readAsStringSync() + .replaceAll('c_based/dart_bindings/', 'dart_only/dart_bindings/'); + + final replica = registrant.replaceAll('.dart', replicaSuffix); + final replicaFile = File(join(testPath, replica)); + replicaFile.writeAsStringSync('$generatedComment$lineBreak$contents'); + log.info('Generated $replica'); + imports['${testName}_c_based'] = + Uri.file(registrant).toFilePath(windows: false); + imports['${testName}_dart_only'] = + Uri.file(replica).toFilePath(windows: false); + } + final importStrings = imports.entries + .map((e) => 'import "${e.value}" as ${e.key};') + .join(lineBreak); + final androidImportStrings = imports.entries + .map((e) => 'import "../../test/${e.value}" as ${e.key};') + .join(lineBreak); + final runStrings = imports.keys + .map((name) => '$name.registerTests("$name", test);') + .join('$lineBreak '); + final runnerProgram = ''' +$generatedComment +$copyright +import 'package:test/test.dart'; +import 'test_util/bindings_test_setup.dart' as setup; + +$importStrings + +void main() { + setUpAll(setup.bindingsTestSetup); + $runStrings + tearDownAll(setup.bindingsTestTeardown); +} +'''; + final runnerFile = File(runnerFilePath); + runnerFile.writeAsStringSync(runnerProgram); + log.info('Generated runner $runnerFilePath'); + + final androidRunnerProgram = ''' +$generatedComment +$copyright +import "package:flutter_test/flutter_test.dart"; +import "package:jni/jni.dart"; + +$androidImportStrings + +typedef TestCaseCallback = void Function(); + +void test(String description, TestCaseCallback testCase) { + testWidgets(description, (widgetTester) async => testCase()); +} + +void main() { + Jni.initDLApi(); + $runStrings +} +'''; + File(androidRunnerFilePath).writeAsStringSync(androidRunnerProgram); + log.info('Generated android runner: $androidRunnerFilePath'); + + final cMakePath = + join('android_test_runner', 'android', 'app', 'CMakeLists.txt'); + + final cmakeSubdirs = bindingTests.map((testName) { + final indirect = hasThirdPartyDir.contains(testName) ? '/third_party' : ''; + return 'add_subdirectory' + '(../../../test/$testName$indirect/c_based/c_bindings ' + '${testName}_build)'; + }).join(lineBreak); + final cMakeConfig = ''' +## Parent CMake for Android native build target. This will build +## all C bindings from tests. + +cmake_minimum_required(VERSION 3.10) + +project(simple_package VERSION 0.0.1 LANGUAGES C) + +$cmakeSubdirs +'''; + File(cMakePath).writeAsStringSync(cMakeConfig); + log.info('Wrote Android CMake file: $cMakePath'); +} + +void cleanup() { + for (var path in _generatedFiles) { + File(path).deleteSync(); + log.info('Deleted $path'); + } +} + +void main(List<String> args) async { + final parser = ArgParser() + ..addFlag( + 'help', + abbr: 'h', + help: 'show help', + negatable: false, + ) + ..addFlag( + 'clean', + abbr: 'c', + help: 'clear generated files', + negatable: false, + ); + final argResults = parser.parse(args); + if (argResults['help']) { + stderr.writeln( + 'Generates runtime tests for both Dart-only and C based bindings.'); + stderr.writeln(parser.usage); + return; + } else if (argResults['clean']) { + cleanup(); + } else { + generateReplicasAndRunner(); + runCommand('dart', ['format', ..._generatedFiles]); + } +}