Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jnigen] Enable implementing generic interfaces #1635

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/jnigen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.12.1

- Support implementing generic functions in interfaces.

## 0.12.0

- **Breaking Change**([#1530](https://github.com/dart-lang/native/pull/1530)):
Expand Down
8 changes: 4 additions & 4 deletions pkgs/jnigen/docs/interface_implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Runnable extends JObject {
) { /* ... */ }
}

abstract mixin class $Runnable {
abstract base mixin class $Runnable {
factory $Runnable({
required void Function() run,
bool run$async,
Expand Down Expand Up @@ -87,7 +87,7 @@ implementing the interface in Java instead of using the lambdas:

```java
// Java
public class Printer with Runnable {
public class Printer implements Runnable {
private final String text;

public Printer(String text) {
Expand All @@ -108,7 +108,7 @@ You can do the same in Dart by creating a subclass that implements `$Runnable`:

```dart
// Dart
class Printer with $Runnable {
final class Printer with $Runnable {
final String text;

Printer(this.text);
Expand Down Expand Up @@ -145,7 +145,7 @@ Similarly, when subclassing

```dart
// Dart
class Printer with $Runnable {
final class Printer with $Runnable {
final String text;

Printer(this.text);
Expand Down
28 changes: 14 additions & 14 deletions pkgs/jnigen/example/in_app_java/lib/android_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ class EmojiCompat_CodepointSequenceMatchResult extends _$jni.JObject {
}
}

abstract mixin class $EmojiCompat_CodepointSequenceMatchResult {
abstract base mixin class $EmojiCompat_CodepointSequenceMatchResult {
factory $EmojiCompat_CodepointSequenceMatchResult() =
_$EmojiCompat_CodepointSequenceMatchResult;
}

class _$EmojiCompat_CodepointSequenceMatchResult
implements $EmojiCompat_CodepointSequenceMatchResult {
final class _$EmojiCompat_CodepointSequenceMatchResult
with $EmojiCompat_CodepointSequenceMatchResult {
_$EmojiCompat_CodepointSequenceMatchResult();
}

Expand Down Expand Up @@ -729,7 +729,7 @@ class EmojiCompat_GlyphChecker extends _$jni.JObject {
}
}

abstract mixin class $EmojiCompat_GlyphChecker {
abstract base mixin class $EmojiCompat_GlyphChecker {
factory $EmojiCompat_GlyphChecker({
required bool Function(_$jni.JObject charSequence, int i, int i1, int i2)
hasGlyph,
Expand All @@ -738,7 +738,7 @@ abstract mixin class $EmojiCompat_GlyphChecker {
bool hasGlyph(_$jni.JObject charSequence, int i, int i1, int i2);
}

class _$EmojiCompat_GlyphChecker implements $EmojiCompat_GlyphChecker {
final class _$EmojiCompat_GlyphChecker with $EmojiCompat_GlyphChecker {
_$EmojiCompat_GlyphChecker({
required bool Function(_$jni.JObject charSequence, int i, int i1, int i2)
hasGlyph,
Expand Down Expand Up @@ -972,11 +972,11 @@ class EmojiCompat_LoadStrategy extends _$jni.JObject {
}
}

abstract mixin class $EmojiCompat_LoadStrategy {
abstract base mixin class $EmojiCompat_LoadStrategy {
factory $EmojiCompat_LoadStrategy() = _$EmojiCompat_LoadStrategy;
}

class _$EmojiCompat_LoadStrategy implements $EmojiCompat_LoadStrategy {
final class _$EmojiCompat_LoadStrategy with $EmojiCompat_LoadStrategy {
_$EmojiCompat_LoadStrategy();
}

Expand Down Expand Up @@ -1137,7 +1137,7 @@ class EmojiCompat_MetadataRepoLoader extends _$jni.JObject {
}
}

abstract mixin class $EmojiCompat_MetadataRepoLoader {
abstract base mixin class $EmojiCompat_MetadataRepoLoader {
factory $EmojiCompat_MetadataRepoLoader({
required void Function(
EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback)
Expand All @@ -1149,8 +1149,8 @@ abstract mixin class $EmojiCompat_MetadataRepoLoader {
bool get load$async => false;
}

class _$EmojiCompat_MetadataRepoLoader
implements $EmojiCompat_MetadataRepoLoader {
final class _$EmojiCompat_MetadataRepoLoader
with $EmojiCompat_MetadataRepoLoader {
_$EmojiCompat_MetadataRepoLoader({
required void Function(
EmojiCompat_MetadataRepoLoaderCallback metadataRepoLoaderCallback)
Expand Down Expand Up @@ -1393,11 +1393,11 @@ class EmojiCompat_ReplaceStrategy extends _$jni.JObject {
}
}

abstract mixin class $EmojiCompat_ReplaceStrategy {
abstract base mixin class $EmojiCompat_ReplaceStrategy {
factory $EmojiCompat_ReplaceStrategy() = _$EmojiCompat_ReplaceStrategy;
}

class _$EmojiCompat_ReplaceStrategy implements $EmojiCompat_ReplaceStrategy {
final class _$EmojiCompat_ReplaceStrategy with $EmojiCompat_ReplaceStrategy {
_$EmojiCompat_ReplaceStrategy();
}

Expand Down Expand Up @@ -1558,7 +1558,7 @@ class EmojiCompat_SpanFactory extends _$jni.JObject {
}
}

abstract mixin class $EmojiCompat_SpanFactory {
abstract base mixin class $EmojiCompat_SpanFactory {
factory $EmojiCompat_SpanFactory({
required _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer)
createSpan,
Expand All @@ -1567,7 +1567,7 @@ abstract mixin class $EmojiCompat_SpanFactory {
_$jni.JObject createSpan(_$jni.JObject typefaceEmojiRasterizer);
}

class _$EmojiCompat_SpanFactory implements $EmojiCompat_SpanFactory {
final class _$EmojiCompat_SpanFactory with $EmojiCompat_SpanFactory {
_$EmojiCompat_SpanFactory({
required _$jni.JObject Function(_$jni.JObject typefaceEmojiRasterizer)
createSpan,
Expand Down
Loading
Loading