- Added nullable type classes for all Java objects.
- Added
JniUtils.fromReferenceAddress
which helps with sendingJObject
s through method channels. You can send the address of the pointer aslong
and reconstruct the class using the helper method. - Fixed a bug where it would be possible for a type class inference to fail.
- Return 'null' when calling
toString
on a null object.
- Breaking Change: Renamed
castTo
toas
. - Renamed library
internal_helpers_for_jnigen
to_internal
. - Using 16KB page size to support Android 15.
- Added
JImplementer
which enables building an object that implements multiple Java interfaces.
- Breaking Change Removed
Jni.accessors
. - Made most
Jni.env
methods into leaf functions to speed up their execution. - Removed the dependency on
kotlin_gradle_plugin
.
- Fixed an issue with
JObject.castTo
where the type checking could fail in debug mode. - Used
package:dart_flutter_team_lints
.
- Added lifetime event handling for the thread-local JNI env. Now
jvm.DetachNativeThread
is called when the thread detaches as recommended here. - Removed
JValueChar.fromString
constructor.
- Bumped
minSdk
to 21.
- Fixed compilation on macOS for consumers that don't use JNI on macOS (which is still not supported) (#1122).
- Breaking Change
(#1004): Changed the return
type
operator []
ofJArray<jchar>
toint
instead ofString
. Similarly, change the argument type ofoperator []=
to acceptint
. - Added
getRange
method toJArray
of primitive types that returns aTypedData
list depending on the kind of the array. - Improved the performance of
JArray
'ssetRange
andoperator []=
.
-
Breaking Change (#981):
-
JObject.reference
now returns aJReference
instead ofPointer<Void>
. -
.fromRef
constructors are now called.fromReference
and they take aJReference
instead ofPointer<Void>
. -
JObject
reflective field retrieving and method calling methods are removed. UseJClass
API instead. -
The following
Jni.accessors
methods have been removed:getClassOf
getMethodIDOf
getStaticMethodIDOf
getFieldIDOf
getStaticFieldIDOf
newObjectWithArgs
callMethodWithArgs
callStaticMethodWithArgs
Instead use the
JClass
API. -
Jni.findJClass
is replaced withJClass.forName(String name)
-
JClass
has been refactored. Instead of directly calling methods, getting and setting fields, useJClass.instanceMethodId
,JClass.staticMethodId
,JClass.constructorId
,JClass.instanceFieldId
, andJClass.staticFieldId
to first get access to the member. -
Renamed
JObject.getClass()
toJObject.jClass
. -
Removed
Jni.deleteAllRefs
.
-
-
Breaking Change (#548): Converted various
Exception
s intoError
s:UseAfterReleaseException
->UseAfterReleaseError
DoubleReleaseException
->DoubleReleaseError
SpawnException
->JniError
(It's now asealed class
)JNullException
->JNullError
InvalidCallTypeException
->InvalidCallTypeError
HelperNotFoundException
->HelperNotFoundError
JvmExistsException
->JniVmExistsError
NoJvmInstanceException
->NoJvmInstanceError
-
Breaking Change: Removed
InvalidJStringException
. -
Breaking Change:
JType
is nowsealed
. -
Breaking Change: Primitive types and their type classes are now
final
. -
Breaking Change:
JArray.filled
now uses the generated type class of thefill
object and not its Java runtime type. -
JObject
s now check the types usinginstanceof
in debug mode when usingcastTo
. -
Breaking Change:
Jni.initDLApi()
is removed. -
Added the ability to share
JObject
s across isolates.// This now works. final foo = 'foo'.toJString(); Isolate.run(() { // `foo` is usable from another isolate. print(foo); });
- Fixed a bug where
get(Static)MethodID
andget(Static)FieldID
could access null and throw.
- Fixed a bug where reading non-null terminated strings would overflow.
- Use
package:dart_flutter_team_lints
.
- Removed macOS Flutter plugin until package:jni supports it (#780).
- Breaking Change (#563):
Added
JBuffer
andJByteBuffer
classes as default classes forjava.nio.Buffer
andjava.nio.ByteBuffer
respectively. - Breaking Change: Made the type classes
final
. - Fixed a bug where
addAll
,removeAll
andretainAll
inJSet
would run their respective operation twice. - Fixed a bug where
JList.insertAll
would not throw the potentially thrown Java exception.
- Depend on the stable version of Dart 3.1.
- Breaking Change (#707):
Renamed
delete*
torelease*
. - Added
PortProxy
and related methods used for interface implementation. - Added the missing binding for
java.lang.Character
.
- Breaking Change (#711):
Java primitive types are now all lowercase like
jint
,jshort
, ... - The bindings for
java.util.Set
,java.util.Map
,java.util.List
and the numeric types likejava.lang.Integer
,java.lang.Boolean
, ... are now included inpackage:jni
.
- Type classes now have
superCount
andsuperType
getters used for type inference.
- Added
PortContinuation
used forsuspend fun
in Kotlin. dartjni
now depends ondart_api_dl.h
.
- Added
.clang-format
to pub.
- Added array support
- Added generic support
JniX
turned intoJX
for a more terse code.
- Windows support for running tests and examples on development machines.
- Initial version: Android and Linux support, JObject API