Skip to content

Commit

Permalink
add -Xfuture option. fix procedure syntax warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Apr 2, 2018
1 parent 9f6fccf commit 742d53d
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 28 deletions.
8 changes: 4 additions & 4 deletions ast/src/main/scala/jawn/ast/JawnFacade.scala
Expand Up @@ -22,17 +22,17 @@ object JawnFacade extends Facade[JValue] {
final def singleContext(): RawFContext[JValue] =
new FContext[JValue] {
var value: JValue = _
def add(s: CharSequence) { value = JString(s.toString) }
def add(v: JValue) { value = v }
def add(s: CharSequence): Unit = { value = JString(s.toString) }
def add(v: JValue): Unit = { value = v }
def finish: JValue = value
def isObj: Boolean = false
}

final def arrayContext(): RawFContext[JValue] =
new FContext[JValue] {
val vs = mutable.ArrayBuffer.empty[JValue]
def add(s: CharSequence) { vs.append(JString(s.toString)) }
def add(v: JValue) { vs.append(v) }
def add(s: CharSequence): Unit = { vs.append(JString(s.toString)) }
def add(v: JValue): Unit = { vs.append(v) }
def finish: JValue = JArray(vs.toArray)
def isObj: Boolean = false
}
Expand Down
2 changes: 1 addition & 1 deletion ast/src/test/scala/jawn/ParseCheck.scala
Expand Up @@ -136,7 +136,7 @@ class AstCheck extends PropSpec with Matchers with PropertyChecks {
val n1 = LongNum(n)
val n2 = DoubleNum(n)

def check(j: JValue) {
def check(j: JValue): Unit = {
j shouldBe n1; n1 shouldBe j
j shouldBe n2; n2 shouldBe j
}
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Expand Up @@ -39,6 +39,7 @@ lazy val jawnSettings = Seq(

scalacOptions ++=
"-deprecation" ::
"-Xfuture" ::
"-unchecked" ::
Nil,

Expand Down
4 changes: 2 additions & 2 deletions parser/src/main/scala/jawn/AsyncParser.scala
Expand Up @@ -71,7 +71,7 @@ final class AsyncParser[J] protected[jawn] (

protected[this] var line = 0
protected[this] var pos = 0
protected[this] final def newline(i: Int) { line += 1; pos = i + 1 }
protected[this] final def newline(i: Int): Unit = { line += 1; pos = i + 1 }
protected[this] final def column(i: Int) = i - pos

final def copy() =
Expand Down Expand Up @@ -267,7 +267,7 @@ final class AsyncParser[J] protected[jawn] (
* arguments are the exact arguments we can pass to rparse to
* continue where we left off.
*/
protected[this] final def checkpoint(state: Int, i: Int, stack: List[RawFContext[J]]) {
protected[this] final def checkpoint(state: Int, i: Int, stack: List[RawFContext[J]]): Unit = {
this.state = state
this.curr = i
this.stack = stack
Expand Down
6 changes: 3 additions & 3 deletions parser/src/main/scala/jawn/ByteBufferParser.scala
Expand Up @@ -20,12 +20,12 @@ final class ByteBufferParser[J](src: ByteBuffer) extends SyncParser[J] with Byte
private[this] var lineState = 0
protected[this] def line(): Int = lineState

protected[this] final def newline(i: Int) { lineState += 1 }
protected[this] final def newline(i: Int): Unit = { lineState += 1 }
protected[this] final def column(i: Int) = i

protected[this] final def close() { src.position(src.limit) }
protected[this] final def close(): Unit = { src.position(src.limit) }
protected[this] final def reset(i: Int): Int = i
protected[this] final def checkpoint(state: Int, i: Int, stack: List[RawFContext[J]]) {}
protected[this] final def checkpoint(state: Int, i: Int, stack: List[RawFContext[J]]): Unit = {}
protected[this] final def byte(i: Int): Byte = src.get(i + start)
protected[this] final def at(i: Int): Char = src.get(i + start).toChar

Expand Down
2 changes: 1 addition & 1 deletion parser/src/main/scala/jawn/CharSequenceParser.scala
Expand Up @@ -8,7 +8,7 @@ package jawn
private[jawn] final class CharSequenceParser[J](cs: CharSequence) extends SyncParser[J] with CharBasedParser[J] {
var line = 0
final def column(i: Int) = i
final def newline(i: Int) { line += 1 }
final def newline(i: Int): Unit = { line += 1 }
final def reset(i: Int): Int = i
final def checkpoint(state: Int, i: Int, stack: List[RawFContext[J]]): Unit = ()
final def at(i: Int): Char = cs.charAt(i)
Expand Down
8 changes: 4 additions & 4 deletions parser/src/main/scala/jawn/MutableFacade.scala
Expand Up @@ -8,16 +8,16 @@ trait MutableFacade[J] extends Facade[J] {

def singleContext() = new FContext[J] {
var value: J = _
def add(s: CharSequence) { value = jstring(s) }
def add(v: J) { value = v }
def add(s: CharSequence): Unit = { value = jstring(s) }
def add(v: J): Unit = { value = v }
def finish: J = value
def isObj: Boolean = false
}

def arrayContext() = new FContext[J] {
val vs = mutable.ArrayBuffer.empty[J]
def add(s: CharSequence) { vs.append(jstring(s)) }
def add(v: J) { vs.append(v) }
def add(s: CharSequence): Unit = { vs.append(jstring(s)) }
def add(v: J): Unit = { vs.append(v) }
def finish: J = jarray(vs)
def isObj: Boolean = false
}
Expand Down
8 changes: 4 additions & 4 deletions parser/src/main/scala/jawn/SimpleFacade.scala
Expand Up @@ -15,16 +15,16 @@ trait SimpleFacade[J] extends Facade[J] {

def singleContext() = new FContext[J] {
var value: J = _
def add(s: CharSequence) { value = jstring(s) }
def add(v: J) { value = v }
def add(s: CharSequence): Unit = { value = jstring(s) }
def add(v: J): Unit = { value = v }
def finish: J = value
def isObj: Boolean = false
}

def arrayContext() = new FContext[J] {
val vs = mutable.ListBuffer.empty[J]
def add(s: CharSequence) { vs += jstring(s) }
def add(v: J) { vs += v }
def add(s: CharSequence): Unit = { vs += jstring(s) }
def add(v: J): Unit = { vs += v }
def finish: J = jarray(vs.toList)
def isObj: Boolean = false
}
Expand Down
2 changes: 1 addition & 1 deletion parser/src/main/scala/jawn/StringParser.scala
Expand Up @@ -15,7 +15,7 @@ package jawn
private[jawn] final class StringParser[J](s: String) extends SyncParser[J] with CharBasedParser[J] {
var line = 0
final def column(i: Int) = i
final def newline(i: Int) { line += 1 }
final def newline(i: Int): Unit = { line += 1 }
final def reset(i: Int): Int = i
final def checkpoint(state: Int, i: Int, stack: List[RawFContext[J]]): Unit = ()
final def at(i: Int): Char = s.charAt(i)
Expand Down
8 changes: 4 additions & 4 deletions support/argonaut/src/main/scala/Parser.scala
Expand Up @@ -17,16 +17,16 @@ object Parser extends SupportParser[Json] {

def singleContext() = new FContext[Json] {
var value: Json = null
def add(s: CharSequence) { value = jstring(s) }
def add(v: Json) { value = v }
def add(s: CharSequence): Unit = { value = jstring(s) }
def add(v: Json): Unit = { value = v }
def finish: Json = value
def isObj: Boolean = false
}

def arrayContext() = new FContext[Json] {
val vs = mutable.ListBuffer.empty[Json]
def add(s: CharSequence) { vs += jstring(s) }
def add(v: Json) { vs += v }
def add(s: CharSequence): Unit = { vs += jstring(s) }
def add(v: Json): Unit = { vs += v }
def finish: Json = Json.jArray(vs.toList)
def isObj: Boolean = false
}
Expand Down
8 changes: 4 additions & 4 deletions support/json4s/src/main/scala/Parser.scala
Expand Up @@ -28,17 +28,17 @@ class Parser(useBigDecimalForDouble: Boolean, useBigIntForLong: Boolean) extends
def singleContext() =
new FContext[JValue] {
var value: JValue = null
def add(s: CharSequence) { value = jstring(s) }
def add(v: JValue) { value = v }
def add(s: CharSequence): Unit = { value = jstring(s) }
def add(v: JValue): Unit = { value = v }
def finish: JValue = value
def isObj: Boolean = false
}

def arrayContext() =
new FContext[JValue] {
val vs = mutable.ListBuffer.empty[JValue]
def add(s: CharSequence) { vs += jstring(s) }
def add(v: JValue) { vs += v }
def add(s: CharSequence): Unit = { vs += jstring(s) }
def add(v: JValue): Unit = { vs += v }
def finish: JValue = JArray(vs.toList)
def isObj: Boolean = false
}
Expand Down

0 comments on commit 742d53d

Please sign in to comment.