I am still getting my head around Scala, so trying to figure out what is missing in below code. I am getting this error message when i try to instantiate genericserializer with anonymous type
Description Resource Path Location Type type mismatch; found : scala.reflect.Manifest[Object] required: scala.reflect.Manifest[FolderMgmtDAO.this.anoMoveType] Note: Object >: FolderMgmtDAO.this.anoMoveType, but trait Manifest is invariant in type T. You may wish to investigate a wildcard type such as
_ >: FolderMgmtDAO.this.anoMoveType
. (SLS 3.2.10) FolderMgmtDAO.scala /somucore/src/somu/core line 20 Scala Problem
Below is the code
object GenericSerializer
{
def apply[T <:AnyRef:Manifest]() = new GenericSerializer[T]()
}
class GenericSerializer[T <:AnyRef:Manifest] extends IMongoSerializer[T] {}
//Anonymous type creation and using GenericSerializer
type anoMoveType = { def folderPath:String }
val szr = GenericSerializer[anoMoveType]