You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the expected behavior of the issue
Show compile and link
Please provide a description of what actually happens
[error] Referring to non-existent method scala.scalajs.runtime.RuntimeString$.lines(java.lang.String)java.util.stream.Stream
[error] called from org.scalamock.handlers.Handlers.$$anonfun$toString$1(org.scalamock.handlers.Handler)[java.lang.String
[error] called from org.scalamock.handlers.Handlers.toString()java.lang.String
[error] called from org.scalactic.Requirements$RequirementsHelper.append(java.lang.String,java.lang.Object)java.lang.String
[error] called from org.scalactic.Requirements$RequirementsHelper.macroRequire(org.scalactic.Bool,java.lang.Object)scala.Unit
[error] called from org.scalatest.Failed.<init>(java.lang.Throwable)
[error] called from org.scalatest.OutcomeOf.outcomeOf(scala.Function0)org.scalatest.Outcome
[error] called from org.scalatest.OutcomeOf$.outcomeOf(scala.Function0)org.scalatest.Outcome
[error] called from org.scalatest.Transformer.apply()org.scalatest.Outcome
[error] called from org.scalatest.Transformer.apply()java.lang.Object
[error] called from org.scalatest.SuperEngine.registerNestedBranch(java.lang.String,scala.Option,scala.Function0,scala.Function0,java.lang.String,java.lang.String,scala.Int,scala.Int,scala.Option,scala.Option)scala.Unit
[error] called from org.scalatest.FreeSpecLike$FreeSpecStringWrapper.$$minus(scala.Function0)scala.Unit
[error] called from com.yang_bo.dsl.domains.akka.actor.typedExample.<init>()
[error] called from com.yang_bo.dsl.domains.akka.actor.typedExample.<clinit>()
[error] called from core module analyzer
[error] involving instantiated classes:
[error] org.scalamock.handlers.UnorderedHandlers
[error] org.scalactic.Requirements$RequirementsHelper
[error] org.scalatest.OutcomeOf$
[error] org.scalatest.Transformer
[error] org.scalatest.Engine
[error] org.scalatest.FreeSpecLike$FreeSpecStringWrapper
Reproducible Test Case
packagecom.yang_bo.dsl.domains.akka.actorfinalclasstypedExampleextends _root_.org.scalatest.FreeSpecwith _root_.org.scalatest.Matcherswith org.scalamock.scalatest.MockFactory {
"com.yang_bo.dsl.domains.akka.actor"- {
"typed"- {
this.markup("Contains the [[com.thoughtworks.dsl.Dsl]] instances in a typed actor.")
this.markup("<h4>Installation</h4>")
this.markup("""This [[typed]] object supports [[keywords.akka.actor.ReceiveMessage.unary_$bang !]]-notation for [[keywords.akka.actor.ReceiveMessage]] in the typed actor domains,which requires [[com.thoughtworks.dsl.compilerplugins.BangNotation BangNotation]] and [[com.thoughtworks.dsl.compilerplugins.ResetEverywhere ResetEverywhere]] compiler plugins along with this `typed` library.For sbt, add the following settings to your `build.sbt`:""")
this.markup("""<pre>addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-bangnotation" % "latest.release")addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-reseteverywhere" % "latest.release")libraryDependencies += "com.yang-bo.dsl.domains.akka.actor" %% "typed" % "latest.release"</pre>""")
this.markup("<h4>Imports</h4>")
this.markup("Then, add the following import statement to enable `ReceiveMessage` in the [[akka.actor.typed.Behavior]] domain.")
importcom.yang_bo.dsl.domains.akka.actor.typed._importcom.yang_bo.dsl.keywords.akka.actor.ReceiveMessage"""@example This library can be used as an alternative to [[akka.actor.FSM]],for creating state machines in simple Scala control flow.""".in(try {
this.markup("The following state machine contains two states and two transitions between them.")
this.markup("<br/><img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Finite_state_machine_example_with_comments.svg/420px-Finite_state_machine_example_with_comments.svg.png\"/><br/>")
this.markup("It can be created as a simple `while` loop with the help of [[keywords.akka.actor.ReceiveMessage.Partial]]:")
importakka.actor.typed._sealedtraitStatecaseobjectOpenedextendsStatecaseobjectClosedextendsStatesealedtraitTransitioncaseclassOpen(response: ActorRef[State]) extendsTransitioncaseclassClose(response: ActorRef[State]) extendsTransitiondefdoorActor:Behavior[Transition] = {
while (true) {
valopen=!ReceiveMessage.Partial[Open]
open.response !Openedvalclose=!ReceiveMessage.Partial[Close]
close.response !Closed
}
thrownewException("Unreachable code!")
}
this.markup("The door should reply an `Opened` state after performing an `Open` transition,")
importakka.actor.testkit.typed.scaladsl._valdoor=BehaviorTestKit(doorActor)
valstate=TestInbox[State]()
door.run(Open(state.ref))
state.expectMessage(Opened)
this.markup("and the state of the door can be switched between `Opend` and `Closed` according to `Open` and `Close` transition.")
door.run(Close(state.ref))
state.expectMessage(Closed)
door.run(Open(state.ref))
state.expectMessage(Opened)
door.run(Close(state.ref))
state.expectMessage(Closed)
} finally {})
"""@note To use `try` / `catch` / `finally` expressions with !-notation,the return type of enclosing function should be `Behavior[?] !! Throwable`,as shown in the following `createDecoderActor` method.""".in(try {
this.markup("""It will open an [[java.io.InputStream]],read [[String]] from the stream,and close the stream in a `finally` block.""")
importakka.actor.typed._importakka.actor.typed.scaladsl._importcom.thoughtworks.dsl.Dsl.!!importjava.io._importjava.net._sealedtraitCommandcaseclassOpen(open: () =>InputStream) extendsCommandcaseclassReadObject(response: ActorRef[String]) extendsCommandcaseobjectCloseextendsCommandclassDecoderException(cause: Throwable) extendsException(cause)
defcreateDecoderActor:Behavior[Command] !! Throwable= {
while (true) {
valinputStream= (!ReceiveMessage.Partial[Open]).open()
try {
valReadObject(replyTo) =!ReceiveMessage.Partial[ReadObject]
replyTo !new java.io.DataInputStream(inputStream).readUTF()
!ReceiveMessage.Partial[Close.type]
} catch {
casee: IOException=>thrownewDecoderException(e)
} finally {
inputStream.close()
}
}
thrownewAssertionError("Unreachable code!")
}
this.markup("""Since `createDecoderActor` returns `Behavior[Command] !! Throwable`,it receives message of type `Command`,and accepts an additional callback functionto handle exceptions that are not handled in `createDecoderActor`.""")
importakka.actor.testkit.typed.scaladsl._valerrorHandler= mockFunction[Throwable, Behavior[Command]]
valdecoderActor=BehaviorTestKit(createDecoderActor(errorHandler))
this.markup("Given an `InputStream` that throws an [[java.io.IOException]] when read from it,")
valinputStream:InputStream= mock[InputStream]
toMockFunction0(inputStream.read _).expects().throws(newIOException())
decoderActor.run(Open { () => inputStream })
this.markup("""when the `decoderActor` try to read a [[String]] from the stream,it should close the stream due to `finally` block triggered by the exception.""")
valinbox=TestInbox[String]()
errorHandler.expects(where[Throwable](_.isInstanceOf[DecoderException])).returns(Behaviors.stopped)
toMockFunction0(inputStream.close _).expects().returns(()).once()
decoderActor.run(ReadObject(inbox.ref))
inbox.receiveAll() should be(empty)
} finally {})
"@author 杨博 (Yang Bo)"- {}
"typedReceiveMessageDsl"- {
this.markup("Returns an [[com.thoughtworks.dsl.Dsl]] instance for [[keywords.akka.actor.ReceiveMessage]] in the [[akka.actor.typed.Behavior]] domain.")
"@example Given an `echoActor` that receives `Ping` messages and replies corresponding `Pong` messages".in(try {
importakka.actor.typed._caseclassPing(message: String, response: ActorRef[Pong])
caseclassPong(message: String)
defechoActor:Behavior[Ping] = {
while (true) {
valPing(m, replyTo) =!ReceiveMessage[Ping]
replyTo !Pong(m)
}
thrownewException("Unreachable code!")
}
this.markup("""When pinging it with "hello",then it should reply a `Pong` with the same message "hello".""")
importakka.actor.testkit.typed.scaladsl._valpinger=BehaviorTestKit(echoActor)
valprobe=TestInbox[Pong]()
pinger.run(Ping("hello", probe.ref))
probe.expectMessage(Pong("hello"))
} finally {})
}
"typedReceiveMessagePartialDsl"- {
this.markup("Returns an [[com.thoughtworks.dsl.Dsl]] instance for [[keywords.akka.actor.ReceiveMessage.Partial]] in the [[akka.actor.typed.Behavior]] domain.")
"@example Given an `echoActor` that receives `Ping` messages and replies corresponding `Pong` messages".in(try {
importakka.actor.typed._caseclassPing(message: String, response: ActorRef[Pong])
caseclassPong(message: String)
defechoActor:Behavior[AnyRef] = {
while (true) {
valPing(m, replyTo) =!ReceiveMessage.Partial[Ping]
replyTo !Pong(m)
}
thrownewException("Unreachable code!")
}
this.markup("""When pinging it with "hello",then it should reply a `Pong` with the same message "message",and other types of messages should not be handled.""")
importakka.actor.testkit.typed.scaladsl._valpinger=BehaviorTestKit(echoActor)
objectUnhandledMessage
pinger.run(UnhandledMessage)
valprobe=TestInbox[Pong]()
pinger.run(Ping("hello", probe.ref))
probe.expectMessage(Pong("hello"))
} finally {})
}
}
}
}
Note that this also affects all pre-Java 11 JVM runtimes and IMHO is caused by releasing with OpenJDK 11.
java.lang.NoSuchMethodError: java.lang.String.lines()Ljava/util/stream/Stream;
at org.scalamock.handlers.Handlers.$anonfun$toString$1(Handlers.scala:35)
ScalaMock Version (e.g. 3.5.0)
4.3.0
Scala Version (e.g. 2.12)
2.12.8
Runtime (JVM or JS)
JS
Please describe the expected behavior of the issue
Show compile and link
Please provide a description of what actually happens
Reproducible Test Case
The reproduction code can be found in this PR: Atry/Dsl.scala-akka-actor#12
Full log: https://travis-ci.org/Atry/Dsl.scala-akka-actor/jobs/549688495
The text was updated successfully, but these errors were encountered: