This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
pickling a java.lang.Byte doesn't contain value (unpickles to zero) #263
Labels
Comments
It seems that none of the java.lang.* primitives work. |
More sinister problem is that you get scala> import scala.pickling._, Defaults._, json._
import scala.pickling._
import Defaults._
import json._
scala> val r1: java.lang.Byte = 13.toByte
r1: Byte = 13
scala> val r2 = r1.pickle
r2: scala.pickling.json.pickleFormat.PickleType =
JSONPickle({
"$type": "java.lang.Byte"
})
scala> val r3 = r2.unpickle[java.lang.Byte]
r3: Byte = 0 |
eed3si9n
changed the title
pickling a java.lang.Byte does not work
pickling a java.lang.Byte doesn't contain value (unpickles to zero)
Feb 8, 2015
Maybe this is a case of #60. |
eed3si9n
added a commit
that referenced
this issue
Feb 9, 2015
Current implementation uses reflectivelyWithoutGetter to try accessing primary constructor params by name, and is allowed to fail silently. This ends up generating empty objects for Java classes like java.lang.Byte. - This does not attempt reflection unless we have a known param. - When the list of fields are non-empty, but the pickler generates zero fields, it will raise exception to fail the macro.
eed3si9n
added a commit
that referenced
this issue
Feb 10, 2015
Current implementation uses reflectivelyWithoutGetter to try accessing primary constructor params by name, and is allowed to fail silently. This ends up generating empty objects for Java classes like java.lang.Byte. - This does not attempt reflection unless we have a known param. - When the list of fields are non-empty, but the pickler generates zero fields, it will raise exception to fail the macro.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Using:
When:
Then:
But scala.Byte works:
The text was updated successfully, but these errors were encountered: