Skip to content

Commit 290f21a

Browse files
[jnigen] Enable implementing generic interfaces (#1635)
1 parent f723a58 commit 290f21a

File tree

16 files changed

+939
-287
lines changed

16 files changed

+939
-287
lines changed

pkgs/jnigen/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.12.1
2+
3+
- Support implementing generic functions in interfaces.
4+
15
## 0.12.0
26

37
- **Breaking Change**([#1530](https://github.com/dart-lang/native/pull/1530)):

pkgs/jnigen/docs/interface_implementation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Runnable extends JObject {
3636
) { /* ... */ }
3737
}
3838
39-
abstract mixin class $Runnable {
39+
abstract base mixin class $Runnable {
4040
factory $Runnable({
4141
required void Function() run,
4242
bool run$async,
@@ -87,7 +87,7 @@ implementing the interface in Java instead of using the lambdas:
8787
8888
```java
8989
// Java
90-
public class Printer with Runnable {
90+
public class Printer implements Runnable {
9191
private final String text;
9292
9393
public Printer(String text) {
@@ -108,7 +108,7 @@ You can do the same in Dart by creating a subclass that implements `$Runnable`:
108108
109109
```dart
110110
// Dart
111-
class Printer with $Runnable {
111+
final class Printer with $Runnable {
112112
final String text;
113113
114114
Printer(this.text);
@@ -145,7 +145,7 @@ Similarly, when subclassing
145145
146146
```dart
147147
// Dart
148-
class Printer with $Runnable {
148+
final class Printer with $Runnable {
149149
final String text;
150150
151151
Printer(this.text);

pkgs/jnigen/example/in_app_java/lib/android_utils.dart

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ class EmojiCompat_CodepointSequenceMatchResult extends _$jni.JObject {
125125
}
126126
}
127127

128-
abstract mixin class $EmojiCompat_CodepointSequenceMatchResult {
128+
abstract base mixin class $EmojiCompat_CodepointSequenceMatchResult {
129129
factory $EmojiCompat_CodepointSequenceMatchResult() =
130130
_$EmojiCompat_CodepointSequenceMatchResult;
131131
}
132132

133-
class _$EmojiCompat_CodepointSequenceMatchResult
134-
implements $EmojiCompat_CodepointSequenceMatchResult {
133+
final class _$EmojiCompat_CodepointSequenceMatchResult
134+
with $EmojiCompat_CodepointSequenceMatchResult {
135135
_$EmojiCompat_CodepointSequenceMatchResult();
136136
}
137137

@@ -729,7 +729,7 @@ class EmojiCompat_GlyphChecker extends _$jni.JObject {
729729
}
730730
}
731731

732-
abstract mixin class $EmojiCompat_GlyphChecker {
732+
abstract base mixin class $EmojiCompat_GlyphChecker {
733733
factory $EmojiCompat_GlyphChecker({
734734
required bool Function(_$jni.JObject charSequence, int i, int i1, int i2)
735735
hasGlyph,
@@ -738,7 +738,7 @@ abstract mixin class $EmojiCompat_GlyphChecker {
738738
bool hasGlyph(_$jni.JObject charSequence, int i, int i1, int i2);
739739
}
740740

741-
class _$EmojiCompat_GlyphChecker implements $EmojiCompat_GlyphChecker {
741+
final class _$EmojiCompat_GlyphChecker with $EmojiCompat_GlyphChecker {
742742
_$EmojiCompat_GlyphChecker({
743743
required bool Function(_$jni.JObject charSequence, int i, int i1, int i2)
744744
hasGlyph,
@@ -972,11 +972,11 @@ class EmojiCompat_LoadStrategy extends _$jni.JObject {
972972
}
973973
}
974974

975-
abstract mixin class $EmojiCompat_LoadStrategy {
975+
abstract base mixin class $EmojiCompat_LoadStrategy {
976976
factory $EmojiCompat_LoadStrategy() = _$EmojiCompat_LoadStrategy;
977977
}
978978

979-
class _$EmojiCompat_LoadStrategy implements $EmojiCompat_LoadStrategy {
979+
final class _$EmojiCompat_LoadStrategy with $EmojiCompat_LoadStrategy {
980980
_$EmojiCompat_LoadStrategy();
981981
}
982982

@@ -1137,7 +1137,7 @@ class EmojiCompat_MetadataRepoLoader extends _$jni.JObject {
11371137
}
11381138
}
11391139

1140-
abstract mixin class $EmojiCompat_MetadataRepoLoader {
1140+
abstract base mixin class $EmojiCompat_MetadataRepoLoader {
11411141
factory $EmojiCompat_MetadataRepoLoader({
11421142
required void Function(
11431143
EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback)
@@ -1149,8 +1149,8 @@ abstract mixin class $EmojiCompat_MetadataRepoLoader {
11491149
bool get load$async => false;
11501150
}
11511151

1152-
class _$EmojiCompat_MetadataRepoLoader
1153-
implements $EmojiCompat_MetadataRepoLoader {
1152+
final class _$EmojiCompat_MetadataRepoLoader
1153+
with $EmojiCompat_MetadataRepoLoader {
11541154
_$EmojiCompat_MetadataRepoLoader({
11551155
required void Function(
11561156
EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback)
@@ -1393,11 +1393,11 @@ class EmojiCompat_ReplaceStrategy extends _$jni.JObject {
13931393
}
13941394
}
13951395

1396-
abstract mixin class $EmojiCompat_ReplaceStrategy {
1396+
abstract base mixin class $EmojiCompat_ReplaceStrategy {
13971397
factory $EmojiCompat_ReplaceStrategy() = _$EmojiCompat_ReplaceStrategy;
13981398
}
13991399

1400-
class _$EmojiCompat_ReplaceStrategy implements $EmojiCompat_ReplaceStrategy {
1400+
final class _$EmojiCompat_ReplaceStrategy with $EmojiCompat_ReplaceStrategy {
14011401
_$EmojiCompat_ReplaceStrategy();
14021402
}
14031403

@@ -1558,7 +1558,7 @@ class EmojiCompat_SpanFactory extends _$jni.JObject {
15581558
}
15591559
}
15601560

1561-
abstract mixin class $EmojiCompat_SpanFactory {
1561+
abstract base mixin class $EmojiCompat_SpanFactory {
15621562
factory $EmojiCompat_SpanFactory({
15631563
required _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer)
15641564
createSpan,
@@ -1567,7 +1567,7 @@ abstract mixin class $EmojiCompat_SpanFactory {
15671567
_$jni.JObject createSpan(_$jni.JObject typefaceEmojiRasterizer);
15681568
}
15691569

1570-
class _$EmojiCompat_SpanFactory implements $EmojiCompat_SpanFactory {
1570+
final class _$EmojiCompat_SpanFactory with $EmojiCompat_SpanFactory {
15711571
_$EmojiCompat_SpanFactory({
15721572
required _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer)
15731573
createSpan,

0 commit comments

Comments
 (0)