Skip to content

Commit

Permalink
Separate java primitive arrays and implement Iterable (#1798)
Browse files Browse the repository at this point in the history
It was not possible to implement Dart's `Iterable` in a generic way for both primitive arrays and object arrays. Now the primitive arrays are separate and they all implement `Iterable`.
  • Loading branch information
HosseinYousefi authored Dec 11, 2024
1 parent cb47700 commit 2cecc88
Show file tree
Hide file tree
Showing 17 changed files with 1,192 additions and 330 deletions.
9 changes: 9 additions & 0 deletions pkgs/jni/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## 0.13.0-wip

- **Breaking Change**: Separated primitive arrays from object arrays.
Previously, a primitive array like an array of bytes was typed
`JArray<jbyte>`. Now `JArray<T>` only accepts `JObject`s as types and
primitive arrays like arrays of bytes have their own types such as
`JByteArray`.

This enables all arrays to implement `Iterable` which makes it possible to use
them in a for-loop or use methods such as `map` on them.

- Added nullable type classes for all Java objects.

## 0.12.2
Expand Down
1 change: 0 additions & 1 deletion pkgs/jni/lib/_internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export 'src/method_invocation.dart';
export 'src/types.dart'
show
JAccessible,
JArrayElementType,
JCallable,
JConstructable,
JObjType,
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jni/lib/jni.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ library;
export 'package:ffi/ffi.dart' show Arena, using;

export 'src/errors.dart';
export 'src/jarray.dart';
export 'src/jimplementer.dart';
export 'src/jni.dart' hide ProtectedJniExtensions, StringMethodsForJni;
export 'src/jobject.dart';
Expand All @@ -75,7 +76,6 @@ export 'src/third_party/generated_bindings.dart'
export 'src/types.dart'
hide
JAccessible,
JArrayElementType,
JCallable,
JConstructable,
JObjType,
Expand Down
Loading

0 comments on commit 2cecc88

Please sign in to comment.