我收到以下代码的以下错误。任何见解都非常感谢。不太清楚是什么原因造成的,因为我在整个应用程序中有大量其他用户定义的类型并没有导致这种行为。
让我知道是否需要更多信息才能提供指导/建议。
[error] /Users/dan_mi_sun/projects/openblockchain/src/main/scala/org/dyne/danielsan/openblockchain/data/model/GenericVinModel.scala:35: type mismatch;
[error] found : org.dyne.danielsan.openblockchain.data.model.VinsModel
[error] required: com.websudos.phantom.CassandraTable[org.dyne.danielsan.openblockchain.data.model.VinsModel,org.dyne.danielsan.openblockchain.data.entity.Vin]
[error] Note: org.dyne.danielsan.openblockchain.data.model.ConcreteVinsModel <: org.dyne.danielsan.openblockchain.data.model.VinsModel (and org.dyne.danielsan.openblockchain.data.model.VinsModel <: com.websudos.phantom.CassandraTable[org.dyne.danielsan.openblockchain.data.model.ConcreteVinsModel,org.dyne.danielsan.openblockchain.data.entity.Vin]), but class CassandraTable is invariant in type T.
[error] You may wish to define T as +T instead. (SLS 4.5)
[error] object scriptsig extends JsonListColumn[VinsModel, Vin, ScriptSig](this) {
[error] ^
[error] one error found
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.json4s.jackson.Serialization
import org.json4s.jackson.Serialization.write
import scala.concurrent.Future
case class ScriptSig(asm: String,
hex: String)
case class Vin(txid: String,
vout: Int,
scriptSig: List[ScriptSig],
sequence: Int)
sealed class VinsModel extends CassandraTable[ConcreteVinsModel, Vin] {
implicit val formats = Serialization.formats(NoTypeHints)
override def fromRow(row: Row): Vin = {
Vin(
txid(row),
vout(row),
scriptSig(row),
sequence(row)
)
}
object txid extends StringColumn(this)
object vout extends IntColumn(this)
object scriptSig extends JsonListColumn[VinsModel, Vin, ScriptSig](this) {
override def fromJson(obj: String): ScriptSig = {
parse(obj).extract[ScriptSig]
}
override def toJson(obj: ScriptSig): String = {
write(obj)
}
}
object sequence extends IntColumn(this)
}
abstract class ConcreteVinsModel extends VinsModel with RootConnector {
override val tableName = "vins"
def insertNew(v: Vin): Future[ResultSet] = insertNewVin(v).future()
def insertNewVin(v: Vin) = {
insert
.value(_.txid, v.txid)
.value(_.vout, v.vout)
.value(_.scriptSig, v.scriptSig)
.value(_.sequence, v.sequence)
}
}