diff options
-rw-r--r-- | src/library/scala/xml/Attribute.scala | 10 | ||||
-rw-r--r-- | src/library/scala/xml/Elem.scala | 3 | ||||
-rw-r--r-- | src/library/scala/xml/MetaData.scala | 7 | ||||
-rw-r--r-- | test/files/run/bug4387.scala | 12 |
4 files changed, 16 insertions, 16 deletions
diff --git a/src/library/scala/xml/Attribute.scala b/src/library/scala/xml/Attribute.scala index dfee02c48a..5b69017e70 100644 --- a/src/library/scala/xml/Attribute.scala +++ b/src/library/scala/xml/Attribute.scala @@ -64,16 +64,6 @@ abstract trait Attribute extends MetaData { (next(arg, scope, key) == null) && (next wellformed scope) } - override def canEqual(other: Any) = other match { - case _: Attribute => true - case _ => false - } - override def strict_==(other: Equality) = other match { - case x: Attribute => (pre == x.pre) && (key == x.key) && (value sameElements x.value) && (next == x.next) - case _ => false - } - override def basisForHashCode = List(pre, key, value) - /** Appends string representation of only this attribute to stringbuffer. */ def toString1(sb: StringBuilder) { diff --git a/src/library/scala/xml/Elem.scala b/src/library/scala/xml/Elem.scala index b068a1a17d..4ea7e90de2 100644 --- a/src/library/scala/xml/Elem.scala +++ b/src/library/scala/xml/Elem.scala @@ -17,8 +17,7 @@ package scala.xml * Copyright 2008 Google Inc. All Rights Reserved. * @author Burak Emir <bqe@google.com> */ -object Elem -{ +object Elem { def apply(prefix: String,label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*) = new Elem(prefix,label,attributes,scope,child:_*) diff --git a/src/library/scala/xml/MetaData.scala b/src/library/scala/xml/MetaData.scala index ff3071e050..2e55a9d67e 100644 --- a/src/library/scala/xml/MetaData.scala +++ b/src/library/scala/xml/MetaData.scala @@ -71,8 +71,7 @@ object MetaData { * Copyright 2008 Google Inc. All Rights Reserved. * @author Burak Emir <bqe@google.com> */ -abstract class MetaData extends Iterable[MetaData] with Equality with Serializable -{ +abstract class MetaData extends Iterable[MetaData] with Equality with Serializable { /** Updates this MetaData with the MetaData given as argument. All attributes that occur in updates * are part of the resulting MetaData. If an attribute occurs in both this instance and * updates, only the one in updates is part of the result (avoiding duplicates). For prefixed @@ -135,10 +134,10 @@ abstract class MetaData extends Iterable[MetaData] with Equality with Serializab case _ => false } override def strict_==(other: Equality) = other match { - case m: MetaData => this.toSet == m.toSet + case m: MetaData => this.asAttrMap == m.asAttrMap case _ => false } - def basisForHashCode: Seq[Any] = List(this.toSet) + def basisForHashCode: Seq[Any] = List(this.asAttrMap) /** Returns an iterator on attributes */ def iterator: Iterator[MetaData] = Iterator.single(this) ++ next.iterator diff --git a/test/files/run/bug4387.scala b/test/files/run/bug4387.scala new file mode 100644 index 0000000000..f51c9b0572 --- /dev/null +++ b/test/files/run/bug4387.scala @@ -0,0 +1,12 @@ +object Test { + import xml.XML.loadString + def mkElem(arg: String) = <foo a="1" b="2" c="3" d="4" e={arg} /> + + val x1 = mkElem("5") + val x2 = mkElem("50") + + def main(args: Array[String]): Unit = { + assert(x1 == loadString("" + x1)) + assert(x2 != loadString("" + x1)) + } +} |