Skip to content

Add missing overrides. #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jvm/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class XMLTestJVM {
@UnitTest
def equality = {
val c = new Node {
def label = "hello"
override def label = "hello"
override def hashCode() =
Utility.hashCode(prefix, label, this.attributes.hashCode(), scope.hashCode(), child)
def child = Elem(null, "world", e, sc)
override def child = Elem(null, "world", e, sc)
//def attributes = e
override def text = ""
}
Expand Down Expand Up @@ -792,7 +792,7 @@ class XMLTestJVM {
}

def toSource(s: String) = new scala.io.Source {
val iter = s.iterator
override val iter = s.iterator
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ConstructingParserTest {
def t9060 = {
val a = """<a xmlns:b·="http://example.com"/>"""
val source = new Source {
val iter = a.iterator
override val iter = a.iterator
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {}
}
val doc = ConstructingParser.fromSource(source, false).content(TopScope)
Expand Down Expand Up @@ -42,7 +42,7 @@ class ConstructingParserTest {
</book>

val source = new Source {
val iter = xml.iterator
override val iter = xml.iterator
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {}
}

Expand All @@ -65,7 +65,7 @@ class ConstructingParserTest {
|</book>""".stripMargin

val source = new Source {
val iter = xml.iterator
override val iter = xml.iterator
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ private[xml] object ScalaVersionSpecific {
import NodeSeq.Coll
type CBF[-From, -A, +C] = CanBuildFrom[From, A, C]
object NodeSeqCBF extends CanBuildFrom[Coll, Node, NodeSeq] {
def apply(from: Coll) = NodeSeq.newBuilder
def apply() = NodeSeq.newBuilder
override def apply(from: Coll) = NodeSeq.newBuilder
override def apply() = NodeSeq.newBuilder
}
}

Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/scala/xml/Atom.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class Atom[+A](val data: A) extends SpecialNode with Serializable {
final override def doCollectNamespaces = false
final override def doTransform = false

def label = "#PCDATA"
override def label = "#PCDATA"

/**
* Returns text, with some characters escaped according to the XML
* specification.
*/
def buildString(sb: StringBuilder): StringBuilder =
override def buildString(sb: StringBuilder): StringBuilder =
Utility.escape(data.toString, sb)

override def text: String = data.toString
Expand Down
24 changes: 12 additions & 12 deletions shared/src/main/scala/scala/xml/Attribute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ object Attribute {
*/
trait Attribute extends MetaData {
def pre: String // will be null if unprefixed
val key: String
val value: Seq[Node]
val next: MetaData
override val key: String
override val value: Seq[Node]
override val next: MetaData

def apply(key: String): Seq[Node]
def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node]
def copy(next: MetaData): Attribute
override def apply(key: String): Seq[Node]
override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node]
override def copy(next: MetaData): Attribute

def remove(key: String) =
override def remove(key: String) =
if (!isPrefixed && this.key == key) next
else copy(next remove key)

def remove(namespace: String, scope: NamespaceBinding, key: String) =
override def remove(namespace: String, scope: NamespaceBinding, key: String) =
if (this.key == key && (scope getURI pre) == namespace) next
else copy(next.remove(namespace, scope, key))

def isPrefixed: Boolean = pre != null
override def isPrefixed: Boolean = pre != null

def getNamespace(owner: Node): String
override def getNamespace(owner: Node): String

def wellformed(scope: NamespaceBinding): Boolean = {
override def wellformed(scope: NamespaceBinding): Boolean = {
val arg = if (isPrefixed) scope getURI pre else null
(next(arg, scope, key) == null) && (next wellformed scope)
}
Expand All @@ -94,7 +94,7 @@ trait Attribute extends MetaData {
/**
* Appends string representation of only this attribute to stringbuffer.
*/
protected def toString1(sb: StringBuilder): Unit = {
override protected def toString1(sb: StringBuilder): Unit = {
if (value == null)
return
if (isPrefixed)
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Comment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package xml
*/
case class Comment(commentText: String) extends SpecialNode {

def label = "#REM"
override def label = "#REM"
override def text = ""
final override def doCollectNamespaces = false
final override def doTransform = false
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Document.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Document extends NodeSeq with Serializable {

// methods for NodeSeq

def theSeq: Seq[Node] = this.docElem
override def theSeq: Seq[Node] = this.docElem

override def canEqual(other: Any) = other match {
case _: Document => true
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/scala/xml/Elem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ object Elem {
*/
class Elem(
override val prefix: String,
val label: String,
override val label: String,
attributes1: MetaData,
override val scope: NamespaceBinding,
val minimizeEmpty: Boolean,
val child: Node*
override val child: Node*
) extends Node with Serializable {

final override def doCollectNamespaces = true
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/EntityRef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package xml
case class EntityRef(entityName: String) extends SpecialNode {
final override def doCollectNamespaces = false
final override def doTransform = false
def label = "#ENTITY"
override def label = "#ENTITY"

override def text = entityName match {
case "lt" => "<"
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Group.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final case class Group(nodes: Seq[Node]) extends Node {
*/
private def fail(msg: String) = throw new UnsupportedOperationException("class Group does not support method '%s'" format msg)

def label = fail("label")
override def label = fail("label")
override def attributes = fail("attributes")
override def namespace = fail("namespace")
override def child = fail("child")
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/MetaData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ abstract class MetaData
case m: MetaData => this.asAttrMap == m.asAttrMap
case _ => false
}
protected def basisForHashCode: Seq[Any] = List(this.asAttrMap)
override protected def basisForHashCode: Seq[Any] = List(this.asAttrMap)

/** filters this sequence of meta data */
override def filter(f: MetaData => Boolean): MetaData =
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/NamespaceBinding.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin
case _ => false
}

def basisForHashCode: Seq[Any] = List(prefix, uri, parent)
override def basisForHashCode: Seq[Any] = List(prefix, uri, parent)

def buildString(stop: NamespaceBinding): String = sbToString(buildString(_, stop))

Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Node.scala
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ abstract class Node extends NodeSeq {
/**
* returns a sequence consisting of only this node
*/
def theSeq: Seq[Node] = this :: Nil
override def theSeq: Seq[Node] = this :: Nil

/**
* String representation of this node
Expand Down
8 changes: 4 additions & 4 deletions shared/src/main/scala/scala/xml/NodeSeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.collection.Seq
object NodeSeq {
final val Empty = fromSeq(Nil)
def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq {
def theSeq = s
override def theSeq = s
}

// ---
Expand All @@ -50,10 +50,10 @@ object NodeSeq {
*/
abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable {
def theSeq: Seq[Node]
def length = theSeq.length
override def length = theSeq.length
override def iterator = theSeq.iterator

def apply(i: Int): Node = theSeq(i)
override def apply(i: Int): Node = theSeq(i)
def apply(f: Node => Boolean): NodeSeq = filter(f)

def xml_sameElements[A](that: Iterable[A]): Boolean = {
Expand All @@ -66,7 +66,7 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S
!these.hasNext && !those.hasNext
}

protected def basisForHashCode: Seq[Any] = theSeq
override protected def basisForHashCode: Seq[Any] = theSeq

override def canEqual(other: Any) = other match {
case _: NodeSeq => true
Expand Down
22 changes: 11 additions & 11 deletions shared/src/main/scala/scala/xml/Null.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ case object Null extends MetaData {
override def append(m: MetaData, scope: NamespaceBinding = TopScope): MetaData = m
override def filter(f: MetaData => Boolean): MetaData = this

def copy(next: MetaData) = next
def getNamespace(owner: Node) = null
override def copy(next: MetaData) = next
override def getNamespace(owner: Node) = null

override def hasNext = false
def next = null
def key = null
def value = null
def isPrefixed = false
override def next = null
override def key = null
override def value = null
override def isPrefixed = false

override def length = 0
override def length(i: Int) = i
Expand All @@ -48,12 +48,12 @@ case object Null extends MetaData {
}
override protected def basisForHashCode: Seq[Any] = Nil

def apply(namespace: String, scope: NamespaceBinding, key: String) = null
def apply(key: String) =
override def apply(namespace: String, scope: NamespaceBinding, key: String) = null
override def apply(key: String) =
if (isNameStart(key.head)) null
else throw new IllegalArgumentException("not a valid attribute name '" + key + "', so can never match !")

protected def toString1(sb: StringBuilder) = ()
override protected def toString1(sb: StringBuilder) = ()
override protected def toString1(): String = ""

override def toString(): String = ""
Expand All @@ -62,6 +62,6 @@ case object Null extends MetaData {

override def wellformed(scope: NamespaceBinding) = true

def remove(key: String) = this
def remove(namespace: String, scope: NamespaceBinding, key: String) = this
override def remove(key: String) = this
override def remove(namespace: String, scope: NamespaceBinding, key: String) = this
}
16 changes: 8 additions & 8 deletions shared/src/main/scala/scala/xml/PrefixedAttribute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import scala.collection.Seq
* @param next1
*/
class PrefixedAttribute(
val pre: String,
val key: String,
val value: Seq[Node],
override val pre: String,
override val key: String,
override val value: Seq[Node],
val next1: MetaData)
extends Attribute {
val next = if (value ne null) next1 else next1.remove(key)
override val next = if (value ne null) next1 else next1.remove(key)

/** same as this(pre, key, Text(value), next), or no attribute if value is null */
def this(pre: String, key: String, value: String, next: MetaData) =
Expand All @@ -43,19 +43,19 @@ class PrefixedAttribute(
* Returns a copy of this unprefixed attribute with the given
* next field.
*/
def copy(next: MetaData) =
override def copy(next: MetaData) =
new PrefixedAttribute(pre, key, value, next)

def getNamespace(owner: Node) =
override def getNamespace(owner: Node) =
owner.getNamespace(pre)

/** forwards the call to next (because caller looks for unprefixed attribute */
def apply(key: String): Seq[Node] = next(key)
override def apply(key: String): Seq[Node] = next(key)

/**
* gets attribute value of qualified (prefixed) attribute with given key
*/
def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = {
override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = {
if (key == this.key && scope.getURI(pre) == namespace)
value
else
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/ProcInstr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case class ProcInstr(target: String, proctext: String) extends SpecialNode {
final override def doCollectNamespaces = false
final override def doTransform = false

final def label = "#PI"
final override def label = "#PI"
override def text = ""

/**
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/SpecialNode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class SpecialNode extends Node {
final override def namespace = null

/** always empty */
final def child = Nil
final override def child = Nil

/** Append string representation to the given string buffer argument. */
def buildString(sb: StringBuilder): StringBuilder
Expand Down
16 changes: 8 additions & 8 deletions shared/src/main/scala/scala/xml/UnprefixedAttribute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import scala.collection.Seq
* @author Burak Emir
*/
class UnprefixedAttribute(
val key: String,
val value: Seq[Node],
override val key: String,
override val value: Seq[Node],
next1: MetaData)
extends Attribute {
final val pre = null
val next = if (value ne null) next1 else next1.remove(key)
final override val pre = null
override val next = if (value ne null) next1 else next1.remove(key)

/** same as this(key, Text(value), next), or no attribute if value is null */
def this(key: String, value: String, next: MetaData) =
Expand All @@ -37,17 +37,17 @@ class UnprefixedAttribute(
this(key, value.orNull, next)

/** returns a copy of this unprefixed attribute with the given next field*/
def copy(next: MetaData) = new UnprefixedAttribute(key, value, next)
override def copy(next: MetaData) = new UnprefixedAttribute(key, value, next)

final def getNamespace(owner: Node): String = null
final override def getNamespace(owner: Node): String = null

/**
* Gets value of unqualified (unprefixed) attribute with given key, null if not found
*
* @param key
* @return value as Seq[Node] if key is found, null otherwise
*/
def apply(key: String): Seq[Node] =
override def apply(key: String): Seq[Node] =
if (key == this.key) value else next(key)

/**
Expand All @@ -58,7 +58,7 @@ class UnprefixedAttribute(
* @param key
* @return ..
*/
def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] =
override def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] =
next(namespace, scope, key)
}
object UnprefixedAttribute {
Expand Down
Loading