@Documented @Target(value=METHOD) @Retention(value=RUNTIME) public @interface Provides
Dagger forbids injecting null
by default. Component implemenations that invoke
@Provides
methods that return null
will throw a NullPointerException
immediately thereafter. @Provides
methods may opt into allowing null
by
annotating the method with any @Nullable
annotation like
javax.annotation.Nullable
or android.support.annotation.Nullable
.
If a @Provides
method is marked @Nullable
, Dagger will only
allow injection into sites that are marked @Nullable
as well. A component that
attempts to pair a @Nullable
provision with a non-@Nullable
injection site
will fail to compile.
Copyright © 2012���2017 The Dagger Authors. All rights reserved.