Skip to content

Use RestrictTo annotations and then add a linter for all public methods #264

Open
@samtstern

Description

@samtstern

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions