dotty phase 3: Some required syntax changes (#29139)

Co-authored-by: Bùi Việt Thành <thanhbv@sandinh.net>
This commit is contained in:
ohze.net 2020-06-25 14:47:31 +07:00 committed by GitHub
parent 6b402f4bf0
commit 01501148d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 90 additions and 91 deletions

View file

@ -253,7 +253,7 @@ final class ActorTestKit private[akka] (
*/
def stop[T](ref: ActorRef[T], max: FiniteDuration = timeout.duration): Unit =
try {
Await.result(internalTestKitGuardian.ask { x: ActorRef[ActorTestKitGuardian.Ack.type] =>
Await.result(internalTestKitGuardian.ask { (x: ActorRef[ActorTestKitGuardian.Ack.type]) =>
ActorTestKitGuardian.StopActor(ref, x)
}, max)
} catch {

View file

@ -70,12 +70,12 @@ object BehaviorTestKitSpec {
context.stop(child)
Behaviors.same
case SpawnAdapter =>
context.spawnMessageAdapter { r: Reproduce =>
context.spawnMessageAdapter { (r: Reproduce) =>
SpawnAnonymous(r.times)
}
Behaviors.same
case SpawnAdapterWithName(name) =>
context.spawnMessageAdapter({ r: Reproduce =>
context.spawnMessageAdapter({ (r: Reproduce) =>
SpawnAnonymous(r.times)
}, name)
Behaviors.same

View file

@ -442,7 +442,7 @@ object SupervisorHierarchySpec {
Ping(ref)
case x =>
// fail one child
val pick = ((if (x >= 0.25) x - 0.25 else x) * 4 * activeChildren.size).toInt
val pick = ((if (x >= 0.25f) x - 0.25f else x) * 4 * activeChildren.size).toInt
Fail(activeChildren(pick), if (x > 0.25) Restart else Resume)
})

View file

@ -411,7 +411,7 @@ abstract class ActorModelSpec(config: String) extends AkkaSpec(config) with Defa
"Teammates left: " + team.size + " stopLatch: " + stopLatch.getCount + " inhab:" + dispatcher.inhabitants)
import akka.util.ccompat.JavaConverters._
team.asScala.toList.sortBy(_.self.path).foreach { cell: ActorCell =>
team.asScala.toList.sortBy(_.self.path).foreach { (cell: ActorCell) =>
System.err.println(
" - " + cell.self.path + " " + cell.isTerminated + " " + cell.mailbox.currentStatus + " "
+ cell.mailbox.numberOfMessages + " " + cell.mailbox.systemDrain(SystemMessageList.LNil).size)

View file

@ -944,7 +944,7 @@ class TcpConnectionSpec extends AkkaSpec("""
})
}
trait SmallRcvBuffer { _: LocalServerTest =>
trait SmallRcvBuffer { this: LocalServerTest =>
override def setServerSocketOptions(): Unit = localServerChannel.socket.setReceiveBufferSize(1024)
}

View file

@ -16,7 +16,7 @@ import akka.io.Inet.SocketOption
import akka.testkit.{ AkkaSpec, TestProbe }
import akka.testkit.SocketUtil.temporaryServerAddress
trait TcpIntegrationSpecSupport { _: AkkaSpec =>
trait TcpIntegrationSpecSupport { this: AkkaSpec =>
class TestSetup(shouldBindServer: Boolean = true, runClientInExtraSystem: Boolean = true) {
val clientSystem =

View file

@ -749,7 +749,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"be equal to the original" when {
"compacting" in {
check { xs: ByteString =>
check { (xs: ByteString) =>
val ys = xs.compact; (xs == ys) && ys.isCompact
}
}
@ -785,19 +785,19 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"behave as expected" when {
"created from and decoding to String" in {
check { s: String =>
check { (s: String) =>
ByteString(s, "UTF-8").decodeString("UTF-8") == s
}
}
"taking its own length" in {
check { b: ByteString =>
check { (b: ByteString) =>
b.take(b.length) eq b
}
}
"created from and decoding to Base64" in {
check { a: ByteString =>
check { (a: ByteString) =>
val encoded = a.encodeBase64
encoded == ByteString(java.util.Base64.getEncoder.encode(a.toArray)) &&
encoded.decodeBase64 == a
@ -805,7 +805,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"compacting" in {
check { a: ByteString =>
check { (a: ByteString) =>
val wasCompact = a.isCompact
val b = a.compact
((!wasCompact) || (b eq a)) &&
@ -848,7 +848,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling apply" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, i1, i2) =>
likeVector(xs) { seq =>
@ -859,27 +859,27 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling head" in {
check { a: ByteString =>
check { (a: ByteString) =>
a.isEmpty || likeVector(a) { _.head }
}
}
"calling tail" in {
check { a: ByteString =>
check { (a: ByteString) =>
a.isEmpty || likeVector(a) { _.tail }
}
}
"calling last" in {
check { a: ByteString =>
check { (a: ByteString) =>
a.isEmpty || likeVector(a) { _.last }
}
}
"calling init" in {
check { a: ByteString =>
check { (a: ByteString) =>
a.isEmpty || likeVector(a) { _.init }
}
}
"calling length" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVector(a) { _.length }
}
}
@ -919,25 +919,25 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling foreach" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVector(a) { it =>
var acc = 0; it.foreach { acc += _ }; acc
}
}
}
"calling foldLeft" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVector(a) { _.foldLeft(0) { _ + _ } }
}
}
"calling toArray" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVector(a) { _.toArray.toSeq }
}
}
"calling slice" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, from, until) =>
likeVector(xs)({
@ -948,7 +948,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling take and drop" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, from, until) =>
likeVector(xs)({
@ -959,7 +959,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling grouped" in {
check { grouped: ByteStringGrouped =>
check { (grouped: ByteStringGrouped) =>
likeVector(grouped.bs) {
_.grouped(grouped.size).toIndexedSeq
}
@ -967,7 +967,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling copyToArray" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, from, until) =>
likeVector(xs)({ it =>
@ -995,7 +995,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"given all types of ByteString" in {
check { bs: ByteString =>
check { (bs: ByteString) =>
testSer(bs)
}
}
@ -1020,27 +1020,27 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling head" in {
check { a: ByteString =>
check { (a: ByteString) =>
a.isEmpty || likeVecIt(a) { _.head }
}
}
"calling next" in {
check { a: ByteString =>
check { (a: ByteString) =>
a.isEmpty || likeVecIt(a) { _.next() }
}
}
"calling hasNext" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a) { _.hasNext }
}
}
"calling length" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a)(_.length, strict = false)
}
}
"calling duplicate" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a)({ _.duplicate match { case (a, b) => (a.toSeq, b.toSeq) } }, strict = false)
}
}
@ -1075,30 +1075,30 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
}
"calling toSeq" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a) { _.toSeq }
}
}
"calling foreach" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a) { it =>
var acc = 0; it.foreach { acc += _ }; acc
}
}
}
"calling foldLeft" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a) { _.foldLeft(0) { _ + _ } }
}
}
"calling toArray" in {
check { a: ByteString =>
check { (a: ByteString) =>
likeVecIt(a) { _.toArray.toSeq }
}
}
"calling slice" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, from, until) =>
likeVecIt(xs)({
@ -1109,7 +1109,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling take and drop" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, from, until) =>
likeVecIt(xs)({
@ -1120,7 +1120,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling copyToArray" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
slice match {
case (xs, from, until) =>
likeVecIt(xs)({ it =>
@ -1136,7 +1136,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"function as expected" when {
"getting Bytes, using getByte and getBytes" in {
// mixing getByte and getBytes here for more rigorous testing
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
val (bytes, from, to) = slice
val input = bytes.iterator
val output = new Array[Byte](bytes.length)
@ -1148,7 +1148,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"getting Bytes with a given length" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
val (bytes, _, _) = slice
val input = bytes.iterator
(input.getBytes(bytes.length).toSeq == bytes) && input.isEmpty
@ -1156,7 +1156,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"getting ByteString with a given length" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
val (bytes, _, _) = slice
val input = bytes.iterator
(input.getByteString(bytes.length) == bytes) && input.isEmpty
@ -1165,7 +1165,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"getting Bytes, using the InputStream wrapper" in {
// combining skip and both read methods here for more rigorous testing
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
val (bytes, from, to) = slice
val a = (0 max from) min bytes.length
val b = (a max to) min bytes.length
@ -1192,7 +1192,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
}
"calling copyToBuffer" in {
check { bytes: ByteString =>
check { (bytes: ByteString) =>
import java.nio.ByteBuffer
val buffer = ByteBuffer.allocate(bytes.size)
bytes.copyToBuffer(buffer)
@ -1223,52 +1223,52 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"decode data correctly" when {
"decoding Short in big-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testShortDecoding(slice, BIG_ENDIAN)
}
}
"decoding Short in little-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testShortDecoding(slice, LITTLE_ENDIAN)
}
}
"decoding Int in big-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testIntDecoding(slice, BIG_ENDIAN)
}
}
"decoding Int in little-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testIntDecoding(slice, LITTLE_ENDIAN)
}
}
"decoding Long in big-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testLongDecoding(slice, BIG_ENDIAN)
}
}
"decoding Long in little-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testLongDecoding(slice, LITTLE_ENDIAN)
}
}
"decoding Float in big-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testFloatDecoding(slice, BIG_ENDIAN)
}
}
"decoding Float in little-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testFloatDecoding(slice, LITTLE_ENDIAN)
}
}
"decoding Double in big-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testDoubleDecoding(slice, BIG_ENDIAN)
}
}
"decoding Double in little-endian" in {
check { slice: ByteStringSlice =>
check { (slice: ByteStringSlice) =>
testDoubleDecoding(slice, LITTLE_ENDIAN)
}
}
@ -1296,7 +1296,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"function as expected" when {
"putting Bytes, using putByte and putBytes" in {
// mixing putByte and putBytes here for more rigorous testing
check { slice: ArraySlice[Byte] =>
check { (slice: ArraySlice[Byte]) =>
val (data, from, to) = slice
val builder = ByteString.newBuilder
for (i <- 0 until from) builder.putByte(data(i))
@ -1308,7 +1308,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"putting Bytes, using the OutputStream wrapper" in {
// mixing the write methods here for more rigorous testing
check { slice: ArraySlice[Byte] =>
check { (slice: ArraySlice[Byte]) =>
val (data, from, to) = slice
val builder = ByteString.newBuilder
for (i <- 0 until from) builder.asOutputStream.write(data(i).toInt)
@ -1321,62 +1321,62 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"encode data correctly" when {
"encoding Short in big-endian" in {
check { slice: ArraySlice[Short] =>
check { (slice: ArraySlice[Short]) =>
testShortEncoding(slice, BIG_ENDIAN)
}
}
"encoding Short in little-endian" in {
check { slice: ArraySlice[Short] =>
check { (slice: ArraySlice[Short]) =>
testShortEncoding(slice, LITTLE_ENDIAN)
}
}
"encoding Int in big-endian" in {
check { slice: ArraySlice[Int] =>
check { (slice: ArraySlice[Int]) =>
testIntEncoding(slice, BIG_ENDIAN)
}
}
"encoding Int in little-endian" in {
check { slice: ArraySlice[Int] =>
check { (slice: ArraySlice[Int]) =>
testIntEncoding(slice, LITTLE_ENDIAN)
}
}
"encoding Long in big-endian" in {
check { slice: ArraySlice[Long] =>
check { (slice: ArraySlice[Long]) =>
testLongEncoding(slice, BIG_ENDIAN)
}
}
"encoding Long in little-endian" in {
check { slice: ArraySlice[Long] =>
check { (slice: ArraySlice[Long]) =>
testLongEncoding(slice, LITTLE_ENDIAN)
}
}
"encoding LongPart in big-endian" in {
check { slice: ArrayNumBytes[Long] =>
check { (slice: ArrayNumBytes[Long]) =>
testLongPartEncoding(slice, BIG_ENDIAN)
}
}
"encoding LongPart in little-endian" in {
check { slice: ArrayNumBytes[Long] =>
check { (slice: ArrayNumBytes[Long]) =>
testLongPartEncoding(slice, LITTLE_ENDIAN)
}
}
"encoding Float in big-endian" in {
check { slice: ArraySlice[Float] =>
check { (slice: ArraySlice[Float]) =>
testFloatEncoding(slice, BIG_ENDIAN)
}
}
"encoding Float in little-endian" in {
check { slice: ArraySlice[Float] =>
check { (slice: ArraySlice[Float]) =>
testFloatEncoding(slice, LITTLE_ENDIAN)
}
}
"encoding Double in big-endian" in {
check { slice: ArraySlice[Double] =>
check { (slice: ArraySlice[Double]) =>
testDoubleEncoding(slice, BIG_ENDIAN)
}
}
"encoding Double in little-endian" in {
check { slice: ArraySlice[Double] =>
check { (slice: ArraySlice[Double]) =>
testDoubleEncoding(slice, LITTLE_ENDIAN)
}
}
@ -1384,12 +1384,12 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers {
"have correct empty info" when {
"is empty" in {
check { a: ByteStringBuilder =>
check { (a: ByteStringBuilder) =>
a.isEmpty
}
}
"is nonEmpty" in {
check { a: ByteStringBuilder =>
check { (a: ByteStringBuilder) =>
a.putByte(1.toByte)
a.nonEmpty
}

View file

@ -84,7 +84,7 @@ class ActorRefIgnoreSpec extends ScalaTestWithActorTestKit() with AnyWordSpecLik
val failedAsk =
askMeRef
.ask { _: ActorRef[Request] =>
.ask { (_: ActorRef[Request]) =>
Request(testKit.system.ignoreRef) // <- pass the ignoreRef instead, so Future never completes
}
.failed

View file

@ -75,7 +75,7 @@ class ActorSystemSpec
Behaviors.receiveMessage[Done] { _ =>
Behaviors.stopped
}
withSystem("shutdown", stoppable, doTerminate = false) { sys: ActorSystem[Done] =>
withSystem("shutdown", stoppable, doTerminate = false) { (sys: ActorSystem[Done]) =>
sys ! Done
sys.whenTerminated.futureValue
}

View file

@ -59,7 +59,7 @@ object ReceptionistApiSpec {
// another more "normal" is subscribe using an adapter
// FIXME inference doesn't work with partial function
val adapter = context.spawnMessageAdapter { listing: Receptionist.Listing =>
val adapter = context.spawnMessageAdapter { (listing: Receptionist.Listing) =>
listing.serviceInstances(key) // Set[ActorRef[String]] !!
}
context.system.receptionist ! Receptionist.Subscribe(key, adapter)

View file

@ -43,7 +43,7 @@ object FSMDocSpec {
// initial state
def apply(): Behavior[Event] = idle(Uninitialized)
private def idle(data: Data): Behavior[Event] = Behaviors.receiveMessage[Event] { message: Event =>
private def idle(data: Data): Behavior[Event] = Behaviors.receiveMessage[Event] { message =>
(message, data) match {
case (SetTarget(ref), Uninitialized) =>
idle(Todo(ref, Vector.empty))

View file

@ -20,7 +20,7 @@ import akka.util.ccompat.JavaConverters._
* Actor system extensions registry
*/
@InternalApi
private[akka] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] =>
private[akka] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] with InternalRecipientRef[_] =>
private val extensions = new ConcurrentHashMap[ExtensionId[_], AnyRef]
@ -55,9 +55,8 @@ private[akka] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] =>
def idFromJavaSingletonAccessor(extensionIdFQCN: String): Try[ExtensionId[Extension]] =
dynamicAccess.getClassFor[ExtensionId[Extension]](extensionIdFQCN).flatMap[ExtensionId[Extension]] {
clazz: Class[_] =>
(clazz: Class[_]) =>
Try {
val singletonAccessor = clazz.getDeclaredMethod("getInstance")
singletonAccessor.invoke(null).asInstanceOf[ExtensionId[Extension]]
}

View file

@ -103,7 +103,7 @@ object ActorRef {
* the unique id of the actor is not taken into account when comparing actor paths.
*/
abstract class ActorRef extends java.lang.Comparable[ActorRef] with Serializable {
scalaRef: InternalActorRef =>
scalaRef: InternalActorRef with ActorRefScope =>
/**
* Returns the path for this actor (from this actor up to the root actor).
@ -166,7 +166,7 @@ abstract class ActorRef extends java.lang.Comparable[ActorRef] with Serializable
* There are implicit conversions in package.scala
* from ActorRef -&gt; ScalaActorRef and back
*/
trait ScalaActorRef { ref: ActorRef =>
trait ScalaActorRef { ref: ActorRef with InternalActorRef with ActorRefScope =>
/**
* Sends a one-way asynchronous message. E.g. fire-and-forget semantics.

View file

@ -8,6 +8,7 @@ import java.util
import java.util.concurrent.{ ConcurrentHashMap, TimeUnit }
import scala.util.{ Failure, Success, Try }
import java.lang.Enum
import com.typesafe.config._

View file

@ -258,7 +258,7 @@ object Util {
if (i.hasNext) {
val builder = new immutable.VectorBuilder[T]
do { builder += i.next() } while (i.hasNext)
while ({ builder += i.next(); i.hasNext }) ()
builder.result()
} else EmptyImmutableSeq

View file

@ -22,9 +22,7 @@ import akka.util.ccompat.JavaConverters._
class Index[K, V](val mapSize: Int, val valueComparator: Comparator[V]) {
def this(mapSize: Int, cmp: (V, V) => Int) =
this(mapSize, new Comparator[V] {
def compare(a: V, b: V): Int = cmp(a, b)
})
this(mapSize, ((a: V, b: V) => cmp(a, b)): Comparator[V])
private val container = new ConcurrentHashMap[K, ConcurrentSkipListSet[V]](mapSize)
private val emptySet = new ConcurrentSkipListSet[V]

View file

@ -91,7 +91,7 @@ class LogRoleReplace {
private val RoleStarted =
"""\[([\w\-]+)\].*Role \[([\w]+)\] started with address \[[\w\-\+\.]+://.*@([\w\-\.]+):([0-9]+)\]""".r
private val ColorCode = """\u001B?\[[0-9]+m"""
private val ColorCode = "\u001B?\\[[0-9]+m"
private var replacements: Map[String, String] = Map.empty

View file

@ -204,7 +204,7 @@ class PhiAccrualFailureDetector(
-math.log10(1.0 - 1.0 / (1.0 + e))
}
private val minStdDeviationMillis = minStdDeviation.toMillis
private val minStdDeviationMillis = minStdDeviation.toMillis.toDouble
private def ensureValidStdDeviation(stdDeviation: Double): Double = math.max(stdDeviation, minStdDeviationMillis)

View file

@ -53,14 +53,15 @@ class TlsTcpWithRotatingKeysSSLEngineSpec extends TlsTcpSpec(ConfigFactory.parse
akka.remote.artery.ssl {
ssl-engine-provider = akka.remote.artery.tcp.ssl.RotatingKeysSSLEngineProvider
rotating-keys-engine {
key-file = ${getClass.getClassLoader.getResource("ssl/node.example.com.pem").getPath}
cert-file = ${getClass.getClassLoader.getResource("ssl/node.example.com.crt").getPath}
ca-cert-file = ${getClass.getClassLoader.getResource("ssl/exampleca.crt").getPath}
key-file = ${TlsTcpSpec.resourcePath("ssl/node.example.com.pem")}
cert-file = ${TlsTcpSpec.resourcePath("ssl/node.example.com.crt")}
ca-cert-file = ${TlsTcpSpec.resourcePath("ssl/exampleca.crt")}
}
}
"""))
object TlsTcpSpec {
def resourcePath(name: String): String = getClass.getClassLoader.getResource(name).getPath
lazy val config: Config = {
ConfigFactory.parseString(s"""

View file

@ -63,7 +63,7 @@ object Slf4jLoggerSpec {
val output = new ByteArrayOutputStream
def outputString: String = output.toString("UTF-8")
class TestAppender extends OutputStreamAppender {
class TestAppender[E] extends OutputStreamAppender[E] {
override def start(): Unit = {
setOutputStream(output)

View file

@ -56,7 +56,7 @@ trait WithLogCapturing extends SuiteMixin { this: TestSuite =>
override def write(b: Int): Unit = oldOut.write(b)
}) {
override def println(x: Any): Unit =
oldOut.println(prefix + String.valueOf(x).replaceAllLiterally("\n", s"\n$prefix"))
oldOut.println(prefix + String.valueOf(x).replace("\n", s"\n$prefix"))
}
Console.withOut(prefixingOut) {

View file

@ -98,8 +98,8 @@ class AkkaConsoleReporter(registry: AkkaMetricRegistry, verbose: Boolean, output
output.print(" 1-minute rate = %2.2f calls/%s%n".format(convertRate(timer.getOneMinuteRate), getRateUnit))
output.print(" 5-minute rate = %2.2f calls/%s%n".format(convertRate(timer.getFiveMinuteRate), getRateUnit))
output.print(" 15-minute rate = %2.2f calls/%s%n".format(convertRate(timer.getFifteenMinuteRate), getRateUnit))
output.print(" min = %2.2f %s%n".format(convertDuration(snapshot.getMin), getDurationUnit))
output.print(" max = %2.2f %s%n".format(convertDuration(snapshot.getMax), getDurationUnit))
output.print(" min = %2.2f %s%n".format(convertDuration(snapshot.getMin.toDouble), getDurationUnit))
output.print(" max = %2.2f %s%n".format(convertDuration(snapshot.getMax.toDouble), getDurationUnit))
output.print(" mean = %2.2f %s%n".format(convertDuration(snapshot.getMean), getDurationUnit))
output.print(" stddev = %2.2f %s%n".format(convertDuration(snapshot.getStdDev), getDurationUnit))
output.print(" median = %2.2f %s%n".format(convertDuration(snapshot.getMedian), getDurationUnit))