title: How can I instantiate a generic Scala type from a generic Java type?
body: <p>I have a Scala class Foo:</p>
  
  <pre><code>case class Foo[T](obj: T)
  </code></pre>
  
  <p>I want to create an instance of class Foo in Java class Bar:</p>
  
  <pre><code>public class Bar&lt;T&gt; {
      private final Foo&lt;T&gt; _foo;
      public Bar(T obj) {
          this._foo = Foo.apply((T) toScala(obj));
      }
  }
  </code></pre>
  
  <p>toScala is able to create the appropriate Scala type, and this code works if T is a concrete type. With generic type T, I get the error "java: cannot find symbol: method apply(T)". Can I use a generic type in this way?</p>