以下のコードで次のエラーが発生します。どんな洞察も大歓迎です。この動作を引き起こしていないアプリケーション全体に他のユーザー定義型が十分にあるため、何が原因なのかよくわかりません。
ガイダンス/提案を提供できるようにするために、さらに情報が必要な場合はお知らせください。
[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)
}
}