fix Scala 2.13 warnings

This commit is contained in:
xuwei-k 2021-11-14 22:59:34 +09:00
parent fe02f99a74
commit 535b15b83e
51 changed files with 99 additions and 99 deletions

View File

@ -1104,7 +1104,7 @@ lazy val serverTestProj = (project in file("server-test"))
val rawClasspath = val rawClasspath =
(Compile / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator) (Compile / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator)
val cp = val cp =
if (scala.util.Properties.isWin) rawClasspath.replaceAllLiterally("\\", "\\\\") if (scala.util.Properties.isWin) rawClasspath.replace("\\", "\\\\")
else rawClasspath else rawClasspath
val content = { val content = {
s"""| s"""|

View File

@ -30,7 +30,7 @@ final case class HCons[H, T <: HList](head: H, tail: T) extends HList {
type Wrap[M[_]] = M[H] :+: T#Wrap[M] type Wrap[M[_]] = M[H] :+: T#Wrap[M]
def :+:[G](g: G): G :+: H :+: T = HCons(g, this) def :+:[G](g: G): G :+: H :+: T = HCons(g, this)
override def toString = head + " :+: " + tail.toString override def toString = head.toString + " :+: " + tail.toString
} }
object HList { object HList {

View File

@ -43,7 +43,7 @@ private final class Settings0[ScopeType](
(data get scope).flatMap(_ get key) (data get scope).flatMap(_ get key)
def set[T](scope: ScopeType, key: AttributeKey[T], value: T): Settings[ScopeType] = { def set[T](scope: ScopeType, key: AttributeKey[T], value: T): Settings[ScopeType] = {
val map = data getOrElse (scope, AttributeMap.empty) val map = data.getOrElse(scope, AttributeMap.empty)
val newData = data.updated(scope, map.put(key, value)) val newData = data.updated(scope, map.put(key, value))
new Settings0(newData, delegates) new Settings0(newData, delegates)
} }
@ -476,7 +476,7 @@ trait Init[ScopeType] {
if (posDefined.size == settings.size) "defined at:" if (posDefined.size == settings.size) "defined at:"
else else
"some of the defining occurrences:" "some of the defining occurrences:"
header + (posDefined.distinct mkString ("\n\t", "\n\t", "\n")) header + (posDefined.distinct.mkString("\n\t", "\n\t", "\n"))
} else "" } else ""
} }
@ -711,10 +711,10 @@ trait Init[ScopeType] {
def mapReferenced(g: MapScoped): Setting[T] = make(key, init mapReferenced g, pos) def mapReferenced(g: MapScoped): Setting[T] = make(key, init mapReferenced g, pos)
def validateReferenced(g: ValidateRef): Either[Seq[Undefined], Setting[T]] = def validateReferenced(g: ValidateRef): Either[Seq[Undefined], Setting[T]] =
(init validateReferenced g).right.map(newI => make(key, newI, pos)) (init validateReferenced g).map(newI => make(key, newI, pos))
private[sbt] def validateKeyReferenced(g: ValidateKeyRef): Either[Seq[Undefined], Setting[T]] = private[sbt] def validateKeyReferenced(g: ValidateKeyRef): Either[Seq[Undefined], Setting[T]] =
(init validateKeyReferenced g).right.map(newI => make(key, newI, pos)) (init validateKeyReferenced g).map(newI => make(key, newI, pos))
def mapKey(g: MapScoped): Setting[T] = make(g(key), init, pos) def mapKey(g: MapScoped): Setting[T] = make(g(key), init, pos)
def mapInit(f: (ScopedKey[T], T) => T): Setting[T] = make(key, init(t => f(key, t)), pos) def mapInit(f: (ScopedKey[T], T) => T): Setting[T] = make(key, init(t => f(key, t)), pos)
@ -879,8 +879,7 @@ trait Init[ScopeType] {
def evaluate(ss: Settings[ScopeType]): T = f(in evaluate ss) evaluate ss def evaluate(ss: Settings[ScopeType]): T = f(in evaluate ss) evaluate ss
def mapReferenced(g: MapScoped) = new Bind[S, T](s => f(s) mapReferenced g, in mapReferenced g) def mapReferenced(g: MapScoped) = new Bind[S, T](s => f(s) mapReferenced g, in mapReferenced g)
def validateKeyReferenced(g: ValidateKeyRef) = (in validateKeyReferenced g).right.map { def validateKeyReferenced(g: ValidateKeyRef) = (in validateKeyReferenced g).map { validIn =>
validIn =>
new Bind[S, T](s => handleUndefined(f(s) validateKeyReferenced g), validIn) new Bind[S, T](s => handleUndefined(f(s) validateKeyReferenced g), validIn)
} }
@ -898,7 +897,7 @@ trait Init[ScopeType] {
def validateKeyReferenced(g: ValidateKeyRef) = a match { def validateKeyReferenced(g: ValidateKeyRef) = a match {
case None => Right(this) case None => Right(this)
case Some(i) => Right(new Optional(i.validateKeyReferenced(g).right.toOption, f)) case Some(i) => Right(new Optional(i.validateKeyReferenced(g).toOption, f))
} }
def mapConstant(g: MapConstant): Initialize[T] = new Optional(a map mapConstantT(g).fn, f) def mapConstant(g: MapConstant): Initialize[T] = new Optional(a map mapConstantT(g).fn, f)

View File

@ -43,7 +43,7 @@ object Util {
def camelToHyphen(s: String): String = def camelToHyphen(s: String): String =
Camel.replaceAllIn(s, m => m.group(1) + "-" + m.group(2).toLowerCase(Locale.ENGLISH)) Camel.replaceAllIn(s, m => m.group(1) + "-" + m.group(2).toLowerCase(Locale.ENGLISH))
def quoteIfKeyword(s: String): String = if (ScalaKeywords.values(s)) '`' + s + '`' else s def quoteIfKeyword(s: String): String = if (ScalaKeywords.values(s)) s"`${s}`" else s
def ignoreResult[T](f: => T): Unit = macro Macro.ignore def ignoreResult[T](f: => T): Unit = macro Macro.ignore

View File

@ -909,7 +909,7 @@ private final class StringLiteral(str: String, start: Int) extends ValidParser[S
if (str.charAt(start) == c) stringLiteral(str, start + 1) else new Invalid(resultEmpty) if (str.charAt(start) == c) stringLiteral(str, start + 1) else new Invalid(resultEmpty)
def completions(level: Int) = Completions.single(Completion.suggestion(str.substring(start))) def completions(level: Int) = Completions.single(Completion.suggestion(str.substring(start)))
override def toString = '"' + str + '"' override def toString = "\"" + str + "\""
} }
private final class CharacterClass(f: Char => Boolean, label: String) extends ValidParser[Char] { private final class CharacterClass(f: Char => Boolean, label: String) extends ValidParser[Char] {

View File

@ -238,12 +238,12 @@ trait Parsers {
val notDelim = charClass(c => c != open && c != close).*.string val notDelim = charClass(c => c != open && c != close).*.string
def impl(): Parser[String] = { def impl(): Parser[String] = {
(open ~ (notDelim ~ close).?).flatMap { (open ~ (notDelim ~ close).?).flatMap {
case (l, Some((content, r))) => Parser.success(l + content + r) case (l, Some((content, r))) => Parser.success(s"$l$content$r")
case (l, None) => case (l, None) =>
((notDelim ~ impl()).map { ((notDelim ~ impl()).map {
case (leftPrefix, nestedBraces) => leftPrefix + nestedBraces case (leftPrefix, nestedBraces) => leftPrefix + nestedBraces
}.+ ~ notDelim ~ close).map { }.+ ~ notDelim ~ close).map {
case ((nested, suffix), r) => l + nested.mkString + suffix + r case ((nested, suffix), r) => s"$l${nested.mkString}$suffix$r"
} }
} }
} }

View File

@ -83,7 +83,7 @@ object GlobalLogging {
): GlobalLogging = { ): GlobalLogging = {
val loggerName = generateName val loggerName = generateName
val log = LoggerContext.globalContext.logger(loggerName, None, None) val log = LoggerContext.globalContext.logger(loggerName, None, None)
val appender = ConsoleAppender(ConsoleAppender.generateName, console) val appender = ConsoleAppender(ConsoleAppender.generateName(), console)
LoggerContext.globalContext.addAppender(loggerName, appender -> Level.Info) LoggerContext.globalContext.addAppender(loggerName, appender -> Level.Info)
GlobalLogging(log, console, appender, GlobalLogBacking(newBackingFile), newAppender) GlobalLogging(log, console, appender, GlobalLogBacking(newBackingFile), newAppender)
} }

View File

@ -67,14 +67,14 @@ object MainAppender {
) )
def defaultScreen(console: ConsoleOut): Appender = def defaultScreen(console: ConsoleOut): Appender =
ConsoleAppender(ConsoleAppender.generateName, console) ConsoleAppender(ConsoleAppender.generateName(), console)
def defaultScreen( def defaultScreen(
console: ConsoleOut, console: ConsoleOut,
suppressedMessage: SuppressedTraceContext => Option[String] suppressedMessage: SuppressedTraceContext => Option[String]
): Appender = { ): Appender = {
ConsoleAppender( ConsoleAppender(
ConsoleAppender.generateName, ConsoleAppender.generateName(),
console, console,
suppressedMessage = suppressedMessage suppressedMessage = suppressedMessage
) )
@ -99,7 +99,7 @@ object MainAppender {
def defaultBacked(loggerName: String, useFormat: Boolean): PrintWriter => Appender = def defaultBacked(loggerName: String, useFormat: Boolean): PrintWriter => Appender =
to => { to => {
ConsoleAppender( ConsoleAppender(
ConsoleAppender.generateName, ConsoleAppender.generateName(),
ConsoleOut.printWriterOut(to), ConsoleOut.printWriterOut(to),
useFormat = useFormat useFormat = useFormat
) )

View File

@ -99,7 +99,7 @@ private[sbt] final class ProgressState(
addBytes(terminal, bytes) addBytes(terminal, bytes)
val toWrite = new ArrayBuffer[Byte] val toWrite = new ArrayBuffer[Byte]
terminal.prompt match { terminal.prompt match {
case a: Prompt.AskUser if a.render.nonEmpty && canClearPrompt => toWrite ++= cleanPrompt case a: Prompt.AskUser if a.render().nonEmpty && canClearPrompt => toWrite ++= cleanPrompt
case _ => case _ =>
} }
val endsWithNewLine = bytes.endsWith(lineSeparatorBytes) val endsWithNewLine = bytes.endsWith(lineSeparatorBytes)

View File

@ -905,7 +905,7 @@ object Terminal {
new AtomicReference[((Int, Int), Deadline)](((1, 1), Deadline.now - 1.day)) new AtomicReference[((Int, Int), Deadline)](((1, 1), Deadline.now - 1.day))
private[this] def setSize() = size.set((Try(getSizeImpl).getOrElse((1, 1)), Deadline.now)) private[this] def setSize() = size.set((Try(getSizeImpl).getOrElse((1, 1)), Deadline.now))
private[this] def getSize = size.get match { private[this] def getSize = size.get match {
case (s, d) if (d + sizeRefreshPeriod).isOverdue => case (s, d) if (d + sizeRefreshPeriod).isOverdue() =>
setSize() setSize()
size.get._1 size.get._1
case (s, _) => s case (s, _) => s

View File

@ -56,7 +56,7 @@ private[util] class WindowsInputStream(term: org.jline.terminal.Terminal, in: In
private val SHIFT_PRESSED = 0x0010; private val SHIFT_PRESSED = 0x0010;
private def getCapability(cap: Capability): String = term.getStringCapability(cap) match { private def getCapability(cap: Capability): String = term.getStringCapability(cap) match {
case null => null case null => null
case c => c.replaceAllLiterally("\\E", "\u001B") case c => c.replace("\\E", "\u001B")
} }
/* /*
* This function is a hybrid of jline 2 WindowsTerminal.readConsoleInput * This function is a hybrid of jline 2 WindowsTerminal.readConsoleInput

View File

@ -96,7 +96,7 @@ object Escapes extends Properties("Escapes") {
) )
} }
assert(isEscapeTerminator(terminator)) assert(isEscapeTerminator(terminator))
def makeString: String = ESC + content + terminator def makeString: String = s"$ESC$content$terminator"
override def toString = override def toString =
if (content.isEmpty) s"ESC (${terminator.toInt})" if (content.isEmpty) s"ESC (${terminator.toInt})"

View File

@ -214,5 +214,5 @@ private final class MRelation[A, B](fwd: Map[A, Set[B]], rev: Map[B, Set[A]])
override def hashCode = fwd.filterNot(_._2.isEmpty).hashCode() override def hashCode = fwd.filterNot(_._2.isEmpty).hashCode()
override def toString = override def toString =
all.map { case (a, b) => a + " -> " + b }.mkString("Relation [", ", ", "]") all.map { case (a, b) => s"$a -> $b" }.mkString("Relation [", ", ", "]")
} }

View File

@ -13,7 +13,6 @@ import java.io.File
import sbt.io.{ IO, Path } import sbt.io.{ IO, Path }
import sbt.io.syntax._ import sbt.io.syntax._
import Path._ import Path._
import sbt.io.IO
class FileCommands(baseDirectory: File) extends BasicStatementHandler { class FileCommands(baseDirectory: File) extends BasicStatementHandler {
lazy val commands = commandMap lazy val commands = commandMap
@ -25,7 +24,7 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
"mkdir" nonEmpty makeDirectories _, "mkdir" nonEmpty makeDirectories _,
"absent" nonEmpty absent _, "absent" nonEmpty absent _,
// "sync" twoArg("Two directory paths", sync _), // "sync" twoArg("Two directory paths", sync _),
"newer" twoArg ("Two paths", newer _), "newer".twoArg("Two paths", newer _),
"pause" noArg { "pause" noArg {
println("Pausing in " + baseDirectory) println("Pausing in " + baseDirectory)
/*readLine("Press enter to continue. ") */ /*readLine("Press enter to continue. ") */
@ -33,11 +32,11 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
System.console.readLine System.console.readLine
println() println()
}, },
"sleep" oneArg ("Time in milliseconds", time => Thread.sleep(time.toLong)), "sleep".oneArg("Time in milliseconds", time => Thread.sleep(time.toLong)),
"exec" nonEmpty (execute _), "exec" nonEmpty (execute _),
"copy" copy (to => rebase(baseDirectory, to)), "copy" copy (to => rebase(baseDirectory, to)),
"copy-file" twoArg ("Two paths", copyFile _), "copy-file".twoArg("Two paths", copyFile _),
"must-mirror" twoArg ("Two paths", diffFiles _), "must-mirror".twoArg("Two paths", diffFiles _),
"copy-flat" copy flat "copy-flat" copy flat
) )

View File

@ -103,7 +103,7 @@ final class ScriptedTests(
log: ManagedLogger, log: ManagedLogger,
context: LoggerContext, context: LoggerContext,
): Seq[() => Option[String]] = { ): Seq[() => Option[String]] = {
for (groupDir <- (resourceBaseDirectory * group).get; nme <- (groupDir * name).get) yield { for (groupDir <- (resourceBaseDirectory * group).get(); nme <- (groupDir * name).get()) yield {
val g = groupDir.getName val g = groupDir.getName
val n = nme.getName val n = nme.getName
val str = s"$g / $n" val str = s"$g / $n"

View File

@ -273,7 +273,7 @@ val root = (project in file(".")).
case (k, BinSbt) => case (k, BinSbt) =>
import java.nio.file.{Files, FileSystems} import java.nio.file.{Files, FileSystems}
val x = IO.read(k) val x = IO.read(k)
IO.write(t / "sbt", x.replaceAllLiterally( IO.write(t / "sbt", x.replace(
"declare init_sbt_version=_to_be_replaced", "declare init_sbt_version=_to_be_replaced",
s"declare init_sbt_version=$sbtVersionToRelease")) s"declare init_sbt_version=$sbtVersionToRelease"))

View File

@ -162,7 +162,7 @@ private[sbt] object ForkTests {
RunningProcesses.add(p) RunningProcesses.add(p)
val ec = try p.exitValue() val ec = try p.exitValue()
finally { finally {
if (p.isAlive) p.destroy() if (p.isAlive()) p.destroy()
RunningProcesses.remove(p) RunningProcesses.remove(p)
} }
val result = val result =
@ -223,7 +223,7 @@ private final class React(
listeners.foreach(_ testEvent event) listeners.foreach(_ testEvent event)
val suiteResult = SuiteResult(tEvents) val suiteResult = SuiteResult(tEvents)
results += group -> suiteResult results += group -> suiteResult
listeners.foreach(_ endGroup (group, suiteResult.result)) listeners.foreach(_.endGroup(group, suiteResult.result))
react() react()
} }
} }

View File

@ -88,7 +88,7 @@ object Package {
for ((key, value) <- mergeManifest.getEntries.asScala) { for ((key, value) <- mergeManifest.getEntries.asScala) {
entryMap.get(key) match { entryMap.get(key) match {
case Some(attributes) => mergeAttributes(attributes, value); () case Some(attributes) => mergeAttributes(attributes, value); ()
case None => entryMap put (key, value); () case None => entryMap.put(key, value); ()
} }
} }
} }

View File

@ -65,7 +65,7 @@ object RawCompileLike {
log.debug("Uptodate: " + outputDirectory.getAbsolutePath) log.debug("Uptodate: " + outputDirectory.getAbsolutePath)
} }
} }
cachedComp(inputs)(exists(outputDirectory.allPaths.get.toSet)) cachedComp(inputs)(exists(outputDirectory.allPaths.get().toSet))
} }
def prepare(description: String, doCompile: Gen): Gen = def prepare(description: String, doCompile: Gen): Gen =

View File

@ -265,7 +265,7 @@ final class Eval(
if (phase == null || phase == phase.next || evalReporter.hasErrors) if (phase == null || phase == phase.next || evalReporter.hasErrors)
() ()
else { else {
enteringPhase(phase) { phase.run } enteringPhase(phase) { phase.run() }
compile(phase.next) compile(phase.next)
} }
} }

View File

@ -85,7 +85,7 @@ class CacheIvyTest extends Properties("CacheIvy") {
for { for {
o <- Gen.identifier o <- Gen.identifier
n <- Gen.identifier n <- Gen.identifier
r <- for { n <- Gen.numChar; ns <- Gen.numStr } yield n + ns r <- for { n <- Gen.numChar; ns <- Gen.numStr } yield s"$n$ns"
cs <- arbitrary[Option[String]] cs <- arbitrary[Option[String]]
branch <- arbitrary[Option[String]] branch <- arbitrary[Option[String]]
isChanging <- arbitrary[Boolean] isChanging <- arbitrary[Boolean]

View File

@ -153,7 +153,7 @@ object BasicCommands {
private[this] def completionsParser: Parser[String] = { private[this] def completionsParser: Parser[String] = {
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => nq + s } val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => nq + s }
val quotedOrUnquotedSingleArgument = Space ~> (StringVerbatim | StringEscapable | notQuoted) val quotedOrUnquotedSingleArgument = Space ~> (StringVerbatim | StringEscapable | notQuoted)
token(quotedOrUnquotedSingleArgument ?? "" examples ("", " ")) token((quotedOrUnquotedSingleArgument ?? "").examples("", " "))
} }
def runCompletions(state: State)(input: String): State = { def runCompletions(state: State)(input: String): State = {
@ -199,7 +199,7 @@ object BasicCommands {
val it = s.iterator val it = s.iterator
var fail = false var fail = false
while (it.hasNext && !fail) { while (it.hasNext && !fail) {
it.next match { it.next() match {
case "" => fail = it.hasNext; () case "" => fail = it.hasNext; ()
case next => result += next; () case next => result += next; ()
} }

View File

@ -88,10 +88,10 @@ object CommandUtil {
} }
def layoutDetails(details: Map[String, String]): String = def layoutDetails(details: Map[String, String]): String =
details.map { case (k, v) => k + "\n\n " + v } mkString ("\n", "\n\n", "\n") details.map { case (k, v) => k + "\n\n " + v }.mkString("\n", "\n\n", "\n")
final val HelpPatternFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE final val HelpPatternFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
private[sbt] def isSbtBuild(baseDir: File) = private[sbt] def isSbtBuild(baseDir: File) =
(baseDir / "project").exists() || (baseDir * "*.sbt").get.nonEmpty (baseDir / "project").exists() || (baseDir * "*.sbt").get().nonEmpty
} }

View File

@ -44,7 +44,7 @@ private[sbt] object LegacyWatched {
(ClearOnFailure :: next :: FailureWall :: repeat :: s) (ClearOnFailure :: next :: FailureWall :: repeat :: s)
.put(ContinuousEventMonitor, monitor: EventMonitor) .put(ContinuousEventMonitor, monitor: EventMonitor)
case Some(eventMonitor) => case Some(eventMonitor) =>
Watched.printIfDefined(watched watchingMessage eventMonitor.state) Watched.printIfDefined(watched watchingMessage eventMonitor.state())
@tailrec def impl(): State = { @tailrec def impl(): State = {
val triggered = try eventMonitor.awaitEvent() val triggered = try eventMonitor.awaitEvent()
catch { catch {
@ -56,7 +56,7 @@ private[sbt] object LegacyWatched {
false false
} }
if (triggered) { if (triggered) {
Watched.printIfDefined(watched triggeredMessage eventMonitor.state) Watched.printIfDefined(watched triggeredMessage eventMonitor.state())
ClearOnFailure :: next :: FailureWall :: repeat :: s ClearOnFailure :: next :: FailureWall :: repeat :: s
} else if (shouldTerminate) { } else if (shouldTerminate) {
while (System.in.available() > 0) System.in.read() while (System.in.available() > 0) System.in.read()

View File

@ -380,7 +380,7 @@ class NetworkClient(
} }
if (!startServer) { if (!startServer) {
val deadline = 5.seconds.fromNow val deadline = 5.seconds.fromNow
while (socket.isEmpty && !deadline.isOverdue) { while (socket.isEmpty && !deadline.isOverdue()) {
socket = Try(ClientSocket.localSocket(bootSocketName, useJNI)).toOption socket = Try(ClientSocket.localSocket(bootSocketName, useJNI)).toOption
if (socket.isEmpty) Thread.sleep(20) if (socket.isEmpty) Thread.sleep(20)
} }
@ -836,12 +836,12 @@ class NetworkClient(
case -1 => (query, query, None, None) // shouldn't happen case -1 => (query, query, None, None) // shouldn't happen
case i => case i =>
val rawPrefix = query.substring(0, i) val rawPrefix = query.substring(0, i)
val prefix = rawPrefix.replaceAllLiterally("\"", "").replaceAllLiterally("\\;", ";") val prefix = rawPrefix.replace("\"", "").replace("\\;", ";")
val rawSuffix = query.substring(i).replaceAllLiterally("\\;", ";") val rawSuffix = query.substring(i).replace("\\;", ";")
val suffix = if (rawSuffix.length > 1) rawSuffix.substring(1) else "" val suffix = if (rawSuffix.length > 1) rawSuffix.substring(1) else ""
(rawPrefix, prefix, Some(rawSuffix), Some(suffix)) (rawPrefix, prefix, Some(rawSuffix), Some(suffix))
} }
} else (query, query.replaceAllLiterally("\\;", ";"), None, None) } else (query, query.replace("\\;", ";"), None, None)
val tailSpace = query.endsWith(" ") || query.endsWith("\"") val tailSpace = query.endsWith(" ") || query.endsWith("\"")
val sanitizedQuery = suffix.foldLeft(prefix) { _ + _ } val sanitizedQuery = suffix.foldLeft(prefix) { _ + _ }
def getCompletions(query: String, sendCommand: Boolean): Seq[String] = { def getCompletions(query: String, sendCommand: Boolean): Seq[String] = {
@ -885,7 +885,7 @@ class NetworkClient(
} }
getCompletions(sanitizedQuery, true) collect { getCompletions(sanitizedQuery, true) collect {
case c if inQuote => c case c if inQuote => c
case c if tailSpace && c.contains(" ") => c.replaceAllLiterally(prefix, "") case c if tailSpace && c.contains(" ") => c.replace(prefix, "")
case c if !tailSpace => c.split(" ").last case c if !tailSpace => c.split(" ").last
} }
} }
@ -1106,10 +1106,10 @@ object NetworkClient {
launchJar = a launchJar = a
.split("--sbt-launch-jar=") .split("--sbt-launch-jar=")
.lastOption .lastOption
.map(_.replaceAllLiterally("%20", " ")) .map(_.replace("%20", " "))
case "--sbt-launch-jar" if i + 1 < sanitized.length => case "--sbt-launch-jar" if i + 1 < sanitized.length =>
i += 1 i += 1
launchJar = Option(sanitized(i).replaceAllLiterally("%20", " ")) launchJar = Option(sanitized(i).replace("%20", " "))
case "-bsp" | "--bsp" => bsp = true case "-bsp" | "--bsp" => bsp = true
case a if !a.startsWith("-") => commandArgs += a case a if !a.startsWith("-") => commandArgs += a
case a @ SysProp(key, value) => case a @ SysProp(key, value) =>
@ -1131,7 +1131,7 @@ object NetworkClient {
sbtArguments.toSeq, sbtArguments.toSeq,
commandArgs.toSeq, commandArgs.toSeq,
completionArguments.toSeq, completionArguments.toSeq,
sbtScript.getOrElse(defaultSbtScript).replaceAllLiterally("%20", " "), sbtScript.getOrElse(defaultSbtScript).replace("%20", " "),
bsp, bsp,
launchJar launchJar
) )

View File

@ -79,7 +79,7 @@ abstract class ServerConnection(connection: Socket) {
if (a.nonEmpty) { if (a.nonEmpty) {
out.write(a) out.write(a)
} }
writeEndLine writeEndLine()
} catch { } catch {
case e: IOException => case e: IOException =>
shutdown() shutdown()
@ -100,7 +100,7 @@ abstract class ServerConnection(connection: Socket) {
out.close() out.close()
connection.close() connection.close()
} catch { case e: IOException => e.printStackTrace() } } catch { case e: IOException => e.printStackTrace() }
onShutdown onShutdown()
} }
} }

View File

@ -20,7 +20,7 @@ object JoinThread {
t.interrupt() t.interrupt()
t.join(10) t.join(10)
} catch { case e: InterruptedException => } } catch { case e: InterruptedException => }
if (t.isAlive && !deadline.isOverdue) impl() if (t.isAlive && !deadline.isOverdue()) impl()
} }
impl() impl()
if (t.isAlive) { if (t.isAlive) {

View File

@ -252,7 +252,7 @@ object Def extends Init[Scope] with TaskMacroExtra with InitializeImplicits {
)(l: Def.Initialize[Task[A => C]])(r: Def.Initialize[Task[B => C]]): Def.Initialize[Task[C]] = { )(l: Def.Initialize[Task[A => C]])(r: Def.Initialize[Task[B => C]]): Def.Initialize[Task[C]] = {
val lhs = { val lhs = {
val innerLhs: Def.Initialize[Task[Either[A, Either[B, C]]]] = val innerLhs: Def.Initialize[Task[Either[A, Either[B, C]]]] =
x.map((fab: Either[A, B]) => fab.right.map(Left(_))) x.map((fab: Either[A, B]) => fab.map(Left(_)))
val innerRhs: Def.Initialize[Task[A => Either[B, C]]] = val innerRhs: Def.Initialize[Task[A => Either[B, C]]] =
l.map((fn: A => C) => fn.andThen(Right(_))) l.map((fn: A => C) => fn.andThen(Right(_)))
selectITask(innerLhs, innerRhs) selectITask(innerLhs, innerRhs)

View File

@ -69,7 +69,7 @@ object Assign {
val is = Seq( val is = Seq(
mk := 3, mk := 3,
name := "asdf", name := "asdf",
tk := (math.random * 1000).toInt, tk := (math.random() * 1000).toInt,
isk := dummys.value.parsed // should not compile: cannot use a task to define the parser isk := dummys.value.parsed // should not compile: cannot use a task to define the parser
// ik := { if( tsk.parsed.value == "blue") tk.value else mk.value } // ik := { if( tsk.parsed.value == "blue") tk.value else mk.value }
) )

View File

@ -116,7 +116,8 @@ object BuildPaths {
private[this] def defaultGlobalZinc(globalBase: File) = globalBase / "zinc" private[this] def defaultGlobalZinc(globalBase: File) = globalBase / "zinc"
def configurationSources(base: File): Seq[File] = def configurationSources(base: File): Seq[File] =
(base * (GlobFilter("*.sbt") - ".sbt")).get (base * (GlobFilter("*.sbt") - ".sbt"))
.get()
.sortBy(_.getName.toLowerCase(Locale.ENGLISH)) .sortBy(_.getName.toLowerCase(Locale.ENGLISH))
def pluginDirectory(definitionBase: File) = definitionBase / PluginsDirectoryName def pluginDirectory(definitionBase: File) = definitionBase / PluginsDirectoryName

View File

@ -3197,8 +3197,8 @@ object Classpaths {
update / unresolvedWarningConfiguration := UnresolvedWarningConfiguration( update / unresolvedWarningConfiguration := UnresolvedWarningConfiguration(
dependencyPositions.value dependencyPositions.value
), ),
updateFull := (updateTask tag (Tags.Update, Tags.Network)).value, updateFull := (updateTask.tag(Tags.Update, Tags.Network)).value,
update := (updateWithoutDetails("update") tag (Tags.Update, Tags.Network)).value, update := (updateWithoutDetails("update").tag(Tags.Update, Tags.Network)).value,
update := { update := {
val report = update.value val report = update.value
val log = streams.value.log val log = streams.value.log
@ -3209,7 +3209,7 @@ object Classpaths {
evicted / evictionWarningOptions := EvictionWarningOptions.full, evicted / evictionWarningOptions := EvictionWarningOptions.full,
evicted := { evicted := {
import ShowLines._ import ShowLines._
val report = (updateTask tag (Tags.Update, Tags.Network)).value val report = (updateTask.tag(Tags.Update, Tags.Network)).value
val log = streams.value.log val log = streams.value.log
val ew = val ew =
EvictionWarning(ivyModule.value, (evicted / evictionWarningOptions).value, report) EvictionWarning(ivyModule.value, (evicted / evictionWarningOptions).value, report)
@ -3701,7 +3701,7 @@ object Classpaths {
try { try {
val extracted = (Project extract st) val extracted = (Project extract st)
val sk = (projRef / Zero / Zero / libraryDependencies).scopedKey val sk = (projRef / Zero / Zero / libraryDependencies).scopedKey
val empty = extracted.structure.data set (sk.scope, sk.key, Nil) val empty = extracted.structure.data.set(sk.scope, sk.key, Nil)
val settings = extracted.structure.settings filter { s: Setting[_] => val settings = extracted.structure.settings filter { s: Setting[_] =>
(s.key.key == libraryDependencies.key) && (s.key.key == libraryDependencies.key) &&
(s.key.scope.project == Select(projRef)) (s.key.scope.project == Select(projRef))
@ -4318,7 +4318,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
/** Constructs a setting that declares a new artifact `a` that is generated by `taskDef`. */ /** Constructs a setting that declares a new artifact `a` that is generated by `taskDef`. */
def addArtifact(a: Artifact, taskDef: TaskKey[File]): SettingsDefinition = { def addArtifact(a: Artifact, taskDef: TaskKey[File]): SettingsDefinition = {
val pkgd = packagedArtifacts := packagedArtifacts.value updated (a, taskDef.value) val pkgd = packagedArtifacts := packagedArtifacts.value.updated(a, taskDef.value)
Seq(artifacts += a, pkgd) Seq(artifacts += a, pkgd)
} }
@ -4330,7 +4330,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
val artLocal = SettingKey.local[Artifact] val artLocal = SettingKey.local[Artifact]
val taskLocal = TaskKey.local[File] val taskLocal = TaskKey.local[File]
val art = artifacts := artLocal.value +: artifacts.value val art = artifacts := artLocal.value +: artifacts.value
val pkgd = packagedArtifacts := packagedArtifacts.value updated (artLocal.value, taskLocal.value) val pkgd = packagedArtifacts := packagedArtifacts.value.updated(artLocal.value, taskLocal.value)
Seq(artLocal := artifact.value, taskLocal := taskDef.value, art, pkgd) Seq(artLocal := artifact.value, taskLocal := taskDef.value, art, pkgd)
} }

View File

@ -80,10 +80,10 @@ object CoursierRepositoriesTasks {
result1 map { result1 map {
case r: FileRepository => case r: FileRepository =>
val ivyPatterns = r.patterns.ivyPatterns map { val ivyPatterns = r.patterns.ivyPatterns map {
_.replaceAllLiterally("$" + "{ivy.home}", ivyHomeUri) _.replace("$" + "{ivy.home}", ivyHomeUri)
} }
val artifactPatterns = r.patterns.artifactPatterns map { val artifactPatterns = r.patterns.artifactPatterns map {
_.replaceAllLiterally("$" + "{ivy.home}", ivyHomeUri) _.replace("$" + "{ivy.home}", ivyHomeUri)
} }
val p = val p =
r.patterns.withIvyPatterns(ivyPatterns).withArtifactPatterns(artifactPatterns) r.patterns.withIvyPatterns(ivyPatterns).withArtifactPatterns(artifactPatterns)

View File

@ -263,7 +263,8 @@ final class BuildUnit(
val plugins: LoadedPlugins val plugins: LoadedPlugins
) { ) {
override def toString = override def toString =
if (uri.getScheme == "file") localBase.toString else (uri + " (locally: " + localBase + ")") if (uri.getScheme == "file") localBase.toString
else (uri.toString + " (locally: " + localBase + ")")
} }
final class LoadedBuild(val root: URI, val units: Map[URI, LoadedBuildUnit]) { final class LoadedBuild(val root: URI, val units: Map[URI, LoadedBuildUnit]) {

View File

@ -25,7 +25,7 @@ private[sbt] object InstallSbtn {
Def.inputKey[Unit]("install sbtn and tab completions").withRank(KeyRanks.BTask) Def.inputKey[Unit]("install sbtn and tab completions").withRank(KeyRanks.BTask)
private[sbt] def installSbtnImpl: Def.Initialize[InputTask[Unit]] = Def.inputTask { private[sbt] def installSbtnImpl: Def.Initialize[InputTask[Unit]] = Def.inputTask {
val inputVersion = Def.spaceDelimited("version").parsed.headOption val inputVersion = Def.spaceDelimited("version").parsed.headOption
val version = inputVersion.getOrElse(sbtVersion.value.replaceAllLiterally("-SNAPSHOT", "")) val version = inputVersion.getOrElse(sbtVersion.value.replace("-SNAPSHOT", ""))
val term = terminal.value val term = terminal.value
term.setMode(canonical = false, echo = false) term.setMode(canonical = false, echo = false)
val baseDirectory = BuildPaths.getGlobalBase(state.value).toPath val baseDirectory = BuildPaths.getGlobalBase(state.value).toPath

View File

@ -25,7 +25,7 @@ object DagreHTML {
val graphString = val graphString =
URLEncoder URLEncoder
.encode(dotGraph, "utf8") .encode(dotGraph, "utf8")
.replaceAllLiterally("+", "%20") .replace("+", "%20")
IO.write( IO.write(
new File(targetDirectory, "dependencies.dot.js"), new File(targetDirectory, "dependencies.dot.js"),

View File

@ -173,7 +173,7 @@ object ParseKey extends Properties {
.log(s"Key: ${Scope.displayPedantic(key.scope, key.key.label)}") .log(s"Key: ${Scope.displayPedantic(key.scope, key.key.label)}")
.log(s"Mask: $mask") .log(s"Mask: $mask")
.log(s"Key string: '$s'") .log(s"Key string: '$s'")
.log(s"Parsed: ${parsed.right.map(displayFull)}") .log(s"Parsed: ${parsed.map(displayFull)}")
.log(s"Structure: $structure") .log(s"Structure: $structure")
) )
} }

View File

@ -41,7 +41,7 @@ class InstallSbtnSpec extends FlatSpec {
val tmpDir = Files.createTempDirectory("sbtn-test").toRealPath() val tmpDir = Files.createTempDirectory("sbtn-test").toRealPath()
Files.createDirectories(tmpDir.resolve("project")) Files.createDirectories(tmpDir.resolve("project"))
val foo = tmpDir.resolve("foo") val foo = tmpDir.resolve("foo")
val fooPath = foo.toString.replaceAllLiterally("\\", "\\\\") val fooPath = foo.toString.replace("\\", "\\\\")
val build = s"""TaskKey[Unit]("foo") := IO.write(file("$fooPath"), "foo")""" val build = s"""TaskKey[Unit]("foo") := IO.write(file("$fooPath"), "foo")"""
IO.write(tmpDir.resolve("build.sbt").toFile, build) IO.write(tmpDir.resolve("build.sbt").toFile, build)
IO.write( IO.write(

View File

@ -19,7 +19,7 @@ object StressGCMonitor {
new GCMonitor(ConsoleLogger()) new GCMonitor(ConsoleLogger())
val deadline = Deadline.now + 10.seconds val deadline = Deadline.now + 10.seconds
while (!deadline.isOverdue()) { while (!deadline.isOverdue()) {
println(deadline.timeLeft.toSeconds + " seconds left...") println(s"${deadline.timeLeft.toSeconds} seconds left...")
list = List.fill(1000 * 1000 * 100)(Random.nextInt(100)) list = List.fill(1000 * 1000 * 100)(Random.nextInt(100))
System.gc() System.gc()
Thread.sleep(10) Thread.sleep(10)

View File

@ -51,7 +51,7 @@ abstract class TestBuild {
def tGen = genTasks(kebabIdGen, MaxDepsGen, MaxTasksGen) def tGen = genTasks(kebabIdGen, MaxDepsGen, MaxTasksGen)
class TestKeys(val env: Env, val scopes: Seq[Scope]) { class TestKeys(val env: Env, val scopes: Seq[Scope]) {
override def toString = env + "\n" + scopes.mkString("Scopes:\n\t", "\n\t", "") override def toString = env.toString + "\n" + scopes.mkString("Scopes:\n\t", "\n\t", "")
lazy val delegated = scopes map env.delegates lazy val delegated = scopes map env.delegates
} }

View File

@ -39,7 +39,7 @@ object BuildServerConnection {
val sbtLaunchJar = classPath val sbtLaunchJar = classPath
.split(File.pathSeparator) .split(File.pathSeparator)
.find(jar => SbtLaunchJar.findFirstIn(jar).nonEmpty) .find(jar => SbtLaunchJar.findFirstIn(jar).nonEmpty)
.map(_.replaceAllLiterally(" ", "%20")) .map(_.replace(" ", "%20"))
.map(jar => s"--sbt-launch-jar=$jar") .map(jar => s"--sbt-launch-jar=$jar")
val argv = val argv =
@ -66,6 +66,6 @@ object BuildServerConnection {
allPaths allPaths
.map(_.resolve(fileName)) .map(_.resolve(fileName))
.find(file => Files.exists(file) && Files.isExecutable(file)) .find(file => Files.exists(file) && Files.isExecutable(file))
.map(_.toString.replaceAllLiterally(" ", "%20")) .map(_.toString.replace(" ", "%20"))
} }
} }

View File

@ -200,7 +200,7 @@ trait TaskExtra extends TaskExtra0 {
val pio = TaskExtra val pio = TaskExtra
.processIO(s) .processIO(s)
.withInput(out => { BasicIO.transferFully(in, out); out.close() }) .withInput(out => { BasicIO.transferFully(in, out); out.close() })
(p run pio).exitValue (p run pio).exitValue()
} }
} }
@ -246,7 +246,7 @@ trait TaskExtra extends TaskExtra0 {
implicit def processToTask(p: ProcessBuilder)(implicit streams: Task[TaskStreams[_]]): Task[Int] = implicit def processToTask(p: ProcessBuilder)(implicit streams: Task[TaskStreams[_]]): Task[Int] =
streams map { s => streams map { s =>
val pio = TaskExtra.processIO(s) val pio = TaskExtra.processIO(s)
(p run pio).exitValue (p run pio).exitValue()
} }
} }
object TaskExtra extends TaskExtra { object TaskExtra extends TaskExtra {

View File

@ -20,25 +20,25 @@ object Test extends std.TaskExtra {
val b2 = task(true) val b2 = task(true)
val c = task("asdf") val c = task("asdf")
val h1 = t3(a, b, c).map { case (aa, bb, cc) => aa + " " + bb + " " + cc } val h1 = t3(a, b, c).map { case (aa, bb, cc) => s"$aa $bb $cc" }
val h2 = t3(a, b2, c).map { case (aa, bb, cc) => aa + " " + bb + " " + cc } val h2 = t3(a, b2, c).map { case (aa, bb, cc) => s"$aa $bb $cc" }
type Values = (Result[Int], Result[Boolean], Result[String]) type Values = (Result[Int], Result[Boolean], Result[String])
val f: Values => Any = { val f: Values => Any = {
case (Value(aa), Value(bb), Value(cc)) => aa + " " + bb + " " + cc case (Value(aa), Value(bb), Value(cc)) => s"$aa $bb $cc"
case x => case x =>
val cs = x.productIterator.toList.collect { case Inc(x) => x } // workaround for double definition bug val cs = x.productIterator.toList.collect { case Inc(x) => x } // workaround for double definition bug
throw Incomplete(None, causes = cs) throw Incomplete(None, causes = cs)
} }
val d2 = t3(a, b2, c) mapR f val d2 = t3(a, b2, c) mapR f
val f2: Values => Task[Any] = { val f2: Values => Task[Any] = {
case (Value(aa), Value(bb), Value(cc)) => task(aa + " " + bb + " " + cc) case (Value(aa), Value(bb), Value(cc)) => task(s"$aa $bb $cc")
case _ => d3 case _ => d3
} }
lazy val d = t3(a, b, c) flatMapR f2 lazy val d = t3(a, b, c) flatMapR f2
val f3: Values => Task[Any] = { val f3: Values => Task[Any] = {
case (Value(aa), Value(bb), Value(cc)) => task(aa + " " + bb + " " + cc) case (Value(aa), Value(bb), Value(cc)) => task(s"$aa $bb $cc")
case _ => d2 case _ => d2
} }
lazy val d3 = t3(a, b, c) flatMapR f3 lazy val d3 = t3(a, b, c) flatMapR f3

View File

@ -235,7 +235,7 @@ object ConcurrentRestrictions {
sentinels.toList foreach { s => sentinels.toList foreach { s =>
s.cancel(true) s.cancel(true)
} }
sentinels.clear sentinels.clear()
} }
def submit(node: A, work: () => R): Unit = synchronized { def submit(node: A, work: () => R): Unit = synchronized {

View File

@ -112,9 +112,9 @@ class JUnitXmlTestsListener(val targetDir: File, legacyTestReport: Boolean, logg
val classnameRegex = s"^($name|${name.split('.').last})\\.?".r val classnameRegex = s"^($name|${name.split('.').last})\\.?".r
val result = val result =
<testsuite hostname={hostname} name={name} tests={tests + ""} errors={errors + ""} failures={ <testsuite hostname={hostname} name={name} tests={tests.toString} errors={errors.toString} failures={
failures + "" failures + ""
} skipped={ignoredSkippedPending + ""} time={(duration / 1000.0).toString} timestamp={ } skipped={ignoredSkippedPending.toString} time={(duration / 1000.0).toString} timestamp={
formatISO8601DateTime(timestamp) formatISO8601DateTime(timestamp)
}> }>
{properties} {properties}

View File

@ -256,7 +256,7 @@ object TestFramework {
def foreachListenerSafe(f: TestsListener => Unit): () => Unit = def foreachListenerSafe(f: TestsListener => Unit): () => Unit =
() => safeForeach(testsListeners, log)(f) () => safeForeach(testsListeners, log)(f)
val startTask = foreachListenerSafe(_.doInit) val startTask = foreachListenerSafe(_.doInit())
val testTasks = val testTasks =
Map(tests.toSeq.flatMap { Map(tests.toSeq.flatMap {
case (framework, testDefinitions) => case (framework, testDefinitions) =>

View File

@ -19,7 +19,7 @@ import scala.collection.concurrent
private[sbt] class TestStatusReporter(f: File) extends TestsListener { private[sbt] class TestStatusReporter(f: File) extends TestsListener {
private lazy val succeeded: concurrent.Map[String, Long] = TestStatus.read(f) private lazy val succeeded: concurrent.Map[String, Long] = TestStatus.read(f)
def doInit = () def doInit(): Unit = ()
def startGroup(name: String): Unit = { succeeded remove name; () } def startGroup(name: String): Unit = { succeeded remove name; () }
def testEvent(event: TestEvent): Unit = () def testEvent(event: TestEvent): Unit = ()
def endGroup(name: String, t: Throwable): Unit = () def endGroup(name: String, t: Throwable): Unit = ()

View File

@ -125,7 +125,7 @@ class TestLogger(val logging: TestLogging) extends TestsListener {
import logging.{ global => log, logTest, managed } import logging.{ global => log, logTest, managed }
import sbt.protocol.testing.codec.JsonProtocol._ import sbt.protocol.testing.codec.JsonProtocol._
def doInit: Unit = managed.logEvent(Level.Info, TestInitEvent()) def doInit(): Unit = managed.logEvent(Level.Info, TestInitEvent())
def startGroup(name: String): Unit = managed.logEvent(Level.Info, StartTestGroupEvent(name)) def startGroup(name: String): Unit = managed.logEvent(Level.Info, StartTestGroupEvent(name))

View File

@ -31,7 +31,7 @@ object SingletonCache {
implicit def basicSingletonCache[A: JsonFormat]: SingletonCache[A] = implicit def basicSingletonCache[A: JsonFormat]: SingletonCache[A] =
new SingletonCache[A] { new SingletonCache[A] {
override def read(from: Input): A = from.read[A] override def read(from: Input): A = from.read[A]()
override def write(to: Output, value: A) = to.write(value) override def write(to: Output, value: A) = to.write(value)
} }

View File

@ -20,7 +20,7 @@ class CacheSpec extends FlatSpec {
testCache[String, Int] { testCache[String, Int] {
case (cache, store) => case (cache, store) =>
cache(store)("missing") match { cache(store)("missing") match {
case Hit(_) => fail case Hit(_) => fail()
case Miss(_) => () case Miss(_) => ()
} }
} }
@ -30,7 +30,7 @@ class CacheSpec extends FlatSpec {
testCache[String, Int] { testCache[String, Int] {
case (cache, store) => case (cache, store) =>
cache(store)("missing") match { cache(store)("missing") match {
case Hit(_) => fail case Hit(_) => fail()
case Miss(update) => update(5) case Miss(update) => update(5)
} }
} }
@ -41,13 +41,13 @@ class CacheSpec extends FlatSpec {
case (cache, store) => case (cache, store) =>
val value = 5 val value = 5
cache(store)("someKey") match { cache(store)("someKey") match {
case Hit(_) => fail case Hit(_) => fail()
case Miss(update) => update(value) case Miss(update) => update(value)
} }
cache(store)("someKey") match { cache(store)("someKey") match {
case Hit(read) => assert(read === value); () case Hit(read) => assert(read === value); ()
case Miss(_) => fail case Miss(_) => fail()
} }
} }
} }
@ -58,13 +58,13 @@ class CacheSpec extends FlatSpec {
val key = "someKey" val key = "someKey"
val value = 5 val value = 5
cache(store)(key) match { cache(store)(key) match {
case Hit(_) => fail case Hit(_) => fail()
case Miss(update) => update(value) case Miss(update) => update(value)
} }
cache(store)(key) match { cache(store)(key) match {
case Hit(read) => assert(read === value); () case Hit(read) => assert(read === value); ()
case Miss(_) => fail case Miss(_) => fail()
} }
} }
} }

View File

@ -69,7 +69,7 @@ object Tracked {
/** Creates a tracker that provides the output of the most recent invocation of the function */ /** Creates a tracker that provides the output of the most recent invocation of the function */
def lastOutput[I, O: JsonFormat](store: CacheStore)(f: (I, Option[O]) => O): I => O = { in => def lastOutput[I, O: JsonFormat](store: CacheStore)(f: (I, Option[O]) => O): I => O = { in =>
val previous = Try { store.read[O] }.toOption val previous = Try { store.read[O]() }.toOption
val next = f(in, previous) val next = f(in, previous)
store.write(next) store.write(next)
next next
@ -277,7 +277,7 @@ object Tracked {
} }
def changed(store: CacheStore, value: I): Boolean = def changed(store: CacheStore, value: I): Boolean =
Try { store.read[Long] } match { Try { store.read[Long]() } match {
case USuccess(prev: Long) => case USuccess(prev: Long) =>
Hasher.hash(value) match { Hasher.hash(value) match {
case USuccess(keyHash: Int) => keyHash.toLong != prev case USuccess(keyHash: Int) => keyHash.toLong != prev
@ -321,7 +321,7 @@ class Timestamp(val store: CacheStore, useStartTime: Boolean)(implicit format: J
private def now() = System.currentTimeMillis private def now() = System.currentTimeMillis
def readTimestamp: Long = def readTimestamp: Long =
Try { store.read[Long] } getOrElse 0 Try { store.read[Long]() } getOrElse 0
} }
@deprecated("Use Tracked.inputChanged and Tracked.outputChanged instead", "1.0.1") @deprecated("Use Tracked.inputChanged and Tracked.outputChanged instead", "1.0.1")
@ -342,7 +342,7 @@ class Changed[O: Equiv: JsonFormat](val store: CacheStore) extends Tracked {
def uptodate(value: O): Boolean = { def uptodate(value: O): Boolean = {
val equiv: Equiv[O] = implicitly val equiv: Equiv[O] = implicitly
equiv.equiv(value, store.read[O]) equiv.equiv(value, store.read[O]())
} }
} }

View File

@ -160,7 +160,7 @@ class TrackedSpec extends FlatSpec {
withStore { store => withStore { store =>
val beforeCompletion: String = "before-completion" val beforeCompletion: String = "before-completion"
val afterCompletion: String = "after-completion" val afterCompletion: String = "after-completion"
val sideEffectCompleted = Promise[Unit] val sideEffectCompleted = Promise[Unit]()
val p0: () => String = () => { val p0: () => String = () => {
if (sideEffectCompleted.isCompleted) { if (sideEffectCompleted.isCompleted) {
afterCompletion afterCompletion