forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
The following fails to build:
@Component
interface FooComp {
Foo<Integer> foo();
}
@Reusable
class Foo<T> {
@Inject
Foo() {}
}
Error:(26, 44) error: incompatible types: Provider<Foo<Object>> cannot be converted to Provider<Foo<Integer>>
However, when adding another @Inject element or removing scoping it succeeds:
@Reusable
class Foo<T> {
@Inject
Foo() {}
@Inject
void postConstruct() {}
}
The problem in the first case is that Dagger is overeager to use a single static factory instance for generating instances of scoped generic classes.
Metadata
Metadata
Assignees
Labels
No labels