All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mill.scalalib.worker.ZincProblemPosition.scala Maven / Gradle / Ivy

There is a newer version: 0.12.0-RC2-17-07e173
Show newest version
package mill.scalalib.worker

import java.io.File
import java.util.Optional

import mill.api.{ProblemPosition, internal}

@internal
class ZincProblemPosition(base: xsbti.Position) extends ProblemPosition {

  object JavaOptionConverter {
    implicit def convertInt(x: Optional[Integer]): Option[Int] =
      if (x.isPresent) Some(x.get().intValue()) else None
    implicit def convert[T](x: Optional[T]): Option[T] = if (x.isPresent) Some(x.get()) else None
  }

  import JavaOptionConverter._

  override def line: Option[Int] = base.line()
  override def lineContent: String = base.lineContent()
  override def offset: Option[Int] = base.offset()
  override def pointer: Option[Int] = base.pointer()
  override def pointerSpace: Option[String] = base.pointerSpace()
  override def sourcePath: Option[String] = base.sourcePath()
  override def sourceFile: Option[File] = base.sourceFile()
  override def startOffset: Option[Int] = base.startOffset()
  override def endOffset: Option[Int] = base.endOffset()
  override def startLine: Option[Int] = base.startLine()
  override def startColumn: Option[Int] = base.startColumn()
  override def endLine: Option[Int] = base.endLine()
  override def endColumn: Option[Int] = base.endColumn()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy