summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/actmig-PinS.check18
-rw-r--r--test/files/jvm/actmig-PinS.scala118
-rw-r--r--test/files/jvm/actmig-PinS_1.check18
-rw-r--r--test/files/jvm/actmig-PinS_1.scala130
-rw-r--r--test/files/jvm/actmig-PinS_2.check18
-rw-r--r--test/files/jvm/actmig-PinS_2.scala150
-rw-r--r--test/files/jvm/actmig-PinS_3.check19
-rw-r--r--test/files/jvm/actmig-PinS_3.scala159
-rw-r--r--test/files/jvm/actmig-hierarchy.check2
-rw-r--r--test/files/jvm/actmig-hierarchy.scala44
-rw-r--r--test/files/jvm/actmig-hierarchy_1.check2
-rw-r--r--test/files/jvm/actmig-hierarchy_1.scala41
-rw-r--r--test/files/jvm/actmig-instantiation.check8
-rw-r--r--test/files/jvm/actmig-instantiation.scala91
-rw-r--r--test/files/jvm/actmig-loop-react.check16
-rw-r--r--test/files/jvm/actmig-loop-react.scala170
-rw-r--r--test/files/jvm/actmig-public-methods.check6
-rw-r--r--test/files/jvm/actmig-public-methods.scala69
-rw-r--r--test/files/jvm/actmig-public-methods_1.check6
-rw-r--r--test/files/jvm/actmig-public-methods_1.scala88
-rw-r--r--test/files/jvm/actmig-react-receive.check16
-rw-r--r--test/files/jvm/actmig-react-receive.scala104
-rw-r--r--test/files/jvm/manifests-new.check70
-rw-r--r--test/files/jvm/manifests-new.scala18
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala121
-rw-r--r--test/files/jvm/serialization-new.scala8
-rw-r--r--test/files/jvm/t1652.check2
27 files changed, 170 insertions, 1342 deletions
diff --git a/test/files/jvm/actmig-PinS.check b/test/files/jvm/actmig-PinS.check
deleted file mode 100644
index 97d1c5be02..0000000000
--- a/test/files/jvm/actmig-PinS.check
+++ /dev/null
@@ -1,18 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS.scala b/test/files/jvm/actmig-PinS.scala
deleted file mode 100644
index db5713dde4..0000000000
--- a/test/files/jvm/actmig-PinS.scala
+++ /dev/null
@@ -1,118 +0,0 @@
-import scala.actors._
-
-import scala.actors.Actor._
-
-/* PinS, Listing 32.1: A simple actor
- */
-object SillyActor extends Actor {
- def act() {
- for (i <- 1 to 5) {
- println("I'm acting!")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
- }
-}
-
-object SeriousActor extends Actor {
- def act() {
- for (i <- 1 to 5) {
- println("To be or not to be.")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver extends Actor {
- import java.net.{InetAddress, UnknownHostException}
-
- def act() {
- react {
- case (name: String, actor: Actor) =>
- actor ! getIp(name)
- act()
- case "EXIT" =>
- println("Name resolver exiting.")
- // quit
- case msg =>
- println("Unhandled message: " + msg)
- act()
- }
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): Actor = actor {
- while (true) {
- receive {
- case 'stop =>
- exit()
- case msg =>
- println("received message: " + msg)
- }
- }
- }
-
- /* PinS, page 696
- */
- def makeIntActor(): Actor = actor {
- receive {
- case x: Int => // I only want Ints
- println("Got an Int: " + x)
- }
- }
-
-
- actor {
- self.trapExit = true
- self.link(SillyActor)
- SillyActor.start()
-
- react {
- case Exit(SillyActor, _) =>
- self.link(SeriousActor)
- SeriousActor.start()
- react {
- case Exit(SeriousActor, _) =>
- // PinS, page 694
- val seriousActor2 = actor {
- for (i <- 1 to 5)
- println("That is the question.")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
-
- Thread.sleep(200)
- val echoActor = makeEchoActor()
- self.link(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
-
- react {
- case Exit(_, _) =>
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- }
- }
- }
- }
-}
diff --git a/test/files/jvm/actmig-PinS_1.check b/test/files/jvm/actmig-PinS_1.check
deleted file mode 100644
index 97d1c5be02..0000000000
--- a/test/files/jvm/actmig-PinS_1.check
+++ /dev/null
@@ -1,18 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_1.scala b/test/files/jvm/actmig-PinS_1.scala
deleted file mode 100644
index d203526513..0000000000
--- a/test/files/jvm/actmig-PinS_1.scala
+++ /dev/null
@@ -1,130 +0,0 @@
-import scala.actors._
-
-object SillyActor {
- val ref = MigrationSystem.actorOf(Props(() => new SillyActor, "akka.actor.default-stash-dispatcher"))
-}
-
-/* PinS, Listing 32.1: A simple actor
- */
-class SillyActor extends Actor {
- def act() {
- for (i <- 1 to 5) {
- println("I'm acting!")
- Thread.sleep(10)
- }
- }
-}
-
-object SeriousActor {
- val ref = MigrationSystem.actorOf(Props(() => new SeriousActor, "akka.actor.default-stash-dispatcher"))
-}
-
-class SeriousActor extends Actor {
- def act() {
- for (i <- 1 to 5) {
- println("To be or not to be.")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver extends Actor {
- import java.net.{ InetAddress, UnknownHostException }
-
- def act() {
- react {
- case (name: String, actor: Actor) =>
- actor ! getIp(name)
- act()
- case "EXIT" =>
- println("Name resolver exiting.")
- // quit
- case msg =>
- println("Unhandled message: " + msg)
- act()
- }
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): ActorRef = MigrationSystem.actorOf(Props(() => new Actor {
- def act() {
- while (true) {
- receive {
- case 'stop =>
- exit()
- case msg =>
- println("received message: " + msg)
- }
- }
- }
- }, "akka.actor.default-stash-dispatcher"))
-
- /* PinS, page 696
- */
- def makeIntActor(): ActorRef = MigrationSystem.actorOf(Props(() => new Actor {
- def act() {
- receive {
- case x: Int => // I only want Ints
- println("Got an Int: " + x)
- }
- }
- }, "akka.actor.default-stash-dispatcher"))
-
- MigrationSystem.actorOf(Props(() => new Actor {
- def act() {
- trapExit = true
- link(SillyActor.ref)
- react {
- case Exit(_: SillyActor, _) =>
- link(SeriousActor.ref)
- react {
- case Exit(_: SeriousActor, _) =>
- // PinS, page 694
- val seriousActor2 = MigrationSystem.actorOf(Props(() =>
- new Actor {
- def act() {
- for (i <- 1 to 5) {
- println("That is the question.")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
- }
- }
- , "akka.actor.default-stash-dispatcher"))
-
- Thread.sleep(200)
- val echoActor = makeEchoActor()
- link(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
-
- react {
- case Exit(_, _) =>
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- }
- }
- }
- }
- }, "akka.actor.default-stash-dispatcher"))
-}
diff --git a/test/files/jvm/actmig-PinS_2.check b/test/files/jvm/actmig-PinS_2.check
deleted file mode 100644
index 97d1c5be02..0000000000
--- a/test/files/jvm/actmig-PinS_2.check
+++ /dev/null
@@ -1,18 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_2.scala b/test/files/jvm/actmig-PinS_2.scala
deleted file mode 100644
index 9f52cca369..0000000000
--- a/test/files/jvm/actmig-PinS_2.scala
+++ /dev/null
@@ -1,150 +0,0 @@
-import scala.actors.{ MigrationSystem, StashingActor, ActorRef, Props, Exit }
-
-object SillyActor {
- val ref = MigrationSystem.actorOf(Props(() => new SillyActor, "default-stash-dispatcher"))
-}
-
-/* PinS, Listing 32.1: A simple actor
- */
-class SillyActor extends StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- for (i <- 1 to 5) {
- println("I'm acting!")
- Thread.sleep(10)
- }
- }
-}
-
-object SeriousActor {
- val ref = MigrationSystem.actorOf(Props(() => new SeriousActor, "default-stash-dispatcher"))
-}
-
-class SeriousActor extends StashingActor {
- def receive = { case _ => println("Nop") }
- override def act() {
- for (i <- 1 to 5) {
- println("To be or not to be.")
- Thread.sleep(10)
- }
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver {
- val ref = MigrationSystem.actorOf(Props(() => new NameResolver, "default-stash-dispatcher"))
-}
-
-class NameResolver extends StashingActor {
- import java.net.{ InetAddress, UnknownHostException }
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- react {
- case (name: String, actor: ActorRef) =>
- actor ! getIp(name)
- act()
- case "EXIT" =>
- println("Name resolver exiting.")
- // quit
- case msg =>
- println("Unhandled message: " + msg)
- act()
- }
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): ActorRef = MigrationSystem.actorOf(Props(() =>
- new StashingActor {
- def receive = { case _ => println("Nop") }
-
- override def act() {
- loop {
- react {
- case 'stop =>
- exit()
- case msg =>
- println("received message: " + msg)
- }
- }
- }
- }, "default-stash-dispatcher"))
-
- /* PinS, page 696
- */
- def makeIntActor(): ActorRef = MigrationSystem.actorOf(Props(() =>new StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- react {
- case x: Int => // I only want Ints
- println("Got an Int: " + x)
- }
- }
- }, "default-stash-dispatcher"))
-
- MigrationSystem.actorOf(Props(() => new StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- trapExit = true
- link(SillyActor.ref)
- react {
- case Exit(_: SillyActor, _) =>
- link(SeriousActor.ref)
- react {
- case Exit(_: SeriousActor, _) =>
- // PinS, page 694
- val seriousActor2 = MigrationSystem.actorOf(Props(() =>{
- new StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- for (i <- 1 to 5) {
- println("That is the question.")
- Thread.sleep(10)
- }
- }
- }
- }, "default-stash-dispatcher"))
-
- Thread.sleep(200)
- val echoActor = makeEchoActor()
- link(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
-
- react {
- case Exit(_, _) =>
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- }
- }
- }
- }
- }, "default-stash-dispatcher"))
-}
diff --git a/test/files/jvm/actmig-PinS_3.check b/test/files/jvm/actmig-PinS_3.check
deleted file mode 100644
index bdbdf8a692..0000000000
--- a/test/files/jvm/actmig-PinS_3.check
+++ /dev/null
@@ -1,19 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-Post stop
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_3.scala b/test/files/jvm/actmig-PinS_3.scala
deleted file mode 100644
index 047bf53c32..0000000000
--- a/test/files/jvm/actmig-PinS_3.scala
+++ /dev/null
@@ -1,159 +0,0 @@
-import scala.actors.{ MigrationSystem, StashingActor, ActorRef, Terminated, Props }
-
-object SillyActor {
- val ref = MigrationSystem.actorOf(Props(() => new SillyActor, "default-stash-dispatcher"))
-}
-
-/* PinS, Listing 32.1: A simple actor
- */
-class SillyActor extends StashingActor {
- def receive = { case _ => println("Why are you not dead"); context.stop(self) }
-
- override def preStart() {
- for (i <- 1 to 5) {
- println("I'm acting!")
- Thread.sleep(10)
- }
- context.stop(self)
- }
-
- override def postStop() {
- println("Post stop")
- }
-}
-
-object SeriousActor {
- val ref = MigrationSystem.actorOf(Props(() => new SeriousActor, "default-stash-dispatcher"))
-}
-
-class SeriousActor extends StashingActor {
- def receive = { case _ => println("Nop") }
- override def preStart() {
- for (i <- 1 to 5) {
- println("To be or not to be.")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
- context.stop(self)
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver {
- val ref = MigrationSystem.actorOf(Props(() => new NameResolver, "default-stash-dispatcher"))
-}
-
-class NameResolver extends StashingActor {
- import java.net.{ InetAddress, UnknownHostException }
-
- def receive = {
- case (name: String, actor: ActorRef) =>
- actor ! getIp(name)
- case "EXIT" =>
- println("Name resolver exiting.")
- context.stop(self) // quit
- case msg =>
- println("Unhandled message: " + msg)
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): ActorRef = MigrationSystem.actorOf(Props(() => new StashingActor {
-
- def receive = { // how to handle receive
- case 'stop =>
- context.stop(self)
- case msg =>
- println("received message: " + msg)
- }
- }, "default-stash-dispatcher"))
-
- /* PinS, page 696
- */
- def makeIntActor(): ActorRef = MigrationSystem.actorOf(Props(() => new StashingActor {
-
- def receive = {
- case x: Int => // I only want Ints
- unstashAll()
- println("Got an Int: " + x)
- context.stop(self)
- case _ => stash()
- }
- }, "default-stash-dispatcher"))
-
- MigrationSystem.actorOf(Props(() => new StashingActor {
- val silly = SillyActor.ref
-
- override def preStart() {
- context.watch(SillyActor.ref)
- }
-
- def receive = {
- case Terminated(`silly`) =>
- unstashAll()
- val serious = SeriousActor.ref
- context.watch(SeriousActor.ref)
- context.become {
- case Terminated(`serious`) =>
- // PinS, page 694
- val seriousActor2 = MigrationSystem.actorOf(Props(() => {
- new StashingActor {
-
- def receive = { case _ => context.stop(self) }
-
- override def preStart() = {
- for (i <- 1 to 5) {
- println("That is the question.")
- //Thread.sleep(1000)
- Thread.sleep(10)
- }
- context.stop(self)
- }
- }
- }, "default-stash-dispatcher"))
-
- Thread.sleep(200)
- val echoActor = makeEchoActor()
- context.watch(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
-
- context.become {
- case Terminated(_) =>
- unstashAll()
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- context.unbecome()
- context.unbecome()
- context.stop(self)
- case m =>
- println("Stash 1 " + m)
- stash(m)
- }
- case m =>
- println("Stash 2 " + m)
- stash(m)
- }
- case m =>
- println("Stash 3 " + m)
- stash(m)
- }
- }, "default-stash-dispatcher"))
-}
diff --git a/test/files/jvm/actmig-hierarchy.check b/test/files/jvm/actmig-hierarchy.check
deleted file mode 100644
index 317e9677c3..0000000000
--- a/test/files/jvm/actmig-hierarchy.check
+++ /dev/null
@@ -1,2 +0,0 @@
-hello
-hello
diff --git a/test/files/jvm/actmig-hierarchy.scala b/test/files/jvm/actmig-hierarchy.scala
deleted file mode 100644
index 7277329d85..0000000000
--- a/test/files/jvm/actmig-hierarchy.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-import scala.actors._
-
-
-class ReactorActor extends Reactor[String] {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case x if x == "hello1" => println(x.dropRight(1))
- case "exit" => cond = false
- }
- }
- }
-}
-
-class ReplyActor extends ReplyReactor {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case "hello" => println("hello")
- case "exit" => cond = false;
- }
- }
- }
-}
-
-
-
-object Test {
-
- def main(args: Array[String]) {
- val reactorActor = new ReactorActor
- val replyActor = new ReplyActor
- reactorActor.start()
- replyActor.start()
-
- reactorActor ! "hello1"
- replyActor ! "hello"
-
- reactorActor ! "exit"
- replyActor ! "exit"
- }
-}
diff --git a/test/files/jvm/actmig-hierarchy_1.check b/test/files/jvm/actmig-hierarchy_1.check
deleted file mode 100644
index 317e9677c3..0000000000
--- a/test/files/jvm/actmig-hierarchy_1.check
+++ /dev/null
@@ -1,2 +0,0 @@
-hello
-hello
diff --git a/test/files/jvm/actmig-hierarchy_1.scala b/test/files/jvm/actmig-hierarchy_1.scala
deleted file mode 100644
index 559ebe7b11..0000000000
--- a/test/files/jvm/actmig-hierarchy_1.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-import scala.actors._
-
-class ReactorActor extends Actor {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case x: String if x == "hello1" => println(x.dropRight(1))
- case "exit" => cond = false
- }
- }
- }
-}
-
-class ReplyActor extends Actor {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case "hello" => println("hello")
- case "exit" => cond = false;
- }
- }
- }
-}
-
-object Test {
-
- def main(args: Array[String]) {
- val reactorActor = new ReactorActor
- val replyActor = new ReplyActor
- reactorActor.start()
- replyActor.start()
-
- reactorActor ! "hello1"
- replyActor ! "hello"
-
- reactorActor ! "exit"
- replyActor ! "exit"
- }
-}
diff --git a/test/files/jvm/actmig-instantiation.check b/test/files/jvm/actmig-instantiation.check
deleted file mode 100644
index 4c13d5c0a1..0000000000
--- a/test/files/jvm/actmig-instantiation.check
+++ /dev/null
@@ -1,8 +0,0 @@
-OK error: java.lang.RuntimeException: In order to create StashingActor one must use actorOf.
-OK error: java.lang.RuntimeException: Only one actor can be created per actorOf call.
-0
-100
-200
-300
-400
-500
diff --git a/test/files/jvm/actmig-instantiation.scala b/test/files/jvm/actmig-instantiation.scala
deleted file mode 100644
index 4170dbd3ad..0000000000
--- a/test/files/jvm/actmig-instantiation.scala
+++ /dev/null
@@ -1,91 +0,0 @@
-import scala.actors.MigrationSystem._
-import scala.actors.Actor._
-import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill }
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-
-class TestStashingActor extends StashingActor {
-
- def receive = { case v: Int => Test.append(v); Test.latch.countDown() }
-
-}
-
-object Test {
- val NUMBER_OF_TESTS = 5
-
- // used for sorting non-deterministic output
- val buff = ArrayBuffer[Int](0)
- val latch = new CountDownLatch(NUMBER_OF_TESTS)
- val toStop = ArrayBuffer[ActorRef]()
-
- def append(v: Int) = synchronized {
- buff += v
- }
-
- def main(args: Array[String]) = {
- // plain scala actor
- val a1 = actor {
- react { case v: Int => Test.append(v); Test.latch.countDown() }
- }
- a1 ! 100
-
- // simple instantiation
- val a2 = MigrationSystem.actorOf(Props(() => new TestStashingActor, "akka.actor.default-stash-dispatcher"))
- a2 ! 200
- toStop += a2
-
- // actor of with scala actor
- val a3 = actorOf(Props(() => actor {
- react { case v: Int => Test.append(v); Test.latch.countDown() }
- }, "akka.actor.default-stash-dispatcher"))
- a3 ! 300
-
- // using the manifest
- val a4 = actorOf(Props(() => new TestStashingActor, "akka.actor.default-stash-dispatcher"))
- a4 ! 400
- toStop += a4
-
- // deterministic part of a test
- // creation without actorOf
- try {
- val a3 = new TestStashingActor
- a3 ! -1
- } catch {
- case e => println("OK error: " + e)
- }
-
- // actorOf double creation
- try {
- val a3 = actorOf(Props(() => {
- new TestStashingActor
- new TestStashingActor
- }, "akka.actor.default-stash-dispatcher"))
- a3 ! -1
- } catch {
- case e => println("OK error: " + e)
- }
-
- // actorOf nesting
- try {
- val a5 = actorOf(Props(() => {
- val a6 = actorOf(Props(() => new TestStashingActor, "akka.actor.default-stash-dispatcher"))
- toStop += a6
- new TestStashingActor
- }, "akka.actor.default-stash-dispatcher"))
-
- a5 ! 500
- toStop += a5
- } catch {
- case e => println("Should not throw an exception: " + e)
- }
-
- // output
- latch.await(200, TimeUnit.MILLISECONDS)
- if (latch.getCount() > 0) {
- println("Error: Tasks have not finished!!!")
- }
-
- buff.sorted.foreach(println)
- toStop.foreach(_ ! PoisonPill)
- }
-}
diff --git a/test/files/jvm/actmig-loop-react.check b/test/files/jvm/actmig-loop-react.check
deleted file mode 100644
index 7b955aa9b9..0000000000
--- a/test/files/jvm/actmig-loop-react.check
+++ /dev/null
@@ -1,16 +0,0 @@
-do task
-do task
-do task
-do task
-working
-scala got exception
-working
-akka got exception
-do task 1
-do string I am a String
-do task 42
-after react
-Terminated
-do task 1
-do string I am a String
-do task 42
diff --git a/test/files/jvm/actmig-loop-react.scala b/test/files/jvm/actmig-loop-react.scala
deleted file mode 100644
index 8452f9766a..0000000000
--- a/test/files/jvm/actmig-loop-react.scala
+++ /dev/null
@@ -1,170 +0,0 @@
-import scala.actors.MigrationSystem._
-import scala.actors.Actor._
-import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill }
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-
-object Test {
-
- def testLoopWithConditionReact() = {
- // Snippet showing composition of receives
- // Loop with Condition Snippet - before
- val myActor = actor {
- var c = true
- loopWhile(c) {
- react {
- case x: Int =>
- // do task
- println("do task")
- if (x == 42) c = false
- }
- }
- }
-
- myActor.start()
- myActor ! 1
- myActor ! 42
-
- // Loop with Condition Snippet - migrated
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
-
- def receive = {
- case x: Int =>
- // do task
- println("do task")
- if (x == 42) context.stop(self)
- }
- }, "default-stashing-dispatcher"))
- myAkkaActor ! 1
- myAkkaActor ! 42
- }
-
- def testNestedReact() = {
- // Snippet showing composition of receives
- // Loop with Condition Snippet - before
- val myActor = actor {
- var c = true
- loopWhile(c) {
- react {
- case x: Int =>
- // do task
- println("do task " + x)
- if (x == 42) c = false
- else
- react {
- case y: String =>
- println("do string " + y)
- }
- println("after react")
- }
- }
- }
- myActor.start()
-
- myActor ! 1
- myActor ! "I am a String"
- myActor ! 42
-
- Thread.sleep(100)
- println(myActor.getState)
-
- // Loop with Condition Snippet - migrated
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
-
- def receive = {
- case x: Int =>
- // do task
- println("do task " + x)
- if (x == 42)
- context.stop(self)
- else
- context.become(({
- case y: String =>
- println("do string " + y)
- }: Receive).andThen(x => {
- unstashAll()
- context.unbecome()
- }).orElse { case x => stash() })
- }
- }, "default-stashing-dispatcher"))
-
- myAkkaActor ! 1
- myAkkaActor ! "I am a String"
- myAkkaActor ! 42
-
- }
-
- def exceptionHandling() = {
- // Stashing actor with act and exception handler
- val myActor = MigrationSystem.actorOf(Props(() => new StashingActor {
-
- def receive = { case _ => println("Dummy method.") }
- override def act() = {
- loop {
- react {
- case "fail" =>
- throw new Exception("failed")
- case "work" =>
- println("working")
- case "die" =>
- exit()
- }
- }
- }
-
- override def exceptionHandler = {
- case x: Exception => println("scala got exception")
- }
-
- }, "default-stashing-dispatcher"))
-
- myActor ! "work"
- myActor ! "fail"
- myActor ! "die"
-
- Thread.sleep(100)
- // Stashing actor in Akka style
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
- def receive = PFCatch({
- case "fail" =>
- throw new Exception("failed")
- case "work" =>
- println("working")
- case "die" =>
- context.stop(self)
- }, { case x: Exception => println("akka got exception") })
- }, "default-stashing-dispatcher"))
-
- myAkkaActor ! "work"
- myAkkaActor ! "fail"
- myAkkaActor ! "die"
- }
-
- def main(args: Array[String]) = {
- testLoopWithConditionReact()
- Thread.sleep(100)
- exceptionHandling()
- Thread.sleep(100)
- testNestedReact()
- }
-
-}
-
-// As per Jim Mcbeath blog (http://jim-mcbeath.blogspot.com/2008/07/actor-exceptions.html)
-class PFCatch(f: PartialFunction[Any, Unit], handler: PartialFunction[Exception, Unit])
- extends PartialFunction[Any, Unit] {
-
- def apply(x: Any) = {
- try {
- f(x)
- } catch {
- case e: Exception if handler.isDefinedAt(e) => handler(e)
- }
- }
-
- def isDefinedAt(x: Any) = f.isDefinedAt(x)
-}
-
-object PFCatch {
- def apply(f: PartialFunction[Any, Unit], handler: PartialFunction[Exception, Unit]) = new PFCatch(f, handler)
-}
diff --git a/test/files/jvm/actmig-public-methods.check b/test/files/jvm/actmig-public-methods.check
deleted file mode 100644
index bb6530c926..0000000000
--- a/test/files/jvm/actmig-public-methods.check
+++ /dev/null
@@ -1,6 +0,0 @@
-None
-Some(bang qmark after 1)
-bang
-bang qmark after 0
-bang qmark in future after 0
-typed bang qmark in future after 0
diff --git a/test/files/jvm/actmig-public-methods.scala b/test/files/jvm/actmig-public-methods.scala
deleted file mode 100644
index c4c8560122..0000000000
--- a/test/files/jvm/actmig-public-methods.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-import scala.collection.mutable.ArrayBuffer
-import scala.actors.Actor._
-import scala.actors._
-import scala.actors.MigrationSystem
-import scala.util.continuations._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-
-object Test {
- val NUMBER_OF_TESTS = 6
-
- // used for sorting non-deterministic output
- val buff = ArrayBuffer[String]()
- val latch = new CountDownLatch(NUMBER_OF_TESTS)
- val toStop = ArrayBuffer[Actor]()
-
- def append(v: String) = synchronized {
- buff += v
- }
-
- def main(args: Array[String]) = {
-
- val respActor = actor {
- loop {
- react {
- case (x: String, time: Long) =>
- Thread.sleep(time)
- reply(x + " after " + time)
- case str: String =>
- append(str)
- latch.countDown()
- case _ => exit()
- }
- }
- }
-
- toStop += respActor
-
- respActor ! ("bang")
-
- val res1 = respActor !? (("bang qmark", 0L))
- append(res1.toString)
- latch.countDown()
-
- val res2 = respActor !? (200, ("bang qmark", 1L))
- append(res2.toString)
- latch.countDown()
-
- val res21 = respActor !? (1, ("bang qmark", 200L))
- append(res21.toString)
- latch.countDown()
-
- val fut1 = respActor !! (("bang qmark in future", 0L))
- append(fut1().toString())
- latch.countDown()
-
- val fut2 = respActor !! (("typed bang qmark in future", 0L), { case x: String => x })
- append(fut2())
- latch.countDown()
-
- // output
- latch.await(10, TimeUnit.MILLISECONDS)
- if (latch.getCount() > 0) {
- println("Error: Tasks have not finished!!!")
- }
-
- buff.sorted.foreach(println)
- toStop.foreach(_ ! 'stop)
- }
-}
diff --git a/test/files/jvm/actmig-public-methods_1.check b/test/files/jvm/actmig-public-methods_1.check
deleted file mode 100644
index bb6530c926..0000000000
--- a/test/files/jvm/actmig-public-methods_1.check
+++ /dev/null
@@ -1,6 +0,0 @@
-None
-Some(bang qmark after 1)
-bang
-bang qmark after 0
-bang qmark in future after 0
-typed bang qmark in future after 0
diff --git a/test/files/jvm/actmig-public-methods_1.scala b/test/files/jvm/actmig-public-methods_1.scala
deleted file mode 100644
index 41798c4c37..0000000000
--- a/test/files/jvm/actmig-public-methods_1.scala
+++ /dev/null
@@ -1,88 +0,0 @@
-import scala.collection.mutable.ArrayBuffer
-import scala.actors.Actor._
-import scala.actors._
-import scala.util._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.concurrent.util.Duration
-import scala.actors.pattern._
-
-object Test {
- val NUMBER_OF_TESTS = 6
-
- // used for sorting non-deterministic output
- val buff = ArrayBuffer[String]()
- val latch = new CountDownLatch(NUMBER_OF_TESTS)
- val toStop = ArrayBuffer[ActorRef]()
-
- def append(v: String) = synchronized {
- buff += v
- }
-
- def main(args: Array[String]) = {
-
- val respActor = MigrationSystem.actorOf(Props(() => actor {
- loop {
- react {
- case (x: String, time: Long) =>
- Thread.sleep(time)
- reply(x + " after " + time)
- case str: String =>
- append(str)
- latch.countDown()
- case x =>
- exit()
- }
- }
- }, "akka.actor.default-stash-dispatcher"))
-
- toStop += respActor
-
- respActor ! "bang"
-
- implicit val timeout = Timeout(Duration(200, TimeUnit.MILLISECONDS))
- val msg = ("bang qmark", 0L)
- val res1 = respActor.?(msg)(Timeout(Duration.Inf))
- append(res1().toString)
- latch.countDown()
-
- val msg1 = ("bang qmark", 1L)
- val res2 = respActor.?(msg1)(Timeout(Duration(200, TimeUnit.MILLISECONDS)))
- append((res2() match {
- case x: AskTimeoutException => None
- case v => Some(v)
- }).toString)
- latch.countDown()
-
- // this one should time out
- val msg11 = ("bang qmark", 200L)
- val res21 = respActor.?(msg11)(Timeout(Duration(1, TimeUnit.MILLISECONDS)))
- append((res21() match {
- case x: AskTimeoutException => None
- case v => Some(v)
- }).toString)
- latch.countDown()
-
- val msg2 = ("bang qmark in future", 0L)
- val fut1 = respActor.?(msg2)(Duration.Inf)
- append(fut1().toString())
- latch.countDown()
-
- val handler: PartialFunction[Any, String] = {
- case x: String => x.toString
- }
-
- val msg3 = ("typed bang qmark in future", 0L)
- val fut2 = (respActor.?(msg3)(Duration.Inf))
- append(Futures.future { handler.apply(fut2()) }().toString)
- latch.countDown()
-
- // output
- latch.await(10, TimeUnit.MILLISECONDS)
- if (latch.getCount() > 0) {
- println("Error: Tasks have not finished!!!")
- }
-
- buff.sorted.foreach(println)
- toStop.foreach(_ ! PoisonPill)
- }
-}
diff --git a/test/files/jvm/actmig-react-receive.check b/test/files/jvm/actmig-react-receive.check
deleted file mode 100644
index cc2a426e68..0000000000
--- a/test/files/jvm/actmig-react-receive.check
+++ /dev/null
@@ -1,16 +0,0 @@
-do before
-do task
-do after
-do before
-do task
-do after
-do before
-do task
-do in between
-do string
-do after
-do before
-do task
-do in between
-do string
-do after
diff --git a/test/files/jvm/actmig-react-receive.scala b/test/files/jvm/actmig-react-receive.scala
deleted file mode 100644
index fbc10a8d52..0000000000
--- a/test/files/jvm/actmig-react-receive.scala
+++ /dev/null
@@ -1,104 +0,0 @@
-import scala.actors.MigrationSystem._
-import scala.actors.Actor._
-import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill }
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-
-object Test {
-
- def testComposition() = {
- // Snippet showing composition of receives
- // React Snippet - before
- val myActor = actor {
- // do before
- println("do before")
- receive {
- case x: Int =>
- // do task
- println("do task")
- }
- println("do in between")
- receive {
- case x: String =>
- // do string now
- println("do string")
- }
- println("do after")
- }
- myActor.start()
- myActor ! 1
- myActor ! "1"
- Thread.sleep(200)
- // React Snippet - migrated
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
- override def preStart() = {
- println("do before")
- }
-
- def receive = ({
- case x: Int =>
- // do task
- println("do task")
- }: Receive) andThen { v =>
- context.become {
- case x: String =>
- //do string
- println("do string")
- context.stop(self)
- }
- println("do in between")
- }
-
- override def postStop() = {
- println("do after")
- }
-
- }, "default-stashing-dispatcher"))
- myAkkaActor ! 1
- myAkkaActor ! "1"
- Thread.sleep(200)
- }
-
- def main(args: Array[String]) = {
- // React Snippet - before
- val myActor = actor {
- // do before
- println("do before")
- receive {
- case x: Int =>
- // do task
- println("do task")
- }
- println("do after")
- }
- myActor.start()
- myActor ! 1
-
- Thread.sleep(200)
-
- // React Snippet - migrated
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
- override def preStart() = {
- println("do before")
- }
-
- def receive = {
- case x: Int =>
- // do task
- println("do task")
- context.stop(self)
- }
-
- override def postStop() = {
- println("do after")
- }
-
- }, "default-stashing-dispatcher"))
- myAkkaActor ! 1
-
- Thread.sleep(200)
- // Starting composition test
- testComposition()
-
- }
-}
diff --git a/test/files/jvm/manifests-new.check b/test/files/jvm/manifests-new.check
index 896a5c1cef..9ff49ef8b4 100644
--- a/test/files/jvm/manifests-new.check
+++ b/test/files/jvm/manifests-new.check
@@ -1,38 +1,38 @@
-x=(), t=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit
-x=true, t=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean
-x=a, t=ConcreteTypeTag[Char], k=TypeRef, s=class Char
-x=1, t=ConcreteTypeTag[Int], k=TypeRef, s=class Int
-x=abc, t=ConcreteTypeTag[String], k=TypeRef, s=class String
-x='abc, t=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol
-
-x=List(()), t=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List
-x=List(true), t=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List
-x=List(1), t=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List
-x=List(abc), t=ConcreteTypeTag[List[String]], k=TypeRef, s=class List
-x=List('abc), t=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List
-
-x=[Z, t=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array
-x=[C, t=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array
-x=[I, t=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array
-x=[Ljava.lang.String;, t=ConcreteTypeTag[Array[String]], k=TypeRef, s=class Array
-x=[Lscala.Symbol;, t=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array
-
-x=((),()), t=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2
-x=(true,false), t=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2
-x=(1,2), t=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2
-x=(abc,xyz), t=ConcreteTypeTag[(String, String)], k=TypeRef, s=class Tuple2
-x=('abc,'xyz), t=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2
-
-x=Test$, t=ConcreteTypeTag[Test.type], k=SingleType, s=object Test
-x=scala.collection.immutable.List$, t=ConcreteTypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List
-
-x=Foo, t=ConcreteTypeTag[Foo[Int]], k=TypeRef, s=class Foo
-x=Foo, t=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo
-x=Foo, t=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo
-x=Foo, t=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo
-
-x=Test1$$anon$1, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
-x=Test1$$anon$2, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+x=(), t=TypeTag[Unit], k=TypeRef, s=class Unit
+x=true, t=TypeTag[Boolean], k=TypeRef, s=class Boolean
+x=a, t=TypeTag[Char], k=TypeRef, s=class Char
+x=1, t=TypeTag[Int], k=TypeRef, s=class Int
+x=abc, t=TypeTag[java.lang.String], k=TypeRef, s=class String
+x='abc, t=TypeTag[Symbol], k=TypeRef, s=class Symbol
+
+x=List(()), t=TypeTag[List[Unit]], k=TypeRef, s=class List
+x=List(true), t=TypeTag[List[Boolean]], k=TypeRef, s=class List
+x=List(1), t=TypeTag[List[Int]], k=TypeRef, s=class List
+x=List(abc), t=TypeTag[List[java.lang.String]], k=TypeRef, s=class List
+x=List('abc), t=TypeTag[List[Symbol]], k=TypeRef, s=class List
+
+x=[Z, t=TypeTag[Array[Boolean]], k=TypeRef, s=class Array
+x=[C, t=TypeTag[Array[Char]], k=TypeRef, s=class Array
+x=[I, t=TypeTag[Array[Int]], k=TypeRef, s=class Array
+x=[Ljava.lang.String;, t=TypeTag[Array[java.lang.String]], k=TypeRef, s=class Array
+x=[Lscala.Symbol;, t=TypeTag[Array[Symbol]], k=TypeRef, s=class Array
+
+x=((),()), t=TypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2
+x=(true,false), t=TypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2
+x=(1,2), t=TypeTag[(Int, Int)], k=TypeRef, s=class Tuple2
+x=(abc,xyz), t=TypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2
+x=('abc,'xyz), t=TypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2
+
+x=Test$, t=TypeTag[Test.type], k=SingleType, s=object Test
+x=scala.collection.immutable.List$, t=TypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List
+
+x=Foo, t=TypeTag[Foo[Int]], k=TypeRef, s=class Foo
+x=Foo, t=TypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo
+x=Foo, t=TypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo
+x=Foo, t=TypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo
+
+x=Test1$$anon$1, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s=<local Test1>
+x=Test1$$anon$2, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s=<local Test1>
()=()
true=true
diff --git a/test/files/jvm/manifests-new.scala b/test/files/jvm/manifests-new.scala
index d02f6ee608..8706881640 100644
--- a/test/files/jvm/manifests-new.scala
+++ b/test/files/jvm/manifests-new.scala
@@ -1,3 +1,6 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.{ClassTag, classTag}
+
object Test extends App {
Test1
Test2
@@ -58,12 +61,12 @@ object Test2 {
println("true="+load[Boolean](dump(true)))
println("a="+load[Char](dump('a')))
println("1="+load[Int](dump(1)))
- println("'abc="+load[Symbol](dump('abc)))
+ println("'abc="+load[scala.Symbol](dump('abc)))
println()
println("List(())="+load[List[Unit]](dump(List(()))))
println("List(true)="+load[List[Boolean]](dump(List(true))))
- println("List('abc)="+load[List[Symbol]](dump(List('abc))))
+ println("List('abc)="+load[List[scala.Symbol]](dump(List('abc))))
println()
def loadArray[T](x: Array[Byte])(implicit t: reflect.ClassTag[Array[T]]) =
@@ -98,12 +101,11 @@ trait TestUtil {
val in = new ObjectInputStream(new ByteArrayInputStream(buffer))
in.readObject().asInstanceOf[A]
}
- import scala.reflect._
- def print[T](x: T)(implicit t: ConcreteTypeTag[T]) {
+ def print[T](x: T)(implicit t: TypeTag[T]) {
// todo. type tags are not yet serializable
-// val t1: ConcreteTypeTag[T] = read(write(t))
- val t1: ConcreteTypeTag[T] = t
+// val t1: TypeTag[T] = read(write(t))
+ val t1: TypeTag[T] = t
val x1 = x.toString.replaceAll("@[0-9a-z]+$", "")
- println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.sym.toString)
+ println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.tpe.typeSymbol.toString)
}
-}
+} \ No newline at end of file
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index 86655ad89c..012460147a 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -808,6 +808,126 @@ trait TryEitherExtractor extends TestBase {
testLeftMatch()
}
+trait CustomExecutionContext extends TestBase {
+ import scala.concurrent.{ ExecutionContext, Awaitable }
+
+ def defaultEC = ExecutionContext.defaultExecutionContext
+
+ val inEC = new java.lang.ThreadLocal[Int]() {
+ override def initialValue = 0
+ }
+
+ def enterEC() = inEC.set(inEC.get + 1)
+ def leaveEC() = inEC.set(inEC.get - 1)
+ def assertEC() = assert(inEC.get > 0)
+ def assertNoEC() = assert(inEC.get == 0)
+
+ class CountingExecutionContext extends ExecutionContext {
+ val _count = new java.util.concurrent.atomic.AtomicInteger(0)
+ def count = _count.get
+
+ def delegate = ExecutionContext.defaultExecutionContext
+
+ override def execute(runnable: Runnable) = {
+ _count.incrementAndGet()
+ val wrapper = new Runnable() {
+ override def run() = {
+ enterEC()
+ try {
+ runnable.run()
+ } finally {
+ leaveEC()
+ }
+ }
+ }
+ delegate.execute(wrapper)
+ }
+
+ override def internalBlockingCall[T](awaitable: Awaitable[T], atMost: Duration): T =
+ delegate.internalBlockingCall(awaitable, atMost)
+
+ override def reportFailure(t: Throwable): Unit = {
+ System.err.println("Failure: " + t.getClass.getSimpleName + ": " + t.getMessage)
+ delegate.reportFailure(t)
+ }
+ }
+
+ def countExecs(block: (ExecutionContext) => Unit): Int = {
+ val context = new CountingExecutionContext()
+ block(context)
+ context.count
+ }
+
+ def testOnSuccessCustomEC(): Unit = {
+ val count = countExecs { implicit ec =>
+ once { done =>
+ val f = future({ assertNoEC() })(defaultEC)
+ f onSuccess {
+ case _ =>
+ assertEC()
+ done()
+ }
+ assertNoEC()
+ }
+ }
+
+ // should be onSuccess, but not future body
+ assert(count == 1)
+ }
+
+ def testKeptPromiseCustomEC(): Unit = {
+ val count = countExecs { implicit ec =>
+ once { done =>
+ val f = Promise.successful(10).future
+ f onSuccess {
+ case _ =>
+ assertEC()
+ done()
+ }
+ }
+ }
+
+ // should be onSuccess called once in proper EC
+ assert(count == 1)
+ }
+
+ def testCallbackChainCustomEC(): Unit = {
+ val count = countExecs { implicit ec =>
+ once { done =>
+ assertNoEC()
+ val addOne = { x: Int => assertEC(); x + 1 }
+ val f = Promise.successful(10).future
+ f.map(addOne).filter { x =>
+ assertEC()
+ x == 11
+ } flatMap { x =>
+ Promise.successful(x + 1).future.map(addOne).map(addOne)
+ } onComplete {
+ case Left(t) =>
+ try {
+ throw new AssertionError("error in test: " + t.getMessage, t)
+ } finally {
+ done()
+ }
+ case Right(x) =>
+ assertEC()
+ assert(x == 14)
+ done()
+ }
+ assertNoEC()
+ }
+ }
+
+ // the count is not defined (other than >=1)
+ // due to the batching optimizations.
+ assert(count >= 1)
+ }
+
+ testOnSuccessCustomEC()
+ testKeptPromiseCustomEC()
+ testCallbackChainCustomEC()
+}
+
object Test
extends App
with FutureCallbacks
@@ -816,6 +936,7 @@ with FutureProjections
with Promises
with Exceptions
with TryEitherExtractor
+with CustomExecutionContext
{
System.exit(0)
}
diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala
index bb971fdf36..91eb52928f 100644
--- a/test/files/jvm/serialization-new.scala
+++ b/test/files/jvm/serialization-new.scala
@@ -282,7 +282,7 @@ object Test2_immutable {
// Test classes in package "scala.collection.mutable"
object Test3_mutable {
- import scala.reflect.ArrayTag
+ import scala.reflect.ClassTag
import scala.collection.mutable.{
ArrayBuffer, ArrayBuilder, ArraySeq, ArrayStack, BitSet, DoubleLinkedList,
HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue,
@@ -299,11 +299,11 @@ object Test3_mutable {
// ArrayBuilder
val abu1 = ArrayBuilder.make[Long]
- val _abu1: ArrayBuilder[ArrayTag[Long]] = read(write(abu1))
+ val _abu1: ArrayBuilder[ClassTag[Long]] = read(write(abu1))
check(abu1, _abu1)
val abu2 = ArrayBuilder.make[Float]
- val _abu2: ArrayBuilder[ArrayTag[Float]] = read(write(abu2))
+ val _abu2: ArrayBuilder[ClassTag[Float]] = read(write(abu2))
check(abu2, _abu2)
// ArraySeq
@@ -648,4 +648,4 @@ object Test9_parallel {
println("Error in Test5_parallel: " + e)
throw e
}
-}
+} \ No newline at end of file
diff --git a/test/files/jvm/t1652.check b/test/files/jvm/t1652.check
deleted file mode 100644
index dfa480ce6e..0000000000
--- a/test/files/jvm/t1652.check
+++ /dev/null
@@ -1,2 +0,0 @@
-OK1
-OK2