1
votes

I get the following error from dagger:

[ERROR] error on execute: java.lang.IllegalArgumentException: Unexpected key: ca.nanometrics.apollo.instrument.configuration.ResourceOwnerController<>

I believe this happens because I have a class with no injectable dependencies - it has an empty public constructor (with @Inject), with nothing to inject in members either. I did this to not have to declare the @Provides for it. Note that the class with the @Inject is a subclass of the class listed in the error message above:

public class ResourceOwnerControllerHelios extends ResourceOwnerController<ResourceOwnerFactoryHelios>
{

  @Inject
  public ResourceOwnerControllerHelios()
  {
    // do nothing
  }

Is this a bug in dagger, or is there something I am missing?

If I remove the @Inject and still don't add the @Provides to the module, it of course doesn't work at all, since dagger needs @Inject or @Provides on all dependencies.

1

1 Answers

2
votes

Oi - this looks like its' bumping into a mishandling of generics. :/ Maybe file an issue on github. What you're doing should work - that is, adding @Inject to a no-args public constructor. I believe Dagger is trying to climb the inheritance hierarchy and not handling the generics in the parent. We should be handling this case.