It looks like one problem is that the object I am really trying to serialize includes a scala.collection.mutable.TreeMap. If I try to serialize a plain old TreeMap with none of my own stuff, e.g.,
val map = new TreeMap[String, Double]()
new XMLEncoder(new BufferedOutputStream(new FileOutputStream("map.xml"))).writeObject(map)
it results in this output to stderr:
java.lang.Exception: XMLEncoder: discarding statement XMLEncoder.writeObject(TreeMap);
It appears that not all Scala objects can be XML encoded. That wouldn’t be good!