title: Guice binding not done with @Named annotation
body: <p>I have the following constructor</p>
  
  <pre><code>@Inject
  public MyClass(Provider&lt;TestClass&gt; testProvider, @Named("myName") String name) {
    //constructor stuff
  }
  </code></pre>
  
  <p>My module:</p>
  
  <pre><code>@Provides
  @Named("myName")
  public String getName(SomeObject object) {
      return object.getName();
  }
  </code></pre>
  
  <p>The problem is that Guice doesn't do the binding.</p>
  
  <p><strong>Now if I remove the <code>@Named</code> annotation, it works. The <code>getName()</code> method is succesfully called.</strong> When adding the <code>@Named</code> annotation though, <code>getName()</code> is never called, and my constructor ends up being injected with an empty string.</p>
  
  <p>Only one of my methods annotated with<code>@Provides</code> returns a <code>String</code>, but I'd still like to name it since <code>String</code> is a pretty common object that could be injected.</p>
  
  <p>I have also tried the binding within the <code>configure()</code> method (as per the documentation, but still nothing.</p>
  
  <p>Anyone know what I'm missing? I checked the documentation to no avail.</p>
  
  <p>EDIT: I'm sure that my imports are correct</p>