Remove any reference to `F0` and `F1`

Syncs with https://github.com/sbt/zinc/pull/359 and
https://github.com/sbt/util/pull/84.
This commit is contained in:
jvican 2017-07-14 17:29:06 +02:00
parent 9429b76d67
commit 26cfe0cb7b
No known key found for this signature in database
GPG Key ID: 42DAFA0F112E8050
2 changed files with 8 additions and 8 deletions

View File

@ -64,7 +64,7 @@ import sbt.librarymanagement.Configurations.{
import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion }
import sbt.librarymanagement.{ `package` => _, _ }
import sbt.librarymanagement.syntax._
import sbt.util.InterfaceUtil.f1
import sbt.util.InterfaceUtil.{ toJavaFunction => f1 }
import sbt.util._
import sbt.util.CacheImplicits._
import scala.concurrent.duration.FiniteDuration

View File

@ -9,15 +9,15 @@ package sbt
import scala.reflect.Manifest
import scala.collection.concurrent.TrieMap
import java.lang.ref.WeakReference
import Thread.currentThread
import java.security.Permission
import java.util.concurrent.{ ConcurrentHashMap => CMap }
import java.lang.Integer.{ toHexString => hex }
import java.util.function.Supplier
import sbt.util.Logger
import sbt.util.InterfaceUtil
import TrapExit._
/**
@ -39,7 +39,7 @@ object TrapExit {
*/
def apply(execute: => Unit, log: Logger): Int =
System.getSecurityManager match {
case m: TrapExit => m.runManaged(Logger.f0(execute), log)
case m: TrapExit => m.runManaged(InterfaceUtil.toSupplier(execute), log)
case _ => runUnmanaged(execute, log)
}
@ -149,12 +149,12 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
private[this] val threadToApp = new CMap[ThreadID, App]
/** Executes `f` in a managed context. */
def runManaged(f: xsbti.F0[Unit], xlog: xsbti.Logger): Int = {
def runManaged(f: Supplier[Unit], xlog: xsbti.Logger): Int = {
val _ = running.incrementAndGet()
try runManaged0(f, xlog)
finally running.decrementAndGet()
}
private[this] def runManaged0(f: xsbti.F0[Unit], xlog: xsbti.Logger): Int = {
private[this] def runManaged0(f: Supplier[Unit], xlog: xsbti.Logger): Int = {
val log: Logger = xlog
val app = new App(f, log)
val executionThread = app.mainThread
@ -214,7 +214,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
* `execute` is the application code to evaluate.
* `log` is used for debug logging.
*/
private final class App(val execute: xsbti.F0[Unit], val log: Logger) extends Runnable {
private final class App(val execute: Supplier[Unit], val log: Logger) extends Runnable {
/**
* Tracks threads and groups created by this application.
@ -249,7 +249,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
val exitCode = new ExitCode
def run(): Unit = {
try execute()
try execute.get()
catch {
case x: Throwable =>
exitCode.set(1) //exceptions in the main thread cause the exit code to be 1