Skip to content

Commit f6c33b6

Browse files
committed
Make writeReplace Scala version-specific
1 parent e34c715 commit f6c33b6

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

Diff for: shared/src/main/scala-2.11-2.12/scala/xml/ScalaVersionSpecific.scala

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] {
2020
private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer =>
2121
override def stringPrefix: String = "NodeBuffer"
2222
}
23+
24+
private[xml] trait ScalaVersionSpecificIterableSerializable[+A] { // extends Iterable[A] {
25+
// protected[this] override def writeReplace(): AnyRef = this
26+
}

Diff for: shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala

+4
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ private[xml] trait ScalaVersionSpecificNodeSeq
2424
private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer =>
2525
override def className: String = "NodeBuffer"
2626
}
27+
28+
private[xml] trait ScalaVersionSpecificIterableSerializable[+A] extends Iterable[A] {
29+
protected[this] override def writeReplace(): AnyRef = this
30+
}

Diff for: shared/src/main/scala/scala/xml/MetaData.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ abstract class MetaData
8282
extends AbstractIterable[MetaData]
8383
with Iterable[MetaData]
8484
with Equality
85+
with ScalaVersionSpecificIterableSerializable[MetaData]
8586
with Serializable {
8687

8788
/**
@@ -225,6 +226,4 @@ abstract class MetaData
225226

226227
final def remove(namespace: String, owner: Node, key: String): MetaData =
227228
remove(namespace, owner.scope, key)
228-
229-
protected[this] override def writeReplace(): AnyRef = this
230229
}

Diff for: shared/src/main/scala/scala/xml/NodeSeq.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ object NodeSeq {
4444
*
4545
* @author Burak Emir
4646
*/
47-
abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable {
47+
abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with ScalaVersionSpecificIterableSerializable[Node] with Serializable {
4848
def theSeq: Seq[Node]
4949
def length = theSeq.length
5050
override def iterator = theSeq.iterator
@@ -158,6 +158,4 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S
158158
override def toString(): String = theSeq.mkString
159159

160160
def text: String = (this map (_.text)).mkString
161-
162-
protected[this] override def writeReplace(): AnyRef = this
163161
}

0 commit comments

Comments
 (0)