Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Improved CustomGeometrySource constructor typing #13200

Merged
merged 1 commit into from
Nov 2, 2018

Conversation

LukasPaczos
Copy link
Contributor

Closes #12009.

@LukasPaczos LukasPaczos added Android Mapbox Maps SDK for Android SEMVER-MAJOR Requires a major release according to Semantic Versioning rules labels Oct 25, 2018
@LukasPaczos LukasPaczos added this to the android-v7.0.0 milestone Oct 25, 2018
@LukasPaczos LukasPaczos requested a review from tobrun October 25, 2018 14:58
* @param options CustomGeometrySourceOptions.
* @param provider The tile provider that returns geometry data for this source.
*/
@UiThread
public CustomGeometrySource(String id, CustomGeometrySourceOptions options,
public CustomGeometrySource(String id, GeoJsonOptions options,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand the typing problem being addressed here. The documentation is missing the wrap and clip options that are also supported. If those are supported, would it be better to keep the CustomGeometrySourceOptions type so that a developer knows the right type to instantiate to access those additional properties?

Copy link
Contributor Author

@LukasPaczos LukasPaczos Oct 26, 2018

Choose a reason for hiding this comment

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

The constructor accepts also GeoJsonOptions base type and to make this abstraction easier to implement, without casting, I think that we should accept the base type as the argument type. The CustomGeometrySourceOptions, which contains those additional options, is referenced in the javadoc as well.

Would adding another constructor for the extended type make it more readable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would adding another constructor for the extended type make it more readable?

That wouldn't really help, as it would only be used automatically in a few cases. One option is to remove the inheritance in CustomGeometrySourceOptions and have it only contain the supported methods, returning the correct object type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure @asheemmamoowala, this makes sense.

@tobrun
Copy link
Member

tobrun commented Oct 31, 2018

Can you retarget this branch to master?

@LukasPaczos LukasPaczos changed the base branch from android-semver to master October 31, 2018 12:04
@LukasPaczos LukasPaczos force-pushed the lp-improve-cgs-constructor-typing branch from 1948a58 to 432b097 Compare November 1, 2018 14:17
@LukasPaczos LukasPaczos force-pushed the lp-improve-cgs-constructor-typing branch from 432b097 to 07fdd55 Compare November 1, 2018 14:18
@LukasPaczos
Copy link
Contributor Author

Read for another round.

@LukasPaczos LukasPaczos merged commit a3d0ff7 into master Nov 2, 2018
@LukasPaczos LukasPaczos deleted the lp-improve-cgs-constructor-typing branch November 2, 2018 12:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android SEMVER-MAJOR Requires a major release according to Semantic Versioning rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants