-
Notifications
You must be signed in to change notification settings - Fork 120
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
Make DirectionsWaypoint#name
@Nullable
as @NonNull
breaks backwards compatibility
#1386
Conversation
@Guardiola31337 do you know how was that old response created? Directions API documents waypoint |
For reference,
and Nav SDK version Sharing the route internally as I'm hitting cc @mapbox/navnative @mapbox/navigation-api @browndp08 @danpat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now (until we learn more), let's revert this since it was only part of the v6.4
pre-releases. We can always re-adjust again in the future.
@@ -34,7 +34,7 @@ public static Builder builder() { | |||
* @return string with the name of the way the coordinate snapped to | |||
* @since 1.0.0 | |||
*/ | |||
@NonNull | |||
@Nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the builder method annotation as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, great catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh wait, the builder is going to be @NonNull
always, isn't it? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the parameter nullability:
[at]NonNull
public abstract Builder name([at]Nullable String name);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we want to keep it as non-nullable in the Builder
, I mean, normally if you want to set a name
is going to be non-null (unless that property could be reset or something around those lines). Is the Builder
used automatically behind the scenes when parsing? I believe not, because that'd crash when I tested it. Noting that in this particular case, the property
was missing i.e. it wasn't null
. If we're going to get null
by any chance, yeah, the builder should be @Nullable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Builder used automatically behind the scenes when parsing?
It's not, but the builder parameter nullability should always reflect the property nullability.
ce17fcf
to
5398722
Compare
This PR makes
DirectionsWaypoint#name
@Nullable
as@NonNull
breaks backwards compatibility.Regression from #1360 as older
DirectionsResponse
s may not include thename
property which causesDirectionsResponse.fromJson
to crash 👀