Repository navigation
[google_maps_flutter] Adopt Pigeon's Kotlin 'suspend' support - #12980
Conversation
|
The non-Pigeon changes were mostly Gemini-generated, but I reviewed them and they all look reasonable to me. |
There was a problem hiding this comment.
Code Review
This pull request updates the google_maps_flutter_android package to use Pigeon's new 'suspend' support for platform communication, refactoring asynchronous callback-based methods to Kotlin suspend functions and updating the generated Pigeon messages. Feedback on these changes identifies critical issues in ClusterManagersControllerTest and MarkersControllerTest where Mockito verification calls incorrectly use null instead of matchers, which will cause test failures. Additionally, a simplification is suggested in ResultUtils.kt to streamline exception resumption on continuations without requiring unchecked casts.
| Mockito.verify(flutterApi) | ||
| .onClusterTap( | ||
| eq(Convert.clusterToPigeon(clusterManagerId, cluster)), ArgumentMatchers.any()); | ||
| .onClusterTap(eq(Convert.clusterToPigeon(clusterManagerId, cluster)), null); |
There was a problem hiding this comment.
Using null here will cause Mockito to throw an InvalidUseOfMatchersException because you cannot mix matchers (like eq()) with raw values (like null) in a verify call. Additionally, the actual argument passed in production is ResultUtilsKt.emptyContinuation(), which is a non-null object, so verifying with null would fail the test. Use any() instead.
| Mockito.verify(flutterApi) | |
| .onClusterTap( | |
| eq(Convert.clusterToPigeon(clusterManagerId, cluster)), ArgumentMatchers.any()); | |
| .onClusterTap(eq(Convert.clusterToPigeon(clusterManagerId, cluster)), null); | |
| Mockito.verify(flutterApi) | |
| .onClusterTap(eq(Convert.clusterToPigeon(clusterManagerId, cluster)), any()); |
There was a problem hiding this comment.
Using
nullhere will cause Mockito to throw anInvalidUseOfMatchersExceptionbecause you cannot mix matchers (likeeq()) with raw values (likenull) in averifycall.
It doesn't.
Additionally, the actual argument passed in production is
ResultUtilsKt.emptyContinuation(), which is a non-null object, so verifying withnullwould fail the test.
The part about failing is also not correct. The part about passing null to a non-null parameter is correct, and causes a warning in the IDE, but...
Use
any()instead.
... this doesn't actually work. Local Gemini had this explanation in the summary when it made the changes:
Adjusted Mockito.verify calls to pass null for the synthetic Continuation parameter instead of a matcher to avoid Mockito's Kotlin suspend argument count mismatch.
I was curious about that, so I had tried passing any() instead and sure enough:
Invalid use of argument matchers!
2 matchers expected, 3 recorded:
Since the workaround works, and we don't actually care about the continuation since it's a no-op, this seems fine. The real fix is to just convert these test to Kotlin, at which point we won't have this problem in the first place, because this synthetic parameter is a Kotlin/Java compatibility artifact.
reidbaker
left a comment
There was a problem hiding this comment.
Most code looks generated. I spot checked a couple of classes and the changes appear reasonable. changlog looks good.
4156963 to
8b17d92
Compare
|
autosubmit label was removed for flutter/packages/12980, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…er#193507) flutter/packages@ba0364a...3c6ce59 2026-09-29 [email protected] [cupertino_icons] Migrate to `cupertino_ui` (flutter/packages#12649) 2026-09-29 [email protected] Manual roll Flutter from 4fcd90b to c5a061b (222 revisions) (flutter/packages#13060) 2026-09-28 [email protected] Enable Built-in Kotlin in all Flutter Android Plugin Example Apps (flutter/packages#12883) 2026-09-28 [email protected] Enable Built-in Kotlin for `interactive_media_ads` (flutter/packages#12912) 2026-09-28 [email protected] [google_maps_flutter] Adopt Pigeon's Kotlin 'suspend' support (flutter/packages#12980) 2026-09-28 [email protected] [material_ui] Fix floating-point rounding errors for discrete Slider and RangeSlider (flutter/packages#13022) 2026-09-28 [email protected] [google_sign_in] PR 4/4 Convert the Pigeon host API from Objective-C to Swift (flutter/packages#12658) 2026-09-28 [email protected] [google_maps_flutter] Disable flaky web tests blocking latest flutter -> packages roll (flutter/packages#13047) 2026-09-28 [email protected] [material_ui] Add fontFeatures and fontVariations to TextTheme.apply() (flutter/packages#12879) 2026-09-28 [email protected] [in_app_purchase_storekit] Disable flaky tests blocking latest flutter -> packages roll (flutter/packages#13048) 2026-09-28 [email protected] Sync release-material_ui-1.5.0 to main (flutter/packages#13051) 2026-09-28 [email protected] Sync release-go_router-18.0.2 to main (flutter/packages#13050) 2026-09-28 [email protected] [google_fonts] Migrate to material_ui & cupertino_ui (flutter/packages#13006) 2026-09-28 [email protected] [go_router_builder] Reland material_ui migration (flutter/packages#12995) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Converts the Pigeon generation from the older callback system to the new Kotlin
suspendsupport. While this is not any simpler while the code is Java, it has several benefits:pigeonmass updates much simpler, since this is the new default generation mode.suspendstyle.Part of flutter/flutter#192417
Pre-Review Checklist
[shared_preferences]///).Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2