Skip to content

Commit 2cecc88

Browse files
Separate java primitive arrays and implement Iterable (#1798)
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`.
1 parent cb47700 commit 2cecc88

File tree

17 files changed

+1192
-330
lines changed

17 files changed

+1192
-330
lines changed

pkgs/jni/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
## 0.13.0-wip
22

3+
- **Breaking Change**: Separated primitive arrays from object arrays.
4+
Previously, a primitive array like an array of bytes was typed
5+
`JArray<jbyte>`. Now `JArray<T>` only accepts `JObject`s as types and
6+
primitive arrays like arrays of bytes have their own types such as
7+
`JByteArray`.
8+
9+
This enables all arrays to implement `Iterable` which makes it possible to use
10+
them in a for-loop or use methods such as `map` on them.
11+
312
- Added nullable type classes for all Java objects.
413

514
## 0.12.2

pkgs/jni/lib/_internal.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export 'src/method_invocation.dart';
3434
export 'src/types.dart'
3535
show
3636
JAccessible,
37-
JArrayElementType,
3837
JCallable,
3938
JConstructable,
4039
JObjType,

pkgs/jni/lib/jni.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ library;
6363
export 'package:ffi/ffi.dart' show Arena, using;
6464

6565
export 'src/errors.dart';
66+
export 'src/jarray.dart';
6667
export 'src/jimplementer.dart';
6768
export 'src/jni.dart' hide ProtectedJniExtensions, StringMethodsForJni;
6869
export 'src/jobject.dart';
@@ -75,7 +76,6 @@ export 'src/third_party/generated_bindings.dart'
7576
export 'src/types.dart'
7677
hide
7778
JAccessible,
78-
JArrayElementType,
7979
JCallable,
8080
JConstructable,
8181
JObjType,

0 commit comments

Comments
 (0)