Change CoreStartable @Dependencies to Injected Map
Using it as an annotation wasn't working - the compiler was stripping it away for unknown reasons. Replace it with a injected Map<Class, Set<Class>> where each startable can simply provide a set of the other startables it cares about. One advantage of this is that the dependencies can not be provided in the same module where the startable is bound. This means that different impls of a given startable can list different dependencies. Before, the dependencies were tied to the key, which could be an interface shared across multiple different impls. The reason this was done this way instead of a method on CoreStartable is because we want to be able to get the list of dependencies before constructing the startable - many of our classes do work in the constructor. We could have tried to reflectively call a static method on the key, but this would look like an ugly hack; it would also prevent the advantage of specifying the dependencies on a per-impl basis. Bug: 333758389 Flag: NA Test: locally run Change-Id: If729483c4661428d4a1041f84f39cdc50f6f5645
Loading
Please register or sign in to comment