firebase / firebase/firebase-android-sdk
Use RestrictTo annotations and then add a linter for all public methods
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 31
Description
## Part 1 - Use RestrictTo annotations
If we have `public` methods that are only meant to be called by other Firebase libraries (like things in `common` or `core`) we should annotate them with `RestrictTo(Scope.LIBRARY_GROUP)`.
https://developer.android.com/reference/android/support/annotation/RestrictTo.Scope
## Part 2 - Add a lint check
Any `public` method or class in our SDKs should be annotated with one of these three annotations:
* `PublicApi` - actually meant to be used by 3p developers
* `RestricTo(Scope....)` - only meant to be used by us
* `VisibleForTesting` - not a great idea, but sometimes you need this one
## Part 3 - Abort on error
We should clean up all existing violations in the codebase and then add `lintOptions { abortOnError true }` so that we cannot footgun ourselves anymore.
Contributor guide
Assessment
This issue has not been assessed yet.