scala> import scala.pickling._, Defaults._, json._
import scala.pickling._
import Defaults._
import json._
scala> class ProcessID(val id: Short) extends AnyVal
defined class ProcessID
scala> new ProcessID(1).pickle
<console>:19: warning: ProcessID and Null are unrelated: they will always compare unequal
new ProcessID(1).pickle
^
res0: scala.pickling.json.pickleFormat.PickleType =
JSONPickle({
"$type": "ProcessID",
"id": 1
})
problem
<console>:19: warning: ProcessID and Null are unrelated: they will always compare unequal
original report
When (un)pickling value classes, the compiler produce a warning that looks like:
MyValueClass and Null are unrelated: they will always compare unequal
Pickling code produces a correct result. So this is more cosmetic than an issue.
tested with scala 2.11.2 and pickling 0.9.0-SNAPSHOT
The full warning looks like:
[warn] .../round/src/test/scala/example/DynamicMembership.scala:280: round.ProcessID and Null are unrelated: they will always compare unequal
[warn] val (v,inst,id,replicas) = msg.getContent[(Int,Short,Short,List[Replica])]
[warn] ^
the getContent method (of Message class) is defined as:
def getContent[A: SPickler: Unpickler: FastTypeTag]: A = {
val bytes = getPayLoad //returns an Array[Byte]
val converted = BinaryPickle(bytes).unpickle[A]
converted
}
ProcessID and replica are defined as:
class ProcessID(val id: Short) extends AnyVal
case class Replica(id: ProcessID, address: String, port: Int)
steps (0.10.0)
problem
original report
When (un)pickling value classes, the compiler produce a warning that looks like:
Pickling code produces a correct result. So this is more cosmetic than an issue.
tested with scala 2.11.2 and pickling 0.9.0-SNAPSHOT
The full warning looks like:
the
getContent
method (of Message class) is defined as:ProcessID and replica are defined as:
source code at https://github.com/dzufferey/round let me know if you need more info.