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
Due to the bug in Scala 2.12 https://issues.scala-lang.org/browse/SI-10232 generated arbitrary functions in scalacheck are not serializable. Fix for that is to split ArbitraryArities and GenArities into different traits.
Here is a repro (should be done with scala 2.12):
import org.scalacheck.Arbitrary._
val f = arbitrary[Int => Int]
val outputStream = new java.io.ByteArrayOutputStream()
val objectOutputStream = new java.io.ObjectOutputStream(outputStream)
objectOutputStream.writeObject(f)
objectOutputStream.close
val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray)
val objectInputStream = new java.io.ObjectInputStream(inputStream)
objectInputStream.readObject()
Should work but instead cause next exception:
java.io.IOException: unexpected exception type
at java.io.ObjectStreamClass.throwMiscException(ObjectStreamClass.java:1582)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1154)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1817)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
... 29 elided
Caused by: java.lang.reflect.InvocationTargetException: java.lang.BootstrapMethodError: too many bootstrap method arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1148)
... 36 more
Caused by: java.lang.BootstrapMethodError: too many bootstrap method arguments
at java.lang.invoke.CallSite.makeSite(CallSite.java:320)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at org.scalacheck.GenArities.$deserializeLambda$(GenArities.scala)
... 46 more
The text was updated successfully, but these errors were encountered:
I've just confirmed that this issue can be resolved by instantiating FunctionNs explicitly instead of using function literals, which means we don't have to break binary compatibility by splitting up the traits. I'll send a PR in the next half hour or so.
Due to the bug in Scala 2.12 https://issues.scala-lang.org/browse/SI-10232 generated arbitrary functions in scalacheck are not serializable. Fix for that is to split
ArbitraryArities
andGenArities
into different traits.Here is a repro (should be done with scala 2.12):
Should work but instead cause next exception:
The text was updated successfully, but these errors were encountered: