| 68 | // This method is declared this way instead of "<T> Provider<T> provider(Provider<T> delegate)" |
| 69 | // to work around an Eclipse type inference bug: https://github.com/google/dagger/issues/949. |
| 70 | public static <P extends Provider<T>, T> Provider<T> provider(P delegate) { |
| 71 | checkNotNull(delegate); |
| 72 | if (delegate instanceof DoubleCheck) { |
| 73 | /* This should be a rare case, but if we have a scoped @Binds that delegates to a scoped |
| 74 | * binding, we shouldn't cache the value again. */ |
| 75 | return delegate; |
| 76 | } |
| 77 | return new DoubleCheck<T>(delegate); |
| 78 | } |
| 79 | |
| 80 | /** Returns a {@link Lazy} that caches the value from the given provider. */ |
| 81 | // This method is declared this way instead of "<T> Lazy<T> lazy(Provider<T> delegate)" |