Follow-up to the fields added in #173

It turns out that there is more boilerplate to fill that I missed.

Also add deprecation notices.
This commit is contained in:
Guillaume Martres 2018-08-28 01:14:24 +09:00
parent a90675635f
commit e905b44a33
4 changed files with 29 additions and 1 deletions

View File

@ -16,6 +16,12 @@ type Position {
pointerSpace: String
sourcePath: String
sourceFile: java.io.File
startOffset: Int
endOffset: Int
startLine: Int
startColumn: Int
endLine: Int
endColumn: Int
}
type Problem {

View File

@ -19,6 +19,13 @@ trait PositionFormats { self: sjsonnew.BasicJsonProtocol =>
val pointerSpace0 = unbuilder.readField[Optional[String]]("pointerSpace")
val sourcePath0 = unbuilder.readField[Optional[String]]("sourcePath")
val sourceFile0 = unbuilder.readField[Optional[java.io.File]]("sourceFile")
val startOffset0 = unbuilder.readField[Optional[java.lang.Integer]]("startOffset")
val endOffset0 = unbuilder.readField[Optional[java.lang.Integer]]("endOffset")
val startLine0 = unbuilder.readField[Optional[java.lang.Integer]]("startLine")
val startColumn0 = unbuilder.readField[Optional[java.lang.Integer]]("startColumn")
val endLine0 = unbuilder.readField[Optional[java.lang.Integer]]("endLine")
val endColumn0 = unbuilder.readField[Optional[java.lang.Integer]]("endColumn")
unbuilder.endObject()
new Position() {
override val line = line0
@ -28,6 +35,13 @@ trait PositionFormats { self: sjsonnew.BasicJsonProtocol =>
override val pointerSpace = pointerSpace0
override val sourcePath = sourcePath0
override val sourceFile = sourceFile0
override val startOffset = startOffset0
override val endOffset = endOffset0
override val startLine = startLine0
override val startColumn = startColumn0
override val endLine = endLine0
override val endColumn = endColumn0
}
case None =>
deserializationError("Expected JsObject but found None")
@ -42,6 +56,13 @@ trait PositionFormats { self: sjsonnew.BasicJsonProtocol =>
builder.addField("pointerSpace", obj.pointerSpace)
builder.addField("sourcePath", obj.sourcePath)
builder.addField("sourceFile", obj.sourceFile)
builder.addField("startOffset", obj.startOffset)
builder.addField("endOffset", obj.endOffset)
builder.addField("startLine", obj.startLine)
builder.addField("startColumn", obj.startColumn)
builder.addField("endLine", obj.endLine)
builder.addField("endColumn", obj.endColumn)
builder.endObject()
}
}

View File

@ -36,7 +36,7 @@ object InterfaceUtil {
case None => Optional.empty[A]()
}
// Overload to preserve binary compatibility
@deprecated("Use the overload of this method with more arguments", "1.2.2")
def position(
line0: Option[Integer],
content: String,

View File

@ -97,6 +97,7 @@ object Logger {
def jo2o[A](o: Optional[A]): Option[A] = InterfaceUtil.jo2o(o)
def o2jo[A](o: Option[A]): Optional[A] = InterfaceUtil.o2jo(o)
@deprecated("Use InterfaceUtil.position", "1.2.2")
def position(
line0: Option[Integer],
content: String,