Skip to content

Commit 8aa3f53

Browse files
[jnigen] Fix generic subinterfaces not specifying full type params (#2255)
Classes that inherited a generic without specifying all type parameters were not generated. Filling the ones not specified with `JObject?`.
1 parent 33a0cdd commit 8aa3f53

File tree

6 files changed

+526
-5
lines changed

6 files changed

+526
-5
lines changed

pkgs/jnigen/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
instead of `build.gradle`.
1010
- Fixed a bug where Kotlin suspend functions that returned nullable values were
1111
generated incorrectly.
12+
- Fixed a [bug](https://github.com/dart-lang/native/issues/2250) where classes
13+
that inherited a generic without specifying all type parameters were not
14+
generated.
1215

1316
## 0.14.1
1417

pkgs/jnigen/lib/src/bindings/linker.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ class _TypeMover extends TypeVisitor<void> {
423423
final index = fromType.classDecl.allTypeParams
424424
.indexWhere((typeParam) => typeParam.name == typeVar.name);
425425
if (index != -1) {
426+
if (index >= fromType.params.length) {
427+
return DeclaredType.object.clone();
428+
}
426429
return fromType.params[index].clone(until: GenerationStage.linker);
427430
}
428431
}

0 commit comments

Comments
 (0)