Skip to content

Commit 2f7afd6

Browse files
dimo414kluever
authored andcommitted
Mention in OptionalBinder that java.util.Optional and c.g.c.base.Optional are supported.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=265976651
1 parent 35b9a3c commit 2f7afd6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/src/com/google/inject/multibindings/OptionalBinder.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.google.inject.internal.RealOptionalBinder.newRealOptionalBinder;
2020

21-
import com.google.common.base.Optional;
2221
import com.google.inject.Binder;
2322
import com.google.inject.Key;
2423
import com.google.inject.TypeLiteral;
@@ -35,8 +34,9 @@
3534
* </ol>
3635
*
3736
* <p>When an OptionalBinder is added, it will always supply the bindings: {@code Optional<T>} and
38-
* {@code Optional<Provider<T>>}. If {@link #setBinding} or {@link #setDefault} are called, it will
39-
* also bind {@code T}.
37+
* {@code Optional<Provider<T>>}. Both {@link java.util.Optional java.util.Optional} and {@link
38+
* com.google.common.base.Optional com.google.common.base.Optional} are bound for compatibility. If
39+
* {@link #setBinding} or {@link #setDefault} are called, it will also bind {@code T}.
4040
*
4141
* <p>{@code setDefault} is intended for use by frameworks that need a default value. User code can
4242
* call {@code setBinding} to override the default. <b>Warning: Even if setBinding is called, the
@@ -66,8 +66,8 @@
6666
* }
6767
* }</code></pre>
6868
*
69-
* <p>With this module, an {@link Optional}{@code <Renamer>} can now be injected. With no other
70-
* bindings, the optional will be absent. Users can specify bindings in one of two ways:
69+
* <p>With this module, an {@code Optional<Renamer>} can now be injected. With no other bindings,
70+
* the optional will be absent. Users can specify bindings in one of two ways:
7171
*
7272
* <p>Option 1:
7373
*

0 commit comments

Comments
 (0)