Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1
    • Fix Version/s: Scala 2.10.0-M3
    • Component/s: None
    • Environment:

      Latest eclipse plugin on Win7

      Description

      Most of the collections lib is, and so it's pretty surprising that this isn't:

      scala> Map(1 -> 1).withDefaultValue(1)
      res9: scala.collection.immutable.Map[Int,Int] = Map(1 -> 1)
       
      scala> import java.io._
      import java.io._
       
      scala> val buffer = new ByteArrayOutputStream
      buffer: java.io.ByteArrayOutputStream = 
       
      scala> val out = new ObjectOutputStream(buffer)
      out: java.io.ObjectOutputStream = java.io.ObjectOutputStream@60232fff
       
      scala> out writeObject res9
      java.io.NotSerializableException: scala.collection.immutable.Map$WithDefault
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
      	at .<init>(<console>:41)
      	at .<clinit>(<console>)
      	at $anonfun$1.apply(<console>:7)
      	at $anonfun$1.apply(<console>:6)
      	at scala.tools.nsc.interpreter.Phased$class.atCurrent(Phased.scala:71)
      	at scala.tools.nsc.interpreter.Power$$anon$3.atCurrent(Power.scala:413)
      	at .<init>(<console>:6)
      	at .<clinit>(<console>)
      	at $print(<console>)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:775)
      	at scala.tools.nsc.interpreter.IMain$Request$$anonfun$18.apply(IMain.scala:1039)
      	at scala.tools.nsc.interpreter.Line.scala$tools$nsc$interpreter$Line$$runAndSetState(Line.scala:41)
      	at scala.tools.nsc.interpreter.Line$$anonfun$2.apply$mcV$sp(Line.scala:47)
      	at scala.tools.nsc.io.package$$anon$2.run(package.scala:22)
      	at java.lang.Thread.run(Thread.java:722)
      

        Attachments

          Issue Links

            Activity

            Hide
            velvia Evan Chan added a comment -

            I have also hit this issue, please fix.

            Show
            velvia Evan Chan added a comment - I have also hit this issue, please fix.
            Hide
            acruise Alex Cruise added a comment -

            Also ImmutableDefaultKeySet

            Show
            acruise Alex Cruise added a comment - Also ImmutableDefaultKeySet
            Hide
            acruise Alex Cruise added a comment -

            Also DefaultValuesIterable

            Show
            acruise Alex Cruise added a comment - Also DefaultValuesIterable
            Hide
            evil.ipos Evil Ipos added a comment -

            It's any technical reason why this cannot be fixed? It's annoying to use "m map identity" to send serialized map via network (to use for example with Akka)

            Show
            evil.ipos Evil Ipos added a comment - It's any technical reason why this cannot be fixed? It's annoying to use "m map identity" to send serialized map via network (to use for example with Akka)
            Hide
            soc Simon Ochsenreither added a comment -

            It seems like Map.WithDefault itself is not serializable, not some field/value of it (as I assumed first). So the fix would be to add Serializable to the right place. Right in the sense of either to the class itself or to a super class/trait. Not sure what's more correct.

            Show
            soc Simon Ochsenreither added a comment - It seems like Map.WithDefault itself is not serializable, not some field/value of it (as I assumed first). So the fix would be to add Serializable to the right place. Right in the sense of either to the class itself or to a super class/trait. Not sure what's more correct.
            Hide
            nilskp Nils Kilden-Pedersen added a comment -

            Just ran into this. Doesn't appear to have been backported to 2.9 against which it was filed.

            Show
            nilskp Nils Kilden-Pedersen added a comment - Just ran into this. Doesn't appear to have been backported to 2.9 against which it was filed.
            Hide
            rytz Lukas Rytz added a comment -
            Show
            rytz Lukas Rytz added a comment - fix was in https://github.com/scala/scala/pull/471

              People

              • Assignee:
                prokopec Aleksandar Prokopec
                Reporter:
                dlwh david hall
              • Votes:
                4 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: