The error can be reproduced in the console with the following code.

case class SomeClass(name: String)

abstract class Factory() {
  protected def create[U](name: String) : U
}

class SomeFactory extends Factory() {
  override def create[SomeClass](name: String) = SomeClass(name)
} 

<console>:11: error: type mismatch;
found : SomeClass(in object $iw) required: SomeClass(in method create) override def create[SomeClass](name: String) = SomeClass(name)

1

There are 1 answers

0
Ryan On BEST ANSWER

Seems like this is what you're trying to achieve:

case class SomeClass(name: String)

abstract class Factory[U]() {
  protected def create(name: String) : U
}

class SomeFactory extends Factory[SomeClass] {
  def create(name: String) = SomeClass(name)
}

(I'm assuming you meant for SomeFactory to extend Factory)