Skip to content

Add JvmOverloads for java api#656

Merged
Chaoba merged 4 commits intomainfrom
kl-jvmoverloads
Sep 26, 2021
Merged

Add JvmOverloads for java api#656
Chaoba merged 4 commits intomainfrom
kl-jvmoverloads

Conversation

@Chaoba
Copy link
Copy Markdown
Contributor

@Chaoba Chaoba commented Sep 22, 2021

PRs must be submitted under the terms of our Contributor License Agreement CLA.
Fixes: < Link to related issues that will be fixed by this pull request, if they exist >

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-android changelog: <changelog>Add @JvmOverloads where applicable to provide better experience for Java users.</changelog>.

Summary of changes

Modify SDK functions where applicable to make Java consumption much more easy and convenient.

Exact steps that were done:

  • Add @JvmOverloads to constructors and methods that have default Kotlin parameters
  • Add overloaded methods for MapboxMap#loadStyleUri, MapboxMap#loadStyleJson, MapboxMap#loadStyle
  • Add test code to check Java API usability

User impact (optional)

@Chaoba Chaoba self-assigned this Sep 22, 2021
@Chaoba Chaoba changed the title [WIP]Add JvmOverloads for java api Add JvmOverloads for java api Sep 22, 2021
@Chaoba Chaoba marked this pull request as ready for review September 22, 2021 11:53
@Chaoba Chaoba requested a review from a team September 22, 2021 11:54
@kiryldz
Copy link
Copy Markdown
Contributor

kiryldz commented Sep 23, 2021

@mapbox/maps-android how can we make sure we did not miss anything as part of this PR? any ideas?

@axti
Copy link
Copy Markdown
Contributor

axti commented Sep 23, 2021

Maybe we can use list of possible constructors and call them in a loop?

Class classSomeClass = SomeClass.class;
Constructor[] constructors = classSomeClass.getConstructors();

@Chaoba
Copy link
Copy Markdown
Contributor Author

Chaoba commented Sep 23, 2021

@mapbox/maps-android how can we make sure we did not miss anything as part of this PR? any ideas?

We can't 100% make sure this pr covers all the places, but we can keep it in mind and continue iterating on this point if encounter the method need add JvmOverloads annotation in the future..

Maybe we can use list of possible constructors and call them in a loop?

Not only constructors, other APIs that have default param need add this annotation too.

@pengdev
Copy link
Copy Markdown
Member

pengdev commented Sep 24, 2021

Maybe we can use list of possible constructors and call them in a loop?

Class classSomeClass = SomeClass.class;
Constructor[] constructors = classSomeClass.getConstructors();

I think we do have an API checker, will it print these info? cc @Chaoba

@Chaoba
Copy link
Copy Markdown
Contributor Author

Chaoba commented Sep 26, 2021

I think we do have an API checker, will it print these info? cc @Chaoba

That's for checking API change, doesn't have such infos.

@Chaoba Chaoba merged commit 6b78656 into main Sep 26, 2021
@Chaoba Chaoba deleted the kl-jvmoverloads branch September 26, 2021 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants