Given:
class Foo[T] { def get: T } class Bar class FooBar extends Foo[Bar] { def get = new Bar } object Baz { def something [T, U <: Foo[T]] (foo : Class[U]): T = foo.newInstance.get } I should be able to do something like this, right?
Baz.something(classOf[FooBar]) Strangely this is throwing:
inferred type arguments [Nothing,this.FooBar] do not conform to method something's type parameter bounds [T,U <: this.Foo[T]] Which is weird :S. BTW I'm having this issue while migrating some java code that's equivalent to what I write here and it's working fine.
Fooclass is missing anabstractkeyword.