Dagger: Dagger generates subcomponent builder with name same as builder interface name

Created on 29 Jul 2017  路  1Comment  路  Source: google/dagger

@Component
public interface MyComponent {

    MySubcomponent.MySubcomponentBuilder mySubcomponentBuider();

}
@Subcomponent
public interface MySubcomponent {

    @Subcomponent.Builder
    interface MySubcomponentBuilder {

        @BindsInstance
        MySubcomponentBuilder integer(Integer integer);

        MySubcomponent build();

    }

    void inject(B b);
}
public class A {

    @Inject
    public A(Integer integer) {

    }

}
public class B {

    @Inject
    A a;

}
public class Main {

    public static void main(String[] args) {
        DaggerMyComponent.create().mySubcomponentBuider().integer(42).build().inject(new B());
    }

}

This code produces next error:

error: cannot find symbol this.integerProvider = InstanceFactory.create(builder.integer);

Because it tries to get integer from the builder interface, not the implementation.

Code here

P3 dagger bug

Most helpful comment

Ah, this is definitely a good edge case. We should fix this (though probably low priority)

>All comments

Ah, this is definitely a good edge case. We should fix this (though probably low priority)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matpag picture matpag  路  3Comments

HiroyukTamura picture HiroyukTamura  路  3Comments

SAGARSURI picture SAGARSURI  路  3Comments

blackberry2016 picture blackberry2016  路  3Comments

cesar1000 picture cesar1000  路  3Comments