-
Notifications
You must be signed in to change notification settings - Fork 781
Description
Originally requested in #1592
Adding support for restricting API for the entire type. RestrictedApi check currently only supports for annotating methods, with this change, it will be possible to annotate the class and make sure all the methods in that class will be restricted with given annotation configuration.
Before implementing this, we'd need to decide what the semantics of restricting the uses of a type should be. One interpretation is to disallow calls to methods in that type, as if all the methods were annotated with @RestrictedApi. Another interpretation is to try to prevent uses of the type in a more general way, e.g. if it's used as the type of a field, or if it's referenced in another way where the type may not even appear in source (e.g. the return type of foo() in x.foo().bar()).
If you're interested in this feature, it'd be helpful to share detail about use-cases you have in mind, and what behaviour you'd expect from annotating a type with @RestrictedApi.