CORDA-644: Only serialise Kotlin lambdas when checkpointing. (#1801)

* Remove local function because it is serialised as a lambda.
* Don't automatically whitelist Kotlin lambdas unless checkpointing.
* Add comment to @CordaSerializable, warning not to allow AnnotationTarget.EXPRESSION.
This commit is contained in:
Chris Rankin
2017-10-09 13:02:40 +01:00
committed by GitHub
parent f83f1b7010
commit 689758a71c
5 changed files with 141 additions and 10 deletions

View File

@ -404,9 +404,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
@Suspendable
private fun ReceiveRequest<*>.suspendAndExpectReceive(): ReceivedSessionMessage<*> {
fun pollForMessage() = session.receivedMessages.poll()
val polledMessage = pollForMessage()
val polledMessage = session.receivedMessages.poll()
return if (polledMessage != null) {
if (this is SendAndReceive) {
// Since we've already received the message, we downgrade to a send only to get the payload out and not
@ -417,7 +415,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
} else {
// Suspend while we wait for a receive
suspend(this)
pollForMessage() ?:
session.receivedMessages.poll() ?:
throw IllegalStateException("Was expecting a ${receiveType.simpleName} but instead got nothing for $this")
}
}