Skip to content

Commit 523e51b

Browse files
authored
Merge pull request #207 from xuwei-k/procedure-syntax
add -Xfuture option. fix procedure syntax warnings
2 parents 8998e4f + 3c1523b commit 523e51b

24 files changed

+88
-88
lines changed

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lazy val xml = crossProject.in(file("."))
2222
name := "scala-xml",
2323
version := "1.1.1-SNAPSHOT",
2424

25-
scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq],
25+
scalacOptions ++= "-deprecation:false -Xfuture -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq],
2626
scalacOptions in Test += "-Xxml:coalescing",
2727

2828
apiMappings ++= Map(

jvm/src/test/scala/scala/xml/XMLTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class XMLTestJVM {
199199
new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer))
200200
in.readObject().asInstanceOf[A]
201201
}
202-
def check[A, B](x: A, y: B) {
202+
def check[A, B](x: A, y: B): Unit = {
203203
// println("x = " + x)
204204
// println("y = " + y)
205205
// println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x))

jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class XMLEventReaderTest {
1313

1414
private def toSource(s: String) = new Source {
1515
val iter = s.iterator
16-
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) {}
16+
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {}
1717
}
1818

1919
@Test

shared/src/main/scala/scala/xml/Attribute.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ abstract trait Attribute extends MetaData {
8888
/**
8989
* Appends string representation of only this attribute to stringbuffer.
9090
*/
91-
protected def toString1(sb: StringBuilder) {
91+
protected def toString1(sb: StringBuilder): Unit = {
9292
if (value == null)
9393
return
9494
if (isPrefixed)

shared/src/main/scala/scala/xml/NamespaceBinding.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin
6767

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

70-
def buildString(sb: StringBuilder, stop: NamespaceBinding) {
70+
def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = {
7171
shadowRedefined(stop).doBuildString(sb, stop)
7272
}
7373

74-
private def doBuildString(sb: StringBuilder, stop: NamespaceBinding) {
74+
private def doBuildString(sb: StringBuilder, stop: NamespaceBinding): Unit = {
7575
if (List(null, stop, TopScope).contains(this)) return
7676

7777
val s = " xmlns%s=\"%s\"".format(

shared/src/main/scala/scala/xml/PrettyPrinter.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {
9595
}
9696

9797
protected def leafTag(n: Node) = {
98-
def mkLeaf(sb: StringBuilder) {
98+
def mkLeaf(sb: StringBuilder): Unit = {
9999
sb append '<'
100100
n nameToString sb
101101
n.attributes buildString sb
@@ -106,7 +106,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {
106106

107107
protected def startTag(n: Node, pscope: NamespaceBinding): (String, Int) = {
108108
var i = 0
109-
def mkStart(sb: StringBuilder) {
109+
def mkStart(sb: StringBuilder): Unit = {
110110
sb append '<'
111111
n nameToString sb
112112
i = sb.length + 1
@@ -118,7 +118,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {
118118
}
119119

120120
protected def endTag(n: Node) = {
121-
def mkEnd(sb: StringBuilder) {
121+
def mkEnd(sb: StringBuilder): Unit = {
122122
sb append "</"
123123
n nameToString sb
124124
sb append '>'
@@ -203,11 +203,11 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {
203203
* @param n the node to be serialized
204204
* @param sb the stringbuffer to append to
205205
*/
206-
def format(n: Node, sb: StringBuilder) { // entry point
206+
def format(n: Node, sb: StringBuilder): Unit = { // entry point
207207
format(n, TopScope, sb)
208208
}
209209

210-
def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder) { // entry point
210+
def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder): Unit = { // entry point
211211
var lastwasbreak = false
212212
reset()
213213
traverse(n, pscope, 0)

shared/src/main/scala/scala/xml/Utility.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ object Utility extends AnyRef with parsing.TokenTests {
138138
/**
139139
* Adds all namespaces in node to set.
140140
*/
141-
def collectNamespaces(n: Node, set: mutable.Set[String]) {
141+
def collectNamespaces(n: Node, set: mutable.Set[String]): Unit = {
142142
if (n.doCollectNamespaces) {
143143
set += n.namespace
144144
for (a <- n.attributes) a match {

shared/src/main/scala/scala/xml/XML.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ object XML extends XMLLoader[Elem] {
107107
* @param xmlDecl if true, write xml declaration
108108
* @param doctype if not null, write doctype declaration
109109
*/
110-
final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default) {
110+
final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default): Unit = {
111111
/* TODO: optimize by giving writer parameter to toXML*/
112112
if (xmlDecl) w.write("<?xml version='1.0' encoding='" + enc + "'?>\n")
113113
if (doctype ne null) w.write(doctype.toString() + "\n")

shared/src/main/scala/scala/xml/dtd/ContentModel.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object ContentModel extends WordExp {
5454
def buildString(r: RegExp): String = sbToString(buildString(r, _))
5555

5656
/* precond: rs.length >= 1 */
57-
private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char) {
57+
private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char): Unit = {
5858
buildString(rs.head, sb)
5959
for (z <- rs.tail) {
6060
sb append sep

shared/src/main/scala/scala/xml/dtd/Decl.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ sealed abstract class EntityDef {
103103
}
104104

105105
case class IntDef(value: String) extends EntityDef {
106-
private def validateValue() {
106+
private def validateValue(): Unit = {
107107
var tmp = value
108108
var ix = tmp indexOf '%'
109109
while (ix != -1) {

shared/src/main/scala/scala/xml/dtd/ElementValidator.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ElementValidator() extends Function1[Node, Boolean] {
4545
def getContentModel = contentModel
4646

4747
/** set meta data, enabling attribute validation */
48-
def setMetaData(adecls: List[AttrDecl]) { this.adecls = adecls }
48+
def setMetaData(adecls: List[AttrDecl]): Unit = { this.adecls = adecls }
4949

5050
def getIterable(nodes: Seq[Node], skipPCDATA: Boolean): Iterable[ElemName] = {
5151
def isAllWhitespace(a: Atom[_]) = cond(a.data) { case s: String if s.trim == "" => true }

shared/src/main/scala/scala/xml/dtd/Scanner.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Scanner extends Tokens with parsing.TokenTests {
2525
private var c: Char = 'z'
2626

2727
/** initializes the scanner on input s */
28-
final def initScanner(s: String) {
28+
final def initScanner(s: String): Unit = {
2929
value = ""
3030
it = (s).iterator
3131
token = 1 + END
@@ -34,7 +34,7 @@ class Scanner extends Tokens with parsing.TokenTests {
3434
}
3535

3636
/** scans the next token */
37-
final def nextToken() {
37+
final def nextToken(): Unit = {
3838
if (token != END) token = readToken
3939
}
4040

@@ -44,11 +44,11 @@ class Scanner extends Tokens with parsing.TokenTests {
4444

4545
final def next() = if (it.hasNext) c = it.next() else c = ENDCH
4646

47-
final def acc(d: Char) {
47+
final def acc(d: Char): Unit = {
4848
if (c == d) next() else scala.sys.error("expected '" + d + "' found '" + c + "' !")
4949
}
5050

51-
final def accS(ds: Seq[Char]) { ds foreach acc }
51+
final def accS(ds: Seq[Char]): Unit = { ds foreach acc }
5252

5353
final def readToken: Int =
5454
if (isSpace(c)) {

shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
3636

3737
rest.push(sink, q0)
3838

39-
def addFinal(q: immutable.BitSet) {
39+
def addFinal(q: immutable.BitSet): Unit = {
4040
if (nfa containsFinal q)
4141
finals = finals.updated(q, selectTag(q, nfa.finals))
4242
}
43-
def add(Q: immutable.BitSet) {
43+
def add(Q: immutable.BitSet): Unit = {
4444
if (!states(Q)) {
4545
states += Q
4646
rest push Q

shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi {
7373
*/
7474

7575
/** Called at the leaves of the regexp */
76-
protected def seenLabel(r: RegExp, i: Int, label: _labelT) {
76+
protected def seenLabel(r: RegExp, i: Int, label: _labelT): Unit = {
7777
labelAt = labelAt.updated(i, label)
7878
this.labels += label
7979
}
@@ -92,7 +92,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi {
9292
case _ => super.traverse(r)
9393
}
9494

95-
protected def makeTransition(src: Int, dest: Int, label: _labelT) {
95+
protected def makeTransition(src: Int, dest: Int, label: _labelT): Unit = {
9696
val q = deltaq(src)
9797
q.update(label, dest :: q.getOrElse(label, Nil))
9898
}
@@ -109,7 +109,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi {
109109
this.initials = Set(0)
110110
}
111111

112-
protected def initializeAutom() {
112+
protected def initializeAutom(): Unit = {
113113
finals = immutable.Map.empty[Int, Int] // final states
114114
deltaq = new Array[mutable.HashMap[_labelT, List[Int]]](pos) // delta
115115
defaultq = new Array[List[Int]](pos) // default transitions

shared/src/main/scala/scala/xml/include/XIncludeException.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class XIncludeException(message: String) extends Exception(message) {
3939
* @param nestedException the underlying exception which
4040
* caused the XIncludeException to be thrown
4141
*/
42-
def setRootCause(nestedException: Throwable) {
42+
def setRootCause(nestedException: Throwable): Unit = {
4343
this.rootCause = nestedException
4444
}
4545

shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala

+13-13
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class XIncludeFilter extends XMLFilterImpl {
8686
// what if this isn't called????
8787
// do I need to check this in startDocument() and push something
8888
// there????
89-
override def setDocumentLocator(locator: Locator) {
89+
override def setDocumentLocator(locator: Locator): Unit = {
9090
locators push locator
9191
val base = locator.getSystemId()
9292
try {
@@ -113,7 +113,7 @@ class XIncludeFilter extends XMLFilterImpl {
113113
*/
114114
def insideIncludeElement(): Boolean = level != 0
115115

116-
override def startElement(uri: String, localName: String, qName: String, atts1: Attributes) {
116+
override def startElement(uri: String, localName: String, qName: String, atts1: Attributes): Unit = {
117117
var atts = atts1
118118
if (level == 0) { // We're not inside an xi:include element
119119

@@ -169,7 +169,7 @@ class XIncludeFilter extends XMLFilterImpl {
169169
}
170170
}
171171

172-
override def endElement(uri: String, localName: String, qName: String) {
172+
override def endElement(uri: String, localName: String, qName: String): Unit = {
173173
if (uri.equals(XINCLUDE_NAMESPACE)
174174
&& localName.equals("include")) {
175175
level -= 1
@@ -181,41 +181,41 @@ class XIncludeFilter extends XMLFilterImpl {
181181

182182
private var depth = 0
183183

184-
override def startDocument() {
184+
override def startDocument(): Unit = {
185185
level = 0
186186
if (depth == 0) super.startDocument()
187187
depth += 1
188188
}
189189

190-
override def endDocument() {
190+
override def endDocument(): Unit = {
191191
locators.pop()
192192
bases.pop() // pop the URL for the document itself
193193
depth -= 1
194194
if (depth == 0) super.endDocument()
195195
}
196196

197197
// how do prefix mappings move across documents????
198-
override def startPrefixMapping(prefix: String, uri: String) {
198+
override def startPrefixMapping(prefix: String, uri: String): Unit = {
199199
if (level == 0) super.startPrefixMapping(prefix, uri)
200200
}
201201

202-
override def endPrefixMapping(prefix: String) {
202+
override def endPrefixMapping(prefix: String): Unit = {
203203
if (level == 0) super.endPrefixMapping(prefix)
204204
}
205205

206-
override def characters(ch: Array[Char], start: Int, length: Int) {
206+
override def characters(ch: Array[Char], start: Int, length: Int): Unit = {
207207
if (level == 0) super.characters(ch, start, length)
208208
}
209209

210-
override def ignorableWhitespace(ch: Array[Char], start: Int, length: Int) {
210+
override def ignorableWhitespace(ch: Array[Char], start: Int, length: Int): Unit = {
211211
if (level == 0) super.ignorableWhitespace(ch, start, length)
212212
}
213213

214-
override def processingInstruction(target: String, data: String) {
214+
override def processingInstruction(target: String, data: String): Unit = {
215215
if (level == 0) super.processingInstruction(target, data)
216216
}
217217

218-
override def skippedEntity(name: String) {
218+
override def skippedEntity(name: String): Unit = {
219219
if (level == 0) super.skippedEntity(name)
220220
}
221221

@@ -252,7 +252,7 @@ class XIncludeFilter extends XMLFilterImpl {
252252
* be downloaded from the specified URL
253253
* or if the encoding is not recognized
254254
*/
255-
private def includeTextDocument(url: String, encoding1: String) {
255+
private def includeTextDocument(url: String, encoding1: String): Unit = {
256256
var encoding = encoding1
257257
if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8"
258258
var source: URL = null
@@ -318,7 +318,7 @@ class XIncludeFilter extends XMLFilterImpl {
318318
* @throws SAXException if the requested document cannot
319319
* be downloaded from the specified URL.
320320
*/
321-
private def includeXMLDocument(url: String) {
321+
private def includeXMLDocument(url: String): Unit = {
322322
val source =
323323
try new URL(bases.peek(), url)
324324
catch {

0 commit comments

Comments
 (0)