diff --git a/pkgs/jni/CHANGELOG.md b/pkgs/jni/CHANGELOG.md index 25b49987a3..b9feed4398 100644 --- a/pkgs/jni/CHANGELOG.md +++ b/pkgs/jni/CHANGELOG.md @@ -17,6 +17,10 @@ - Changed the behavior of `JObject.releasedBy`. It now does not throw a `DoubleReleaseError` if the object was manually released before the end of arena. +- Added an isolate-local bounded LRU cache (default 256 entries) for `JClass`global + references to reduce repeated FindClass calls and GlobalRef allocations.Introduced + `Jni.getCachedClass`, `JClass.forNameCached`, and `Jni.setClassCacheSize` to access + and configure the cache, with immediate eviction when the capacity is reduced. - Added `JThrowable` class which inherits from `JObject` and implements `Exception`. - **Breaking Change**: `JniException` has been deleted. Java exceptions are now diff --git a/pkgs/jni/lib/src/jclass.dart b/pkgs/jni/lib/src/jclass.dart index a29db97b8a..d9dc49091c 100644 --- a/pkgs/jni/lib/src/jclass.dart +++ b/pkgs/jni/lib/src/jclass.dart @@ -16,6 +16,17 @@ class JClass extends JObject { JClass.forName(String name) : super.fromReference(JGlobalReference(Jni.findClass(name))); + /// Returns a cached [JClass] for the class or interface with the given name. + /// + /// Uses an internal LRU cache to minimize JNI calls and GlobalRef usage. + /// Returns the cached instance owned by the cache. + /// + /// Do NOT hold a long term reference to the returned [JClass]. The cache + /// manages their lifecycle and may evict it at any time. + factory JClass.forNameCached(String name) { + return Jni.getCachedClass(name); + } + JConstructorId constructorId(String signature) { return JConstructorId._(this, signature); } diff --git a/pkgs/jni/lib/src/jni.dart b/pkgs/jni/lib/src/jni.dart index e04b947f5f..0d416ff1ba 100644 --- a/pkgs/jni/lib/src/jni.dart +++ b/pkgs/jni/lib/src/jni.dart @@ -54,6 +54,8 @@ abstract final class Jni { static final DynamicLibrary _dylib = _loadDartJniLibrary(dir: _dylibDir); static final JniBindings _bindings = JniBindings(_dylib); + static final _classCache = _JClassCache(); + /// Store dylibDir if any was used. static String _dylibDir = join('build', 'jni_libs'); @@ -198,6 +200,34 @@ abstract final class Jni { .checkedClassRef; } + /// Returns a cached [JClass] for the given class name. + /// + /// This is preferred for repeated lookups of the same class, as it avoids + /// repeated JNI calls and minimizes GlobalRef usage. + /// + /// **Returns the cached JClass instance** owned by the cache. Callers must + /// NOT release this instance. The cache manages its lifecycle. + /// + /// The cache is isolate-local and has bounded capacity. + @internal + static JClass getCachedClass(String name) { + return _classCache.get(name); + } + + /// Sets the capacity of the internal LRU class cache. + /// + /// If the new [size] is smaller than the current number of cached classes, + /// the least recently used classes will be **immediately evicted** and + /// their global references released (via `DeleteGlobalRef`). + /// + /// This does **not** affect references returned by prior [getCachedClass] + /// calls. Those are owned by callers and remain valid until deleted. + /// + /// The cache is isolate-local, so this only affects the current isolate. + static void setClassCacheSize(int size) { + _classCache.capacity = size; + } + /// Throws an exception. @internal static void throwException(JThrowablePtr exception) { @@ -434,3 +464,67 @@ extension StringMethodsForJni on String { return toNativeUtf8(allocator: allocator).cast(); } } + +/// Internal cache entry for JNI class references. +class _JClassCacheEntry { + final String name; + final JGlobalReference globalRef; + final JClass jclass; + + _JClassCacheEntry(this.name, this.globalRef, this.jclass); +} + +/// Internal LRU cache for JNI class references. +/// +/// The cache owns [JGlobalReference] instances and provides [JClass] wrappers +/// that share these references. The cache is responsible for releasing +/// GlobalRefs on eviction. +/// +/// Cache capacity directly bounds the number of underlying JGlobalReferences. +/// +/// Isolate-local: Each isolate has its own cache instance. +class _JClassCache { + int _capacity = 256; + final _map = {}; + + JClass get(String name) { + var entry = _map[name]; + + if (entry != null) { + // Cache hit: Move entry to end for LRU tracking. + _map.remove(name); + _map[name] = entry; + return entry.jclass; + } + + // Cache miss: Create GlobalRef and JClass wrapper. + final globalRef = JGlobalReference(Jni.findClass(name)); + final jclass = JClass.fromReference(globalRef); + entry = _JClassCacheEntry(name, globalRef, jclass); + + // Evict LRU entry if at capacity. + if (_map.length >= _capacity) { + final keyToEvict = _map.keys.first; + _evict(keyToEvict); + } + + _map[name] = entry; + return entry.jclass; + } + + void _evict(String name) { + final entry = _map.remove(name)!; + // Release the GlobalRef; JClass wrapper becomes invalid but that's OK + // since cached instances; callers must not release + entry.globalRef.release(); + } + + set capacity(int size) { + _capacity = size; + // Evict LRU entries immediately if new capacity is smaller. + while (_map.length > _capacity) { + final keyToEvict = _map.keys.first; + _evict(keyToEvict); + } + } +} diff --git a/pkgs/jni/test/class_cache_test.dart b/pkgs/jni/test/class_cache_test.dart new file mode 100644 index 0000000000..bfad6ccbc3 --- /dev/null +++ b/pkgs/jni/test/class_cache_test.dart @@ -0,0 +1,167 @@ +// Copyright (c) 2025, 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']) +library; + +import 'dart:io'; + +import 'package:jni/jni.dart'; +import 'package:test/test.dart'; + +import 'test_util/test_util.dart'; + +void main() { + if (!Platform.isAndroid) { + spawnJvm(); + } + run(testRunner: test); +} + +void run({required TestRunnerCallback testRunner}) { + testRunner('Basic cache functionality', () { + final stringClass = Jni.getCachedClass('java/lang/String'); + expect(stringClass, isNotNull); + + final stringClass2 = Jni.getCachedClass('java/lang/String'); + expect(stringClass2, isNotNull); + // Same cached instance + expect(identical(stringClass, stringClass2), isTrue); + + // Check JNI equality (should be same object) + expect( + Jni.env.IsSameObject( + stringClass.reference.pointer, stringClass2.reference.pointer), + isTrue); + }); + + testRunner('Cache capacity configuration', () { + // Set small capacity + Jni.setClassCacheSize(2); + + final c1 = Jni.getCachedClass('java/lang/String'); + final c2 = Jni.getCachedClass('java/util/ArrayList'); + // c3 evicts c1 + final c3 = Jni.getCachedClass('java/util/HashMap'); + + // c2 and c3 still cached + expect(c2, isNotNull); + expect(c3, isNotNull); + + // Reload c1 (was evicted, creates new cached instance) + final c1Reload = Jni.getCachedClass('java/lang/String'); + // c1Reload is a different Dart instance since eviction recreated it + expect(identical(c1, c1Reload), isFalse); + }); + + testRunner('Stress test cache', () { + Jni.setClassCacheSize(100); + final classes = [ + 'java/lang/Byte', + 'java/lang/Short', + 'java/lang/Integer', + 'java/lang/Long', + 'java/lang/Float', + 'java/lang/Double', + 'java/lang/Boolean', + 'java/lang/Character', + 'java/lang/Object', + 'java/lang/Class', + 'java/lang/Number', + 'java/util/List', + 'java/util/Map', + 'java/util/Set', + 'java/util/Collection', + 'java/util/Iterator', + 'java/util/Random', + 'java/io/File', + 'java/io/InputStream', + 'java/io/OutputStream', + ]; + + for (var i = 0; i < 1000; i++) { + final name = classes[i % classes.length]; + final cls = Jni.getCachedClass(name); + expect(cls, isNotNull); + } + }); + + testRunner('Cache hit returns same instance', () { + final c1 = Jni.getCachedClass('java/lang/Object'); + final c2 = Jni.getCachedClass('java/lang/Object'); + // Both are the same cached instance + expect(identical(c1, c2), isTrue); + // Same underlying JNI object + expect(Jni.env.IsSameObject(c1.reference.pointer, c2.reference.pointer), + isTrue); + }); + + testRunner('Eviction and reload', () { + Jni.setClassCacheSize(2); + + const name1 = 'java/lang/String'; + const name2 = 'java/lang/Integer'; + const name3 = 'java/lang/Double'; + + final ref1 = Jni.getCachedClass(name1); + final ref2 = Jni.getCachedClass(name2); + + // Insert third class, evicting String (LRU) + final ref3 = Jni.getCachedClass(name3); + + // ref2 and ref3 still cached and valid + expect(ref2, isNotNull); + expect(ref3, isNotNull); + + // String evicted; reload creates new cached instance + final ref1Reload = Jni.getCachedClass(name1); + // Not identical since eviction recreated it + expect(identical(ref1, ref1Reload), isFalse); + }); + + testRunner('Capacity reduction evicts entries', () { + Jni.setClassCacheSize(10); + + final refs = []; + final uniqueClasses = [ + 'java/lang/String', + 'java/lang/Integer', + 'java/lang/Double', + 'java/lang/Boolean', + 'java/lang/Long', + 'java/lang/Float', + 'java/lang/Byte', + 'java/lang/Short', + 'java/lang/Character', + 'java/util/ArrayList', + ]; + + for (final className in uniqueClasses) { + refs.add(Jni.getCachedClass(className)); + } + + // Reduce capacity - cache evicts 7 entries + Jni.setClassCacheSize(3); + + // All cached instances should still be valid + for (final ref in refs) { + expect(ref, isNotNull); + } + }); + + testRunner('JClass.forNameCached uses cache and returns same instance', () { + final jclass1 = JClass.forNameCached('java/lang/Object'); + final jclass2 = JClass.forNameCached('java/lang/Object'); + + // Same Dart instance from cache + expect(identical(jclass1, jclass2), isTrue); + + // Same underlying JNI class + final ref1 = jclass1.reference; + final ref2 = jclass2.reference; + expect(Jni.env.IsSameObject(ref1.pointer, ref2.pointer), isTrue); + + // Do NOT release cached instances - cache owns them + }); +} diff --git a/pkgs/jnigen/CHANGELOG.md b/pkgs/jnigen/CHANGELOG.md index 0003edc85b..5d16db979b 100644 --- a/pkgs/jnigen/CHANGELOG.md +++ b/pkgs/jnigen/CHANGELOG.md @@ -13,6 +13,9 @@ `bool`. - Kotlin suspend functions with no result (a return type of `Unit`) now return `Future` in Dart instead of `Future`. +- Generated bindings now use `JClass.forNameCached` instead of `JClass.forName` + for class lookups, reducing redundant `FindClass` JNI calls via the new + isolate-local LRU cache in `package:jni`. - Improve error message for unsupported Java class file versions in summary generation. ## 0.15.0 diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart index 4deedd467e..7f351b8f7c 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart @@ -62,8 +62,8 @@ import 'PDDocumentInformation.dart' as pddocumentinformation$_; /// The \#close() method must be called once the document is no longer needed. ///@author Ben Litchfield extension type PDDocument._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'org/apache/pdfbox/pdmodel/PDDocument'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'org/apache/pdfbox/pdmodel/PDDocument'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $PDDocument$Type$(); diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart index 03a21f789c..74316650d9 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart @@ -63,8 +63,8 @@ import 'package:jni/jni.dart' as jni$_; ///@author Gerardo Ortiz extension type PDDocumentInformation._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'org/apache/pdfbox/pdmodel/PDDocumentInformation'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'org/apache/pdfbox/pdmodel/PDDocumentInformation'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = 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 b798d553a8..8df4503848 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 @@ -67,8 +67,8 @@ import '../pdmodel/PDDocument.dart' as pddocument$_; ///@author Ben Litchfield extension type PDFTextStripper._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'org/apache/pdfbox/text/PDFTextStripper'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'org/apache/pdfbox/text/PDFTextStripper'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $PDFTextStripper$Type$(); diff --git a/pkgs/jnigen/lib/src/bindings/dart_generator.dart b/pkgs/jnigen/lib/src/bindings/dart_generator.dart index 778317eadc..c8fe4a4c9b 100644 --- a/pkgs/jnigen/lib/src/bindings/dart_generator.dart +++ b/pkgs/jnigen/lib/src/bindings/dart_generator.dart @@ -331,7 +331,7 @@ class _ClassGenerator extends Visitor { final modifier = node.isTopLevel ? '' : ' static '; final classRef = node.isTopLevel ? '_${node.finalName}Class' : '_class'; s.write(''' -${modifier}final $classRef = $_jni.JClass.forName(r'$internalName'); +$modifier$_jni.JClass get $classRef => $_jni.JClass.forNameCached(r'$internalName'); '''); return classRef; diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart index e3a5ffbcf6..4fb3009451 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonFactory.dart @@ -61,8 +61,8 @@ import 'JsonParser.dart' as jsonparser$_; /// changed for JsonFactory. extension type JsonFactory$Feature._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonFactory$Feature'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/fasterxml/jackson/core/JsonFactory$Feature'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = @@ -335,8 +335,8 @@ final class $JsonFactory$Feature$Type$ /// instances. ///@author Tatu Saloranta extension type JsonFactory._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonFactory'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/fasterxml/jackson/core/JsonFactory'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $JsonFactory$Type$(); diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart index 4940eadc8e..02faea4dc1 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonParser.dart @@ -60,8 +60,8 @@ import 'JsonToken.dart' as jsontoken$_; /// Enumeration that defines all on/off features for parsers. extension type JsonParser$Feature._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonParser$Feature'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/fasterxml/jackson/core/JsonParser$Feature'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = @@ -595,8 +595,8 @@ final class $JsonParser$Feature$Type$ extends jni$_.JType { /// used for numbers. extension type JsonParser$NumberType._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonParser$NumberType'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/fasterxml/jackson/core/JsonParser$NumberType'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = @@ -734,8 +734,8 @@ final class $JsonParser$NumberType$Type$ /// a JsonFactory instance. ///@author Tatu Saloranta extension type JsonParser._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonParser'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/fasterxml/jackson/core/JsonParser'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $JsonParser$Type$(); diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart index cfa52ed956..f0c07ed03f 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/bindings/com/fasterxml/jackson/core/JsonToken.dart @@ -58,8 +58,8 @@ import 'package:jni/jni.dart' as jni$_; /// Enumeration for basic token types used for returning results /// of parsing JSON content. extension type JsonToken._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/fasterxml/jackson/core/JsonToken'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/fasterxml/jackson/core/JsonToken'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $JsonToken$Type$(); diff --git a/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart b/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart index 8daeb7ae9d..4797d8055b 100644 --- a/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart +++ b/pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart @@ -40,10 +40,217 @@ import 'dart:core' show Object, String, double, int; import 'package:jni/_internal.dart' as jni$_; import 'package:jni/jni.dart' as jni$_; +/// from: `com.github.dart_lang.jnigen.AllDefaults` +extension type AllDefaults._(jni$_.JObject _$this) implements jni$_.JObject { + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/AllDefaults'); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = $AllDefaults$Type$(); + static final _id_new$ = _class.constructorId( + r'(ILjava/lang/String;Z)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32 + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer, int)>(); + + /// from: `public void (int i, java.lang.String string, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + factory AllDefaults( + int i, + jni$_.JString string, + core$_.bool z, + ) { + final _$string = string.reference; + return _new$(_class.reference.pointer, _id_new$.pointer, i, + _$string.pointer, z ? 1 : 0) + .object(); + } + + static final _id_new$1 = _class.constructorId( + r'(ILjava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + int, + jni$_.Pointer, + int, + int, + jni$_.Pointer)>(); + + /// from: `synthetic public void (int i, java.lang.String string, boolean z, int i1, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory AllDefaults.new$1( + int i, + jni$_.JString? string, + core$_.bool z, + int i1, + jni$_.JObject? defaultConstructorMarker, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return _new$1(_class.reference.pointer, _id_new$1.pointer, i, + _$string.pointer, z ? 1 : 0, i1, _$defaultConstructorMarker.pointer) + .object(); + } + + static final _id_getA = _class.instanceMethodId( + r'getA', + r'()I', + ); + + static final _getA = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final int getA()` + int getA() { + return _getA(reference.pointer, _id_getA.pointer).integer; + } + + static final _id_getB = _class.instanceMethodId( + r'getB', + r'()Ljava/lang/String;', + ); + + static final _getB = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String getB()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString getB() { + return _getB(reference.pointer, _id_getB.pointer).object(); + } + + static final _id_getC = _class.instanceMethodId( + r'getC', + r'()Z', + ); + + static final _getC = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final boolean getC()` + core$_.bool getC() { + return _getC(reference.pointer, _id_getC.pointer).boolean; + } + + static final _id_summary = _class.instanceMethodId( + r'summary', + r'()Ljava/lang/String;', + ); + + static final _summary = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public fun summary(): kotlin.String` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString summary() { + return _summary(reference.pointer, _id_summary.pointer) + .object(); + } + + static final _id_new$2 = _class.constructorId( + r'()V', + ); + + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory AllDefaults.new$2() { + return _new$2(_class.reference.pointer, _id_new$2.pointer) + .object(); + } +} + +final class $AllDefaults$Type$ extends jni$_.JType { + @jni$_.internal + const $AllDefaults$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/AllDefaults;'; +} + /// from: `com.github.dart_lang.jnigen.CanDoA` extension type CanDoA._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/CanDoA'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/CanDoA'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $CanDoA$Type$(); @@ -180,8 +387,8 @@ final class $CanDoA$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.CanDoB` extension type CanDoB._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/CanDoB'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/CanDoB'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $CanDoB$Type$(); @@ -316,11 +523,188 @@ final class $CanDoB$Type$ extends jni$_.JType { String get signature => r'Lcom/github/dart_lang/jnigen/CanDoB;'; } +/// from: `com.github.dart_lang.jnigen.DefaultParams` +extension type DefaultParams._(jni$_.JObject _$this) implements jni$_.JObject { + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/DefaultParams'); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = $DefaultParams$Type$(); + static final _id_new$ = _class.constructorId( + r'(ILjava/lang/String;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32, jni$_.Pointer)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, jni$_.Pointer)>(); + + /// from: `public void (int i, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory DefaultParams( + int i, + jni$_.JString string, + ) { + final _$string = string.reference; + return _new$( + _class.reference.pointer, _id_new$.pointer, i, _$string.pointer) + .object(); + } + + static final _id_new$1 = _class.constructorId( + r'(ILjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + int, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `synthetic public void (int i, java.lang.String string, int i1, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory DefaultParams.new$1( + int i, + jni$_.JString? string, + int i1, + jni$_.JObject? defaultConstructorMarker, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return _new$1(_class.reference.pointer, _id_new$1.pointer, i, + _$string.pointer, i1, _$defaultConstructorMarker.pointer) + .object(); + } + + static final _id_getX = _class.instanceMethodId( + r'getX', + r'()I', + ); + + static final _getX = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final int getX()` + int getX() { + return _getX(reference.pointer, _id_getX.pointer).integer; + } + + static final _id_getY = _class.instanceMethodId( + r'getY', + r'()Ljava/lang/String;', + ); + + static final _getY = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String getY()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString getY() { + return _getY(reference.pointer, _id_getY.pointer).object(); + } + + static final _id_greet = _class.instanceMethodId( + r'greet', + r'()Ljava/lang/String;', + ); + + static final _greet = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public fun greet(): kotlin.String` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString greet() { + return _greet(reference.pointer, _id_greet.pointer).object(); + } + + static final _id_new$2 = _class.constructorId( + r'()V', + ); + + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory DefaultParams.new$2() { + return _new$2(_class.reference.pointer, _id_new$2.pointer) + .object(); + } +} + +final class $DefaultParams$Type$ extends jni$_.JType { + @jni$_.internal + const $DefaultParams$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/DefaultParams;'; +} + /// from: `com.github.dart_lang.jnigen.Measure` extension type Measure<$T extends jni$_.JObject>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Measure'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/Measure'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Measure$Type$(); @@ -407,8 +791,8 @@ final class $Measure$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.MeasureUnit` extension type MeasureUnit._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/MeasureUnit'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/MeasureUnit'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $MeasureUnit$Type$(); @@ -578,11 +962,169 @@ final class $MeasureUnit$Type$ extends jni$_.JType { String get signature => r'Lcom/github/dart_lang/jnigen/MeasureUnit;'; } +/// from: `com.github.dart_lang.jnigen.MixedParams` +extension type MixedParams._(jni$_.JObject _$this) implements jni$_.JObject { + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/MixedParams'); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = $MixedParams$Type$(); + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/String;I)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); + + /// from: `public void (java.lang.String string, int i)` + /// The returned object must be released after use, by calling the [release] method. + factory MixedParams( + jni$_.JString string, + int i, + ) { + final _$string = string.reference; + return _new$( + _class.reference.pointer, _id_new$.pointer, _$string.pointer, i) + .object(); + } + + static final _id_new$1 = _class.constructorId( + r'(Ljava/lang/String;IILkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + jni$_.Pointer)>(); + + /// from: `synthetic public void (java.lang.String string, int i, int i1, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory MixedParams.new$1( + jni$_.JString? string, + int i, + int i1, + jni$_.JObject? defaultConstructorMarker, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return _new$1(_class.reference.pointer, _id_new$1.pointer, _$string.pointer, + i, i1, _$defaultConstructorMarker.pointer) + .object(); + } + + static final _id_getRequired = _class.instanceMethodId( + r'getRequired', + r'()Ljava/lang/String;', + ); + + static final _getRequired = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String getRequired()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString getRequired() { + return _getRequired(reference.pointer, _id_getRequired.pointer) + .object(); + } + + static final _id_getOptional = _class.instanceMethodId( + r'getOptional', + r'()I', + ); + + static final _getOptional = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final int getOptional()` + int getOptional() { + return _getOptional(reference.pointer, _id_getOptional.pointer).integer; + } + + static final _id_describe = _class.instanceMethodId( + r'describe', + r'()Ljava/lang/String;', + ); + + static final _describe = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public fun describe(): kotlin.String` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString describe() { + return _describe(reference.pointer, _id_describe.pointer) + .object(); + } +} + +final class $MixedParams$Type$ extends jni$_.JType { + @jni$_.internal + const $MixedParams$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Lcom/github/dart_lang/jnigen/MixedParams;'; +} + /// from: `com.github.dart_lang.jnigen.Nullability$InnerClass` -extension type Nullability$InnerClass<$T extends jni$_.JObject?, - $U extends jni$_.JObject, $V extends jni$_.JObject?>._( - jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( +extension type Nullability$InnerClass< + $T extends jni$_.JObject?, + $U extends jni$_.JObject, + $V extends jni$_.JObject?>._(jni$_.JObject _$this) + implements jni$_.JObject { + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/Nullability$InnerClass'); /// The type which includes information such as the signature of this class. @@ -667,8 +1209,8 @@ final class $Nullability$InnerClass$Type$ /// from: `com.github.dart_lang.jnigen.Nullability` extension type Nullability<$T extends jni$_.JObject?, $U extends jni$_.JObject>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Nullability'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/Nullability'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Nullability$Type$(); @@ -1400,8 +1942,8 @@ final class $Nullability$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.Operators` extension type Operators._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Operators'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/Operators'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Operators$Type$(); @@ -1755,8 +2297,8 @@ final class $Operators$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.Speed` extension type Speed._(jni$_.JObject _$this) implements Measure { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/Speed'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/Speed'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Speed$Type$(); @@ -1995,8 +2537,8 @@ final class $Speed$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.SpeedUnit` extension type SpeedUnit._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/SpeedUnit'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/SpeedUnit'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $SpeedUnit$Type$(); @@ -2129,8 +2671,8 @@ final class $SpeedUnit$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.SuspendFun` extension type SuspendFun._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/SuspendFun'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/SuspendFun'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $SuspendFun$Type$(); @@ -2621,8 +3163,8 @@ final class $SuspendFun$Type$ extends jni$_.JType { String get signature => r'Lcom/github/dart_lang/jnigen/SuspendFun;'; } -final _SuspendFunKtClass = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/SuspendFunKt'); +jni$_.JClass get _SuspendFunKtClass => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/SuspendFunKt'); final _id_consumeOnAnotherThread = _SuspendFunKtClass.staticMethodId( r'consumeOnAnotherThread', @@ -2741,8 +3283,8 @@ core$_.Future consumeOnSameThread( /// from: `com.github.dart_lang.jnigen.SuspendInterface` extension type SuspendInterface._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/SuspendInterface'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/SuspendInterface'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $SuspendInterface$Type$(); @@ -3356,8 +3898,8 @@ final class $SuspendInterface$Type$ extends jni$_.JType { String get signature => r'Lcom/github/dart_lang/jnigen/SuspendInterface;'; } -final _TopLevelKtClass = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/TopLevelKt'); +jni$_.JClass get _TopLevelKtClass => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/TopLevelKt'); final _id_getTopLevelField = _TopLevelKtClass.staticMethodId( r'getTopLevelField', @@ -3455,8 +3997,8 @@ int topLevelSum( .integer; } -final _TopLevelKt$1Class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/subpackage/TopLevelKt'); +jni$_.JClass get _TopLevelKt$1Class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/subpackage/TopLevelKt'); final _id_getTopLevelField$1 = _TopLevelKt$1Class.staticMethodId( r'getTopLevelField', diff --git a/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart b/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart index 8e05de3375..34baed0233 100644 --- a/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart +++ b/pkgs/jnigen/test/simple_package_test/bindings/simple_package.dart @@ -43,7 +43,7 @@ import 'package:jni/jni.dart' as jni$_; /// from: `com.github.dart_lang.jnigen.simple_package.Example$Nested$NestedTwice` extension type Example$Nested$NestedTwice._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Example$Nested$NestedTwice'); /// The type which includes information such as the signature of this class. @@ -97,7 +97,7 @@ final class $Example$Nested$NestedTwice$Type$ /// from: `com.github.dart_lang.jnigen.simple_package.Example$Nested` extension type Example$Nested._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Example$Nested'); /// The type which includes information such as the signature of this class. @@ -207,7 +207,7 @@ final class $Example$Nested$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.simple_package.Example$NonStaticNested` extension type Example$NonStaticNested._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Example$NonStaticNested'); /// The type which includes information such as the signature of this class. @@ -265,7 +265,7 @@ final class $Example$NonStaticNested$Type$ /// from: `com.github.dart_lang.jnigen.simple_package.Example` extension type Example._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Example'); /// The type which includes information such as the signature of this class. @@ -1485,7 +1485,7 @@ final class $Example$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.simple_package.Exceptions$MyException` extension type Exceptions$MyException._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Exceptions$MyException'); /// The type which includes information such as the signature of this class. @@ -1544,7 +1544,7 @@ final class $Exceptions$MyException$Type$ /// from: `com.github.dart_lang.jnigen.simple_package.Exceptions` extension type Exceptions._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Exceptions'); /// The type which includes information such as the signature of this class. @@ -2007,7 +2007,7 @@ final class $Exceptions$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.simple_package.Fields$Nested` extension type Fields$Nested._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Fields$Nested'); /// The type which includes information such as the signature of this class. @@ -2074,7 +2074,7 @@ final class $Fields$Nested$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.simple_package.Fields` extension type Fields._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/simple_package/Fields'); /// The type which includes information such as the signature of this class. @@ -2249,8 +2249,8 @@ final class $Fields$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.pkg2.C2` extension type C2._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/pkg2/C2'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/pkg2/C2'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $C2$Type$(); @@ -2301,8 +2301,8 @@ final class $C2$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.pkg2.Example` extension type Example$1._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/pkg2/Example'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/pkg2/Example'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Example$1$Type$(); @@ -2363,8 +2363,8 @@ final class $Example$1$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.enums.Colors$RGB` extension type Colors$RGB._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/enums/Colors$RGB'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/enums/Colors$RGB'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Colors$RGB$Type$(); @@ -2486,8 +2486,8 @@ final class $Colors$RGB$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.enums.Colors` extension type Colors._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/enums/Colors'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/enums/Colors'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Colors$Type$(); @@ -2614,7 +2614,7 @@ final class $Colors$Type$ extends jni$_.JType { extension type GenericTypeParams<$S extends jni$_.JObject?, $K extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/GenericTypeParams'); /// The type which includes information such as the signature of this class. @@ -2654,10 +2654,12 @@ final class $GenericTypeParams$Type$ extends jni$_.JType { } /// from: `com.github.dart_lang.jnigen.generics.GrandParent$Parent$Child` -extension type GrandParent$Parent$Child<$T extends jni$_.JObject?, - $S extends jni$_.JObject?, $U extends jni$_.JObject?>._( - jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( +extension type GrandParent$Parent$Child< + $T extends jni$_.JObject?, + $S extends jni$_.JObject?, + $U extends jni$_.JObject?>._(jni$_.JObject _$this) + implements jni$_.JObject { + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/GrandParent$Parent$Child'); /// The type which includes information such as the signature of this class. @@ -2756,7 +2758,7 @@ final class $GrandParent$Parent$Child$Type$ extension type GrandParent$Parent<$T extends jni$_.JObject?, $S extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/GrandParent$Parent'); /// The type which includes information such as the signature of this class. @@ -2839,7 +2841,7 @@ final class $GrandParent$Parent$Type$ extends jni$_.JType { extension type GrandParent$StaticParent$Child<$S extends jni$_.JObject?, $U extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/GrandParent$StaticParent$Child'); /// The type which includes information such as the signature of this class. @@ -2926,7 +2928,7 @@ final class $GrandParent$StaticParent$Child$Type$ /// from: `com.github.dart_lang.jnigen.generics.GrandParent$StaticParent` extension type GrandParent$StaticParent<$S extends jni$_.JObject?>._( jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/GrandParent$StaticParent'); /// The type which includes information such as the signature of this class. @@ -2985,8 +2987,8 @@ final class $GrandParent$StaticParent$Type$ /// from: `com.github.dart_lang.jnigen.generics.GrandParent` extension type GrandParent<$T extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/GrandParent'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/generics/GrandParent'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $GrandParent$Type$(); @@ -3171,7 +3173,7 @@ final class $GrandParent$Type$ extends jni$_.JType { extension type MyMap$MyEntry<$K extends jni$_.JObject?, $V extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/MyMap$MyEntry'); /// The type which includes information such as the signature of this class. @@ -3254,8 +3256,8 @@ final class $MyMap$MyEntry$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.generics.MyMap` extension type MyMap<$K extends jni$_.JObject?, $V extends jni$_.JObject?>._( jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/MyMap'); + static jni$_.JClass get _class => + jni$_.JClass.forNameCached(r'com/github/dart_lang/jnigen/generics/MyMap'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $MyMap$Type$(); @@ -3380,8 +3382,8 @@ final class $MyMap$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.generics.MyStack` extension type MyStack<$T extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/MyStack'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/generics/MyStack'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $MyStack$Type$(); @@ -3631,7 +3633,7 @@ final class $MyStack$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.generics.StringKeyedMap` extension type StringKeyedMap<$V extends jni$_.JObject?>._(jni$_.JObject _$this) implements MyMap { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/StringKeyedMap'); /// The type which includes information such as the signature of this class. @@ -3673,8 +3675,8 @@ final class $StringKeyedMap$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.generics.StringMap` extension type StringMap._(jni$_.JObject _$this) implements StringKeyedMap { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/StringMap'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/generics/StringMap'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $StringMap$Type$(); @@ -3714,8 +3716,8 @@ final class $StringMap$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.generics.StringStack` extension type StringStack._(jni$_.JObject _$this) implements MyStack { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/generics/StringStack'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/generics/StringStack'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $StringStack$Type$(); @@ -3755,7 +3757,7 @@ final class $StringStack$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.generics.StringValuedMap` extension type StringValuedMap<$K extends jni$_.JObject?>._( jni$_.JObject _$this) implements MyMap<$K?, jni$_.JString?> { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/generics/StringValuedMap'); /// The type which includes information such as the signature of this class. @@ -3797,7 +3799,7 @@ final class $StringValuedMap$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.interfaces.GenericInterface` extension type GenericInterface<$T extends jni$_.JObject?>._( jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/GenericInterface'); /// The type which includes information such as the signature of this class. @@ -4247,7 +4249,7 @@ final class $GenericInterface$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.interfaces.InheritedFromMyInterface` extension type InheritedFromMyInterface._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/InheritedFromMyInterface'); /// The type which includes information such as the signature of this class. @@ -4537,7 +4539,7 @@ final class $InheritedFromMyInterface$Type$ /// from: `com.github.dart_lang.jnigen.interfaces.InheritedFromMyRunnable` extension type InheritedFromMyRunnable._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/InheritedFromMyRunnable'); /// The type which includes information such as the signature of this class. @@ -4679,7 +4681,7 @@ final class $InheritedFromMyRunnable$Type$ /// from: `com.github.dart_lang.jnigen.interfaces.MyInterface` extension type MyInterface<$T extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/MyInterface'); /// The type which includes information such as the signature of this class. @@ -4968,7 +4970,7 @@ final class $MyInterface$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.interfaces.MyInterfaceConsumer` extension type MyInterfaceConsumer._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/MyInterfaceConsumer'); /// The type which includes information such as the signature of this class. @@ -5127,7 +5129,7 @@ final class $MyInterfaceConsumer$Type$ /// from: `com.github.dart_lang.jnigen.interfaces.MyRunnable` extension type MyRunnable._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/MyRunnable'); /// The type which includes information such as the signature of this class. @@ -5268,7 +5270,7 @@ final class $MyRunnable$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.interfaces.MyRunnableRunner` extension type MyRunnableRunner._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/MyRunnableRunner'); /// The type which includes information such as the signature of this class. @@ -5397,7 +5399,7 @@ final class $MyRunnableRunner$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.interfaces.StringConversionException` extension type StringConversionException._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/StringConversionException'); /// The type which includes information such as the signature of this class. @@ -5443,7 +5445,7 @@ final class $StringConversionException$Type$ /// from: `com.github.dart_lang.jnigen.interfaces.StringConverter` extension type StringConverter._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/StringConverter'); /// The type which includes information such as the signature of this class. @@ -5583,7 +5585,7 @@ final class $StringConverter$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.interfaces.StringConverterConsumer` extension type StringConverterConsumer._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/interfaces/StringConverterConsumer'); /// The type which includes information such as the signature of this class. @@ -5705,7 +5707,7 @@ final class $StringConverterConsumer$Type$ /// from: `com.github.dart_lang.jnigen.inheritance.BaseClass` extension type BaseClass<$T extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/inheritance/BaseClass'); /// The type which includes information such as the signature of this class. @@ -5774,7 +5776,7 @@ final class $BaseClass$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.inheritance.BaseGenericInterface` extension type BaseGenericInterface<$T extends jni$_.JObject?>._( jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/inheritance/BaseGenericInterface'); /// The type which includes information such as the signature of this class. @@ -5915,7 +5917,7 @@ final class $BaseGenericInterface$Type$ /// from: `com.github.dart_lang.jnigen.inheritance.BaseInterface` extension type BaseInterface._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/inheritance/BaseInterface'); /// The type which includes information such as the signature of this class. @@ -6054,7 +6056,7 @@ final class $BaseInterface$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.inheritance.DerivedInterface` extension type DerivedInterface._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/inheritance/DerivedInterface'); /// The type which includes information such as the signature of this class. @@ -6193,7 +6195,7 @@ final class $DerivedInterface$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.inheritance.GenericDerivedClass` extension type GenericDerivedClass<$T extends jni$_.JObject?>._( jni$_.JObject _$this) implements BaseClass<$T?> { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/inheritance/GenericDerivedClass'); /// The type which includes information such as the signature of this class. @@ -6237,7 +6239,7 @@ final class $GenericDerivedClass$Type$ /// from: `com.github.dart_lang.jnigen.inheritance.SpecificDerivedClass` extension type SpecificDerivedClass._(jni$_.JObject _$this) implements BaseClass { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/inheritance/SpecificDerivedClass'); /// The type which includes information such as the signature of this class. @@ -6312,7 +6314,7 @@ extension type Annotated$Nested< $W extends jni$_.JObject, $V extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/annotations/Annotated$Nested'); /// The type which includes information such as the signature of this class. @@ -6391,7 +6393,7 @@ final class $Annotated$Nested$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.annotations.Annotated` extension type Annotated<$T extends jni$_.JObject?, $U extends jni$_.JObject, $W extends jni$_.JObject>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/annotations/Annotated'); /// The type which includes information such as the signature of this class. @@ -8000,7 +8002,7 @@ final class $Annotated$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.annotations.JsonSerializable$Case` extension type JsonSerializable$Case._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/annotations/JsonSerializable$Case'); /// The type which includes information such as the signature of this class. @@ -8105,7 +8107,7 @@ final class $JsonSerializable$Case$Type$ /// from: `com.github.dart_lang.jnigen.annotations.JsonSerializable` extension type JsonSerializable._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/annotations/JsonSerializable'); /// The type which includes information such as the signature of this class. @@ -8245,7 +8247,7 @@ final class $JsonSerializable$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.annotations.MyDataClass` extension type MyDataClass._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/annotations/MyDataClass'); /// The type which includes information such as the signature of this class. @@ -8286,8 +8288,8 @@ final class $MyDataClass$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.annotations.NotNull` extension type NotNull._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/annotations/NotNull'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/annotations/NotNull'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $NotNull$Type$(); @@ -8381,8 +8383,8 @@ final class $NotNull$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.annotations.Nullable` extension type Nullable._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/annotations/Nullable'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/annotations/Nullable'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $Nullable$Type$(); @@ -8476,7 +8478,7 @@ final class $Nullable$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.regressions.R2250$Child` extension type R2250$Child._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/regressions/R2250$Child'); /// The type which includes information such as the signature of this class. @@ -8614,8 +8616,8 @@ final class $R2250$Child$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.regressions.R2250` extension type R2250<$T extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/regressions/R2250'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/regressions/R2250'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $R2250$Type$(); @@ -8750,7 +8752,7 @@ final class $R2250$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.regressions.R693$Child` extension type R693$Child._(jni$_.JObject _$this) implements R693 { - static final _class = jni$_.JClass.forName( + static jni$_.JClass get _class => jni$_.JClass.forNameCached( r'com/github/dart_lang/jnigen/regressions/R693$Child'); /// The type which includes information such as the signature of this class. @@ -8792,8 +8794,8 @@ final class $R693$Child$Type$ extends jni$_.JType { /// from: `com.github.dart_lang.jnigen.regressions.R693` extension type R693<$T extends jni$_.JObject?>._(jni$_.JObject _$this) implements jni$_.JObject { - static final _class = - jni$_.JClass.forName(r'com/github/dart_lang/jnigen/regressions/R693'); + static jni$_.JClass get _class => jni$_.JClass.forNameCached( + r'com/github/dart_lang/jnigen/regressions/R693'); /// The type which includes information such as the signature of this class. static const jni$_.JType type = $R693$Type$();