Forbid providing null values
Author: illicitonionCreated Jun 21, 2013Updated Feb 10, 2017
Labelsenhancement
It doesn't make sense for a @Provides method to provide a null value. We should throw at the injection stage, when this happens, to catch errors closer to their source. If people really want to inject optional values, they should use some Optional class wrapper to make their intent clear, so that real bugs can be caught early.
If this is too controversial, perhaps we could at least codegen null checks if the @Provides method wasn't also annotated @Nullable.
Source: square/dagger