title: How do I extend Java interface containing generic methods in Scala?
body: <p>Suppose we have the following Java interface:</p>
  
  <pre><code>// Java
  public interface Foo {
      &lt;T&gt; T bar(Class&lt;T&gt; c);
  }
  </code></pre>
  
  <p>How should I extend it in Scala? Writing</p>
  
  <pre><code>// Scala
  class FooString extends Foo {
    override def bar(c: Class[String]): String = "hello, world";
  }
  </code></pre>
  
  <p>will cause the compiler to throw "class FooString needs to be abstract, since method bar in trait Foo of type [T<code>]</code>(Class[T])T is not defined."</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Update:</strong>
  The ugly truth is: I've misunderstood generics in Java.</p>
  
  <p>In any case, the solutions to my woes are shown in both Nicolas' and Walter's answers, although I prefer Walter's answer better 'cos it's less verbose.</p>