Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
5 changes: 5 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 26.1.5

* [kotlin] Fixes a "bridge method" warning that occurs when a class uses `*PigeonEventChannelWrapper` as a
supertype without implementing all of its methods.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "without implementing all of its methods" part right? The video_player code was implementing both of these methods.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am open to better wording but the class that implemented all the methods was an implementation of *EventsStreamHandler not the interface *PigeonEventChannelWrapper.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. Since we don't expect Pigeon users to directly subclass the Wrapper class, let's just say "... warning when implementing an event stream handler."


## 26.1.4

* [swift][kotlin] Fixes crash that occurs when an object that is removed from the instance manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,8 @@ abstract class StreamEventsStreamHandler :
.setStreamHandler(internalStreamHandler)
}
}
// Implement methods from EventChannelMessagesPigeonEventChannelWrapper
override open abstract fun onListen(p0: Any?, sink: PigeonEventSink<PlatformEvent>)

override open abstract fun onCancel(p0: Any?)
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class EventListener : StreamEventsStreamHandler() {
eventSink = sink
}

override fun onCancel(p0: Any?) {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan-g @tarrinneal pigeon_example_app failed to build without this change. Does that mean this is a breaking change? If so, does that change what solution you prefer here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, looking again at the top-level interface class it has default implementations. I really thought it was just abstract declarations.

So your previous version of the PR was the behavior-preserving one, and I was just confused. Sorry about that!


fun onIntEvent(event: Long) {
eventSink?.success(IntEvent(data = event))
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/src/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'generator.dart';
/// The current version of pigeon.
///
/// This must match the version in pubspec.yaml.
const String pigeonVersion = '26.1.4';
const String pigeonVersion = '26.1.5';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
4 changes: 4 additions & 0 deletions packages/pigeon/lib/src/kotlin/kotlin_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,10 @@ if (wrapped == null) {
EventChannel(messenger, channelName, ${generatorOptions.fileSpecificClassNameComponent}$_pigeonMethodChannelCodec).setStreamHandler(internalStreamHandler)
}
}
// Implement methods from ${generatorOptions.fileSpecificClassNameComponent}PigeonEventChannelWrapper
override open abstract fun onListen(p0: Any?, sink: PigeonEventSink<${_kotlinTypeForDartType(func.returnType)}>)

override open abstract fun onCancel(p0: Any?)
}
''');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ abstract class StreamIntsStreamHandler : EventChannelTestsPigeonEventChannelWrap
.setStreamHandler(internalStreamHandler)
}
}
// Implement methods from EventChannelTestsPigeonEventChannelWrapper
override open abstract fun onListen(p0: Any?, sink: PigeonEventSink<Long>)

override open abstract fun onCancel(p0: Any?)
}

abstract class StreamEventsStreamHandler :
Expand All @@ -595,6 +599,10 @@ abstract class StreamEventsStreamHandler :
.setStreamHandler(internalStreamHandler)
}
}
// Implement methods from EventChannelTestsPigeonEventChannelWrapper
override open abstract fun onListen(p0: Any?, sink: PigeonEventSink<PlatformEvent>)

override open abstract fun onCancel(p0: Any?)
}

abstract class StreamConsistentNumbersStreamHandler :
Expand All @@ -615,4 +623,8 @@ abstract class StreamConsistentNumbersStreamHandler :
.setStreamHandler(internalStreamHandler)
}
}
// Implement methods from EventChannelTestsPigeonEventChannelWrapper
override open abstract fun onListen(p0: Any?, sink: PigeonEventSink<Long>)

override open abstract fun onCancel(p0: Any?)
}
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
version: 26.1.4 # This must match the version in lib/src/generator_tools.dart
version: 26.1.5 # This must match the version in lib/src/generator_tools.dart

environment:
sdk: ^3.9.0
Expand Down