Commit graph

4 commits

Author SHA1 Message Date
Colin Cross
24c1cbe63e Reland "Remove non-generic provider APIs"
There are no more callers to the non-generic provider APIs, remove them.

This reapplies I4d336340e630643f98531787a81e0f1f18ec108d after
I79736e44d85bc6e8c97f08ebf783b40533a3e6ae removed a newly introduced
usage.

Bug: 316410648
Change-Id: I152f8e5ef8330b811d3f42f8c2c73943ac0979bb
Test: builds
2023-12-22 00:06:05 +00:00
Colin Cross
84b68c90ae Revert "Remove non-generic provider APIs"
This reverts commit ad50aca6ab.

Reason for revert: Broke builds when combined with aosp/2876755

Change-Id: I3bfbcb05d8c695b9315b7e8e3f63c6bd5c9dbe36
2023-12-20 00:59:28 +00:00
Colin Cross
ad50aca6ab Remove non-generic provider APIs
There are no more callers to the non-generic provider APIs, remove them.

Bug: 316410648
Test: builds
Change-Id: I4d336340e630643f98531787a81e0f1f18ec108d
2023-12-14 16:12:22 -08:00
Colin Cross
3c0a83d19f Use generics for providers API
Using generics for the providers API allows a type to be associated
with a ProviderKey, resulting in a type-safe API without that doesn't
require runtime type assertions by every caller.

Unfortunately, Go does not allow generic types in methods, only in
functions [1].  This prevents a type-safe API on ModuleContext, and
requires moving the API to be functions that take a ModuleContext as
a parameter.

This CL creates the new API, but doesn't convert all of the callers.

[1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods)

Bug: 316410648
Test: builds
Change-Id: I3e30d68b966b730efd968166a38a25cc144bd6de
2023-12-14 16:12:20 -08:00