You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
Hi,
It seems that java classes aren't currently well handled, when attempting to either pickle directly, or say embedded in fields of pure scala classes.
The examples below compile successfully, and generate pickled representations.
However in each case:
a) unpickling to the specific type, successfully returns an object, however it's incorrectly initialised. (i.e. it's fields don't match those of the original object)
b) unpickling to [Any] fails at runtime.
This is rather unfortunate, since particularly case (a) could lead to hard to detect errors.
It would be great if you could take a look.
picklingtests.PickleTest
testPickleCaseClassJavaField_Specific(picklingtests.PickleTest)
java.lang.AssertionError: expected:<X(2013-10-24)> but was:<X(2013-10-21)>
testPickleCaseClassJavaField_Any(picklingtests.PickleTest)
java.util.NoSuchElementException: key not found: x$1
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:58)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:58)
at scala.pickling.json.JSONPickleReader.readField(JSONPickleFormat.scala:235)
at scala.pickling.json.JSONPickleReader.readField(JSONPickleFormat.scala:159)
at scala.pickling.InterpretedUnpicklerRuntime$$anon$2$$anonfun$fieldVals$1$1.apply(Runtime.scala:174)
testPickleJavaClass2_Specific(picklingtests.PickleTest)
java.lang.AssertionError: expected:<java.awt.Rectangle[x=1,y=2,width=3,height=4]> but was:<java.awt.Rectangle[x=0,y=0,width=0,height=0]>
testPickleJavaClass_Any(picklingtests.PickleTest)
java.util.NoSuchElementException: key not found: x$1
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:58)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:58)
at scala.pickling.json.JSONPickleReader.readField(JSONPickleFormat.scala:235)
at scala.pickling.json.JSONPickleReader.readField(JSONPickleFormat.scala:159)
testPickleJavaClass_Specific(picklingtests.PickleTest)
java.lang.AssertionError: expected:<2013-10-24> but was:<2013-10-21>
testPickleJavaClass2_Any(picklingtests.PickleTest)
java.util.NoSuchElementException: key not found: x$1
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:58)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:58)
at scala.pickling.json.JSONPickleReader.readField(JSONPickleFormat.scala:235)
at scala.pickling.json.JSONPickleReader.readField(JSONPickleFormat.scala:159)
at scala.pickling.InterpretedUnpicklerRuntime$$anon$2$$anonfun$fieldVals$1$1.apply(Runtime.scala:174)
The text was updated successfully, but these errors were encountered:
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.
Hi,
It seems that java classes aren't currently well handled, when attempting to either pickle directly, or say embedded in fields of pure scala classes.
The examples below compile successfully, and generate pickled representations.
However in each case:
a) unpickling to the specific type, successfully returns an object, however it's incorrectly initialised. (i.e. it's fields don't match those of the original object)
b) unpickling to [Any] fails at runtime.
This is rather unfortunate, since particularly case (a) could lead to hard to detect errors.
It would be great if you could take a look.
Output:
The text was updated successfully, but these errors were encountered: