Skip to content

Commit 47cb4d9

Browse files
authored
Merge pull request #12 from kdroidFilter/feat/bytearray-everywhere
feat: Support ByteArray in callbacks, DC fields, and collections
2 parents 42f4e8b + 29570c2 commit 47cb4d9

8 files changed

Lines changed: 597 additions & 30 deletions

File tree

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ No JNI. No annotations. No boilerplate. Just write Kotlin/Native and use it from
121121

122122
## What's supported
123123

124-
### Types — test coverage (930+ end-to-end FFM tests)
124+
### Types — test coverage (960+ end-to-end FFM tests)
125125

126-
Every test compiles Kotlin/Native → `libcalculator.so` (200+ exported symbols) → loads via FFM `MethodHandle` → verifies on JVM. Zero mocks — all 930+ tests cross the real native boundary. Includes 25 load tests (500K+ FFM calls), concurrent stress tests (10 threads), 110+ suspend function tests with cancellation (incl. ByteArray, DataClass, List, Set, Map), and 50+ Flow tests (including `Flow<DataClass>`).
126+
Every test compiles Kotlin/Native → `libcalculator.so` (200+ exported symbols) → loads via FFM `MethodHandle` → verifies on JVM. Zero mocks — all 960+ tests cross the real native boundary. Includes 25 load tests (500K+ FFM calls), concurrent stress tests (10 threads), 110+ suspend function tests with cancellation (incl. ByteArray, DataClass, List, Set, Map), and 50+ Flow tests (including `Flow<DataClass>`).
127127

128128
| Feature | As param | As return | As property | CB param | CB return | Notes |
129129
|---------|----------|-----------|-------------|----------|-----------|-------|
@@ -401,19 +401,7 @@ Measured on Intel Core i5-14600 (20 cores), 45 GB RAM, Ubuntu 25.10, JDK 25 (Gra
401401
| Unsupported | Reason | Alternative |
402402
|-------------|--------|-------------|
403403
| Lambda as return type | Callback supported as param only | Return a class with methods instead |
404-
| `ByteArray` as callback param | Buffer lifecycle across callback boundary | Pass as `String` (Base64) or use non-callback API |
405404

406-
### Collection limitations
407-
408-
| Unsupported | Reason | Alternative |
409-
|-------------|--------|-------------|
410-
| `ByteArray` in `List` / `Set` / `Map` | Nested buffer management | Use `List<String>` with encoding |
411-
412-
### Data class field limitations
413-
414-
| Unsupported | Reason | Alternative |
415-
|-------------|--------|-------------|
416-
| `ByteArray` field | Buffer out-param not wired for DC fields | Use `String` (Base64) or separate method |
417405

418406
## Configuration reference
419407

@@ -577,7 +565,7 @@ The repository includes two complete examples in [`examples/`](examples/):
577565

578566
| Example | Description |
579567
|---------|-------------|
580-
| [`calculator/`](examples/calculator/) | Stateful Calculator class with 930+ end-to-end tests: all types, callbacks, collections (incl. `List<DataClass>` params), collection properties, data class collection fields, suspend (incl. DataClass, List, Set, Map), Flow (incl. DataClass), nested classes, concurrency |
568+
| [`calculator/`](examples/calculator/) | Stateful Calculator class with 960+ end-to-end tests: all types, callbacks, collections (incl. `List<DataClass>` params), collection properties, data class collection fields, suspend (incl. DataClass, List, Set, Map), Flow (incl. DataClass), nested classes, concurrency |
581569
| [`systeminfo/`](examples/systeminfo/) | Linux system info (`/proc`, POSIX, `gethostname`) + native notifications via `libnotify` cinterop, with Compose Desktop UI |
582570
| [`benchmark/`](examples/benchmark/) | Performance benchmarks: native vs JVM (fibonacci, pi, sort, string, allocation, concurrent) |
583571

@@ -586,7 +574,7 @@ Run them:
586574
```bash
587575
./gradlew :examples:calculator:run
588576
./gradlew :examples:systeminfo:run
589-
./gradlew :examples:calculator:jvmTest # 930+ end-to-end FFM tests
577+
./gradlew :examples:calculator:jvmTest # 960+ end-to-end FFM tests
590578
./gradlew :examples:benchmark:jvmTest # Performance benchmarks (native vs JVM)
591579
```
592580

0 commit comments

Comments
 (0)