Skip to content

Conversation

@yaakovschectman
Copy link
Contributor

Utilize static typing for pigeon message objects for Marker and Circle in google_maps_flutter_android.

Draft for now to run tests.

List which issues are fixed by this PR. You must list at least one issue.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@yaakovschectman yaakovschectman marked this pull request as ready for review August 7, 2024 21:42
@yaakovschectman yaakovschectman requested review from gmackall, jokerttu, reidbaker and stuartmorgan-g and removed request for reidbaker and stuartmorgan-g August 7, 2024 21:42
@yaakovschectman yaakovschectman self-assigned this Aug 7, 2024
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

A few initial notes.

I'll update and land #7207 tomorrow now that the other PRs it was going to collide with have landed; that will make the diffs here (and in follow-up object conversion PRs) much easier to review because you'll be able to actually replace the JSON codepaths instead of duplicating them, so it will be very easy to see what's the same and what's changing.

this.visible = true,
this.strokeWidth = 10,
this.zIndex = 0.0,
this.radius = 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional: you can generally just make everything required in a Pigeon definition for a class like this that corresponds pretty directly to an existing class, because in practice there are usual no calls that don't provide every field due to the nature of how we use them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least one case where they were not all provided is the Java unit tests prior to this PR. Technically there was only one field at that time, the json, but that json field only had the fields specified that were actually tested by the unit tests. If any of the non-null fields are not provided to the Builder nested class, build will throw an exception. I was hoping that providing default values would mean that the Builder would use them and not require them all to be specified, avoiding this problem, but it appears that the generated Java code does not use the defaults anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, default values haven't been implemented for any of the just languages. Usually for unit tests we just make a helper that builds the object with mostly default values.

Copy link
Contributor

Choose a reason for hiding this comment

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

@yaakovschectman did you and stuart agree not to make these values required?

this.rotation = 0.0,
this.visible = true,
this.zIndex = 0.0,
this.clusterManagerId,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same note here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a note here? (my guess is no since id is a string but thought it was worth asking.

@stuartmorgan-g
Copy link
Collaborator

Okay, #7207 has landed, so you can merge in main here, and then delete the JSON codepaths for anything you've converted. And for future PRs you'll be able to alter then in place instead of duplicating first.

@reidbaker
Copy link
Contributor

I feel like I should have known that but thanks for the explanation. Ignore my comment then.

yaakovschectman and others added 4 commits August 9, 2024 16:18
…id/src/main/java/io/flutter/plugins/googlemaps/Convert.java

Co-authored-by: Reid Baker <hamilton.reid.baker@gmail.com>
@stuartmorgan-g
Copy link
Collaborator

Is this ready for me to re-review, or still in progress?

@yaakovschectman
Copy link
Contributor Author

yaakovschectman commented Aug 12, 2024 via email

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

There's one unaddressed comment from the last round, but otherwise LGTM!


private void addJsonMarker(Map<String, ?> marker) {
private void addMarker(Messages.PlatformMarker marker) {
if (marker == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see any changes or response to this.

this.visible = true,
this.strokeWidth = 10,
this.zIndex = 0.0,
this.radius = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

@yaakovschectman did you and stuart agree not to make these values required?

final bool consumeTapEvents;
final bool draggable;
final bool flat;
final Object icon;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still missing a note and TODO

this.rotation = 0.0,
this.visible = true,
this.zIndex = 0.0,
this.clusterManagerId,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a note here? (my guess is no since id is a string but thought it was worth asking.

@yaakovschectman
Copy link
Contributor Author

@reidbaker If I am interpreting correctly, Stuart stated his note on whether the fields are required was optional, and approved the PR. I do not see why we would need a note for clusterManagerId, or what that note would be.

@stuartmorgan-g
Copy link
Collaborator

This is still missing a note and TODO

Oops, I missed that in my re-review. Thanks for the catch!

If I am interpreting correctly, Stuart stated his note on whether the fields are required was optional, and approved the PR.

Yes, I'm fine with there being default values. I have a very slight preference for required since it means we can't forget to carry values over, but the real solution to that is unit tests anyway.

@stuartmorgan-g
Copy link
Collaborator

@reidbaker For the ID, are you asking because the Dart code uses specialized wrapper objects for each ID type? If so, I've been ignoring that at the Pigeon level since I think it's more busywork than benefit at the level of a transfer protocol, and just using strings directly. The objects have more value at the client-code level where things are being stored, passed around, etc. and could plausibly be passed back to the wrong APIs later by buggy client code.

@reidbaker
Copy link
Contributor

@reidbaker For the ID, are you asking because the Dart code uses specialized wrapper objects for each ID type? If so, I've been ignoring that at the Pigeon level since I think it's more busywork than benefit at the level of a transfer protocol, and just using strings directly. The objects have more value at the client-code level where things are being stored, passed around, etc. and could plausibly be passed back to the wrong APIs later by buggy client code.

I was asking because you had a comment saying "same here" and I was trying to figure out what comment applied.

@stuartmorgan-g
Copy link
Collaborator

@reidbaker For the ID, are you asking because the Dart code uses specialized wrapper objects for each ID type? If so, I've been ignoring that at the Pigeon level since I think it's more busywork than benefit at the level of a transfer protocol, and just using strings directly. The objects have more value at the client-code level where things are being stored, passed around, etc. and could plausibly be passed back to the wrong APIs later by buggy client code.

I was asking because you had a comment saying "same here" and I was trying to figure out what comment applied.

Oh, I see it inline now. I still don't understand how GitHub displays responses sometimes 😐

I should have been clearer about what the "same" was; I meant it to refer to not needing default values for all the fields in that object, not about the comment. Sorry for the confusion!

@yaakovschectman yaakovschectman merged commit cec00a5 into flutter:main Aug 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 15, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 15, 2024
flutter/packages@e4f2247...86d15a6

2024-08-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.26.0 to 3.26.2 (flutter/packages#7417)
2024-08-15 tarrinneal@gmail.com [shared_preferences] remove testing section from README (flutter/packages#7410)
2024-08-13 nathan.wilson1232@gmail.com Fix breakages introduced by `SplashFactory` (flutter/packages#6952)
2024-08-13 engine-flutter-autoroll@skia.org Manual roll Flutter from 2afc452 to cc13cd1 (6 revisions) (flutter/packages#7404)
2024-08-13 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_android] Convert Circle and Marker to Pigeon (flutter/packages#7326)
2024-08-13 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#7379)
2024-08-13 49699333+dependabot[bot]@users.noreply.github.com [file_selector]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/file_selector/file_selector_android/android (flutter/packages#7381)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com 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
DBowen33 pushed a commit to DBowen33/flutter that referenced this pull request Aug 16, 2024
flutter/packages@e4f2247...86d15a6

2024-08-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.26.0 to 3.26.2 (flutter/packages#7417)
2024-08-15 tarrinneal@gmail.com [shared_preferences] remove testing section from README (flutter/packages#7410)
2024-08-13 nathan.wilson1232@gmail.com Fix breakages introduced by `SplashFactory` (flutter/packages#6952)
2024-08-13 engine-flutter-autoroll@skia.org Manual roll Flutter from 2afc452 to cc13cd1 (6 revisions) (flutter/packages#7404)
2024-08-13 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_android] Convert Circle and Marker to Pigeon (flutter/packages#7326)
2024-08-13 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#7379)
2024-08-13 49699333+dependabot[bot]@users.noreply.github.com [file_selector]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/file_selector/file_selector_android/android (flutter/packages#7381)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com 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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@e4f2247...86d15a6

2024-08-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.26.0 to 3.26.2 (flutter/packages#7417)
2024-08-15 tarrinneal@gmail.com [shared_preferences] remove testing section from README (flutter/packages#7410)
2024-08-13 nathan.wilson1232@gmail.com Fix breakages introduced by `SplashFactory` (flutter/packages#6952)
2024-08-13 engine-flutter-autoroll@skia.org Manual roll Flutter from 2afc452 to cc13cd1 (6 revisions) (flutter/packages#7404)
2024-08-13 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_android] Convert Circle and Marker to Pigeon (flutter/packages#7326)
2024-08-13 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#7379)
2024-08-13 49699333+dependabot[bot]@users.noreply.github.com [file_selector]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/file_selector/file_selector_android/android (flutter/packages#7381)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants