dagger icon indicating copy to clipboard operation
dagger copied to clipboard

Warning when using qualifier annotations with AutoFactory

Open cypressious opened this issue 11 years ago • 4 comments

When using AutoFactory with qualifier annotations like this

@AutoFactory
public class MyClass {
    public MyClass(int param, @Provided @QualifierA Object param2) {
    }
}

Dagger will issue the following warning:

Dagger will ignore qualifier annotations on parameters that are not @Inject constructor parameters or @Provides method parameters: param2

This is a kind of useless because in this case, the generated factory class will use the annotation correctly. Also there is no way to hide the warning (unless there is one, in which case please tell me).

cypressious avatar Jun 25 '14 13:06 cypressious

Hmm. There should be a @SuppressWarning on that.

On 25 June 2014 06:55, cypressious [email protected] wrote:

When using AutoFactory with qualifier annotations like this

@AutoFactorypublic class MyClass { public MyClass(int param, @Provided @QualifierA Object param2) { }}

Dagger will issue the following warning:

Dagger will ignore qualifier annotations on parameters that are not @Inject constructor parameters or @Provides method parameters: param2

This is a kind of useless because in this case, the generated factory class will use the annotation correctly. Also there is no way to hide the warning (unless there is one, in which case please tell me).

— Reply to this email directly or view it on GitHub https://github.com/square/dagger/issues/419.

cgruber avatar Jun 25 '14 17:06 cgruber

At least Eclipse didn't offer one. What's the parameter?

cypressious avatar Jun 25 '14 17:06 cypressious

Eclipse might not know about it - it might not exist, but even if it did, if it's in the annotation processor, there's no information for eclipse to access to know about it. I'll dig in. What I will say is that if we preserve this warning in Dagger 2, there for sure will be a suppression option.

On 25 June 2014 10:41, cypressious [email protected] wrote:

At least Eclipse didn't offer one. What's the parameter?

— Reply to this email directly or view it on GitHub https://github.com/square/dagger/issues/419#issuecomment-47134363.

cgruber avatar Jun 25 '14 17:06 cgruber

Nice, thank you.

cypressious avatar Jun 25 '14 17:06 cypressious