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
Upgrading to AutoFactory 1.1.0 seems to cause objects @Provided with @Qualifiers to no longer work. It appears that the qualifier is not propagated to the generated factory class, whereas with version 1.0.1, it was.
Long story short, the AutoFactory used to propagate the qualifier to the generated factory class:
@Inject
public MyClassFactory(@MyQualifier Provider<Integer> valueProvider) {
...
}
Now, the qualifier is no longer propagated, causing dagger to be unable to find the @Provides annotation: error: [Dagger/MissingBinding] java.lang.Integer cannot be provided without an @Inject constructor or an @Provides-annotated method.
@Inject
public MyClassFactory(Provider<Integer> valueProvider) {
...
}
To fully reproduce the issue, here is a link to a sample app, but if that doesn't work, I'll also paste the applicable code below. Please let me know if you have any questions, and I appreciate someone looking into it!
MainActivity.java:
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import javax.inject.Inject;
public class MainActivity extends Activity {
@Inject MyClassFactory myClassFactory;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppComponent component =
DaggerAppComponent.builder()
.myModule(new MyModule())
.build();
component.inject(this);
TextView textView = findViewById(R.id.text_view); // Make sure you have this TextView in your layout
// Using generated factory to create an instance with a non-injected constructor
MyClass myClass = myClassFactory.create("Hello from AutoFactory!");
System.out.println(myClass.getMessage() + " Value: " + myClass.getValue());
textView.setText(myClass.getMessage() + " Value: " + myClass.getValue());
}
Upgrading to AutoFactory 1.1.0 seems to cause objects
@Provided
with@Qualifiers
to no longer work. It appears that the qualifier is not propagated to the generated factory class, whereas with version 1.0.1, it was.Long story short, the AutoFactory used to propagate the qualifier to the generated factory class:
Now, the qualifier is no longer propagated, causing dagger to be unable to find the
@Provides
annotation:error: [Dagger/MissingBinding] java.lang.Integer cannot be provided without an @Inject constructor or an @Provides-annotated method.
To fully reproduce the issue, here is a link to a sample app, but if that doesn't work, I'll also paste the applicable code below. Please let me know if you have any questions, and I appreciate someone looking into it!
MainActivity.java
:activity_main.xml
:AppComponent.java
:MyClass.java
:MyModule.java
:MyQualifier.java
:The text was updated successfully, but these errors were encountered: