Hi, does anyone know how the @BindsOptionalOf anno...
# dagger
Hi, does anyone know how the @BindsOptionalOf annotation is supposed to work? Because in the dagger.dev ATM tutorial, at the last step it uses this annotation to bind an object that is part of the Subcomponent into an object that is part of the root component.
Copy code
public interface LoginCommandModule { // part of the root component

  Account optionalAccount();

Copy code
@Subcomponent(modules = ...)
public interface UserCommandsRouter {

    CommandRouter router();

    interface Factory {
        UserCommandsRouter create(@BindsInstance Database.Account account);

    @Module(subcomponents = UserCommandsRouter.class)
    interface InstallationModule { // Included in the RootComponent

What would be the usages of the @BindsOptionalOf annotation besides checking if the subcomponent has already been initialized? And, if there are multiple subcomponents, which Account from which subcomponent would be selected in order to be used by the root component?