You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Dagger 2.31.2 with fastInit enabled, I am seeing that Dagger generates a Component/Subcomponent that returns the AssitedInject.Factory as an anonymous object. When the factory method name, however, is the same as the AssistedInject classname in camelCase, then the Anonymous factory implementation tries to call itself as shown in the screenshots below.
generated component:
assisted inject definition:
The 'workaround' is to name the factory method create or something else (like most normal people would do 🙈)
The text was updated successfully, but these errors were encountered:
…method calls a generated component method with the same name.
The problem exists in FastInit mode, where the private method name can conflict with the factory method name:
```
final class DaggerMyComponent implements MyComponent {
@OverRide
public FooFactory fooFactory() {
return new FooFactory() {
@OverRide
public Foo foo() {
return foo(); // This calls factory method rather than component method
}
};
}
private Foo foo() {
return new Foo(getDep());
}
}
```
The fix is to reference outer component when calling the private method within the anonymous class.
Fixes#2359
RELNOTES=Fixes#2359: Fixes self-loop when generated implementation of an assisted factory method calls a generated component method with the same name.
PiperOrigin-RevId: 355887899
Using Dagger 2.31.2 with
fastInit
enabled, I am seeing that Dagger generates aComponent
/Subcomponent
that returns theAssitedInject.Factory
as an anonymous object. When the factory method name, however, is the same as the AssistedInject classname in camelCase, then the Anonymous factory implementation tries to call itself as shown in the screenshots below.generated component:

assisted inject definition:

The 'workaround' is to name the factory method
create
or something else (like most normal people would do 🙈)The text was updated successfully, but these errors were encountered: