Skip to content

Commit ee3212d

Browse files
committed
Add missing type annotations that do not break binary compatibility
Some missing type annotations can be added without breaking binary compatibility; they are added in this pull request, letting #655 concentrate on adding type annotations that _do_ break binary compatibility (for Scala 3). Removed MiMa exclusions that are no longer needed. Removed Gitter link to a non-existing room. Added links to the compiler implementation of the `SymbolicXMLBuilder` for different versions of Scala.
1 parent cf5763e commit ee3212d

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ scala-xml
22
[![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12)
33
[![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13)
44
[![latest release for 3.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_3.svg?label=scala+3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_3)
5-
[![Gitter](https://badges.gitter.im/Join+Chat.svg)](https://gitter.im/scala/scala-xml)
65
=========
76

87
The standard Scala XML library. Please file XML issues here, not at https://github.com/scala/bug/issues or http://github.com/lampepfl/dotty/issues.
98

10-
The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (This [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala) shows the calls needed.)
9+
The decoupling of scala-xml from the Scala compiler and standard library is possible because the compiler desugars XML literals in Scala source code into a set of method calls.
10+
Alternative implementations of these calls are welcome!
11+
Compiler code that shows the calls needed:
12+
[Scala 2.11](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala),
13+
[Scala 2.12](https://github.com/scala/scala/blob/2.12.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala),
14+
[Scala 2.13](https://github.com/scala/scala/blob/2.13.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala),
15+
[Scala 3](https://github.com/lampepfl/dotty/blob/main/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala).
1116

1217
API documentation is available [here](https://javadoc.io/doc/org.scala-lang.modules/scala-xml_2.13/).
1318

build.sbt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
6868
import com.typesafe.tools.mima.core._
6969
import com.typesafe.tools.mima.core.ProblemFilters._
7070
Seq(
71-
// afaict this is just a JDK 8 vs 16 difference, producing a false positive when
72-
// we compare classes built on JDK 16 (which we only do on CI, not at release time)
73-
// to previous-version artifacts that were built on 8. see scala/scala-xml#501
74-
exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"),
75-
76-
// necessitated by the switch from DefaultHandler to DefaultHandler2 in FactoryAdapter:
77-
exclude[MissingTypesProblem]("scala.xml.parsing.FactoryAdapter"), // see #549
78-
7971
// necessitated by the introduction of new abstract methods in FactoryAdapter:
8072
exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createComment"), // see #549
8173
exclude[ReversedMissingMethodProblem]("scala.xml.parsing.FactoryAdapter.createPCData") // see #558

shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
package scala.xml
1414

15-
import scala.collection.SeqLike
15+
import scala.collection.{SeqLike, mutable}
1616
import scala.collection.generic.CanBuildFrom
1717

1818
private[xml] object ScalaVersionSpecific {
1919
import NodeSeq.Coll
2020
type CBF[-From, -A, +C] = CanBuildFrom[From, A, C]
2121
object NodeSeqCBF extends CanBuildFrom[Coll, Node, NodeSeq] {
22-
override def apply(from: Coll) /* TODO type annotation */ = NodeSeq.newBuilder
23-
override def apply() /* TODO type annotation */ = NodeSeq.newBuilder
22+
override def apply(from: Coll): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder
23+
override def apply(): mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder
2424
}
2525
}
2626

2727
private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] { self: NodeSeq =>
2828
/** Creates a list buffer as builder for this class */
29-
override protected[this] def newBuilder /* TODO type annotation */ = NodeSeq.newBuilder
29+
override protected[this] def newBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder
3030
}
3131

3232
private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer =>

shared/src/main/scala/scala/xml/Null.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import scala.collection.Seq
2424
* @author Burak Emir
2525
*/
2626
case object Null extends MetaData {
27-
override def iterator /* TODO type annotation */ = Iterator.empty
27+
override def iterator: Iterator[Nothing] = Iterator.empty
2828
override def size: Int = 0
2929
override def append(m: MetaData, scope: NamespaceBinding = TopScope): MetaData = m
3030
override def filter(f: MetaData => Boolean): MetaData = this

0 commit comments

Comments
 (0)