Skip to content

add -Xfuture option. fix procedure syntax warnings #207

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
Apr 9, 2018
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
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ lazy val xml = crossProject.in(file("."))
name := "scala-xml",
version := "1.1.1-SNAPSHOT",

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

apiMappings ++= Map(
Expand Down
2 changes: 1 addition & 1 deletion jvm/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class XMLTestJVM {
new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer))
in.readObject().asInstanceOf[A]
}
def check[A, B](x: A, y: B) {
def check[A, B](x: A, y: B): Unit = {
// println("x = " + x)
// println("y = " + y)
// println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x))
Expand Down
2 changes: 1 addition & 1 deletion jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class XMLEventReaderTest {

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

@Test
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Attribute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ abstract trait Attribute extends MetaData {
/**
* Appends string representation of only this attribute to stringbuffer.
*/
protected def toString1(sb: StringBuilder) {
protected def toString1(sb: StringBuilder): Unit = {
if (value == null)
return
if (isPrefixed)
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/scala/xml/NamespaceBinding.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBindin

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

def buildString(sb: StringBuilder, stop: NamespaceBinding) {
def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = {
shadowRedefined(stop).doBuildString(sb, stop)
}

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

val s = " xmlns%s=\"%s\"".format(
Expand Down
10 changes: 5 additions & 5 deletions shared/src/main/scala/scala/xml/PrettyPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {
}

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

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

protected def endTag(n: Node) = {
def mkEnd(sb: StringBuilder) {
def mkEnd(sb: StringBuilder): Unit = {
sb append "</"
n nameToString sb
sb append '>'
Expand Down Expand Up @@ -203,11 +203,11 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {
* @param n the node to be serialized
* @param sb the stringbuffer to append to
*/
def format(n: Node, sb: StringBuilder) { // entry point
def format(n: Node, sb: StringBuilder): Unit = { // entry point
format(n, TopScope, sb)
}

def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder) { // entry point
def format(n: Node, pscope: NamespaceBinding, sb: StringBuilder): Unit = { // entry point
var lastwasbreak = false
reset()
traverse(n, pscope, 0)
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Utility.scala
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ object Utility extends AnyRef with parsing.TokenTests {
/**
* Adds all namespaces in node to set.
*/
def collectNamespaces(n: Node, set: mutable.Set[String]) {
def collectNamespaces(n: Node, set: mutable.Set[String]): Unit = {
if (n.doCollectNamespaces) {
set += n.namespace
for (a <- n.attributes) a match {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/XML.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ object XML extends XMLLoader[Elem] {
* @param xmlDecl if true, write xml declaration
* @param doctype if not null, write doctype declaration
*/
final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default) {
final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType, minimizeTags: MinimizeMode.Value = MinimizeMode.Default): Unit = {
/* TODO: optimize by giving writer parameter to toXML*/
if (xmlDecl) w.write("<?xml version='1.0' encoding='" + enc + "'?>\n")
if (doctype ne null) w.write(doctype.toString() + "\n")
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/dtd/ContentModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object ContentModel extends WordExp {
def buildString(r: RegExp): String = sbToString(buildString(r, _))

/* precond: rs.length >= 1 */
private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char) {
private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char): Unit = {
buildString(rs.head, sb)
for (z <- rs.tail) {
sb append sep
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/dtd/Decl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ sealed abstract class EntityDef {
}

case class IntDef(value: String) extends EntityDef {
private def validateValue() {
private def validateValue(): Unit = {
var tmp = value
var ix = tmp indexOf '%'
while (ix != -1) {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/dtd/ElementValidator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ElementValidator() extends Function1[Node, Boolean] {
def getContentModel = contentModel

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

def getIterable(nodes: Seq[Node], skipPCDATA: Boolean): Iterable[ElemName] = {
def isAllWhitespace(a: Atom[_]) = cond(a.data) { case s: String if s.trim == "" => true }
Expand Down
8 changes: 4 additions & 4 deletions shared/src/main/scala/scala/xml/dtd/Scanner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Scanner extends Tokens with parsing.TokenTests {
private var c: Char = 'z'

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

/** scans the next token */
final def nextToken() {
final def nextToken(): Unit = {
if (token != END) token = readToken
}

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

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

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

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

final def readToken: Int =
if (isSpace(c)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])

rest.push(sink, q0)

def addFinal(q: immutable.BitSet) {
def addFinal(q: immutable.BitSet): Unit = {
if (nfa containsFinal q)
finals = finals.updated(q, selectTag(q, nfa.finals))
}
def add(Q: immutable.BitSet) {
def add(Q: immutable.BitSet): Unit = {
if (!states(Q)) {
states += Q
rest push Q
Expand Down
6 changes: 3 additions & 3 deletions shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private[dtd] abstract class WordBerrySethi extends BaseBerrySethi {
*/

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

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

protected def initializeAutom() {
protected def initializeAutom(): Unit = {
finals = immutable.Map.empty[Int, Int] // final states
deltaq = new Array[mutable.HashMap[_labelT, List[Int]]](pos) // delta
defaultq = new Array[List[Int]](pos) // default transitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class XIncludeException(message: String) extends Exception(message) {
* @param nestedException the underlying exception which
* caused the XIncludeException to be thrown
*/
def setRootCause(nestedException: Throwable) {
def setRootCause(nestedException: Throwable): Unit = {
this.rootCause = nestedException
}

Expand Down
26 changes: 13 additions & 13 deletions shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class XIncludeFilter extends XMLFilterImpl {
// what if this isn't called????
// do I need to check this in startDocument() and push something
// there????
override def setDocumentLocator(locator: Locator) {
override def setDocumentLocator(locator: Locator): Unit = {
locators push locator
val base = locator.getSystemId()
try {
Expand All @@ -113,7 +113,7 @@ class XIncludeFilter extends XMLFilterImpl {
*/
def insideIncludeElement(): Boolean = level != 0

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

Expand Down Expand Up @@ -169,7 +169,7 @@ class XIncludeFilter extends XMLFilterImpl {
}
}

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

private var depth = 0

override def startDocument() {
override def startDocument(): Unit = {
level = 0
if (depth == 0) super.startDocument()
depth += 1
}

override def endDocument() {
override def endDocument(): Unit = {
locators.pop()
bases.pop() // pop the URL for the document itself
depth -= 1
if (depth == 0) super.endDocument()
}

// how do prefix mappings move across documents????
override def startPrefixMapping(prefix: String, uri: String) {
override def startPrefixMapping(prefix: String, uri: String): Unit = {
if (level == 0) super.startPrefixMapping(prefix, uri)
}

override def endPrefixMapping(prefix: String) {
override def endPrefixMapping(prefix: String): Unit = {
if (level == 0) super.endPrefixMapping(prefix)
}

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

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

override def processingInstruction(target: String, data: String) {
override def processingInstruction(target: String, data: String): Unit = {
if (level == 0) super.processingInstruction(target, data)
}

override def skippedEntity(name: String) {
override def skippedEntity(name: String): Unit = {
if (level == 0) super.skippedEntity(name)
}

Expand Down Expand Up @@ -252,7 +252,7 @@ class XIncludeFilter extends XMLFilterImpl {
* be downloaded from the specified URL
* or if the encoding is not recognized
*/
private def includeTextDocument(url: String, encoding1: String) {
private def includeTextDocument(url: String, encoding1: String): Unit = {
var encoding = encoding1
if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8"
var source: URL = null
Expand Down Expand Up @@ -318,7 +318,7 @@ class XIncludeFilter extends XMLFilterImpl {
* @throws SAXException if the requested document cannot
* be downloaded from the specified URL.
*/
private def includeXMLDocument(url: String) {
private def includeXMLDocument(url: String): Unit = {
val source =
try new URL(bases.peek(), url)
catch {
Expand Down
Loading