Adds overload anotations and reorganizes param orders to improve java interop.

This commit is contained in:
Joel Dudley 2016-12-15 18:27:41 +00:00 committed by GitHub
parent 7cb4cbcad4
commit 334ed4806b
3 changed files with 7 additions and 15 deletions

View File

@ -51,22 +51,18 @@ abstract class FlowLogic<out T> {
// Kotlin helpers that allow the use of generic types. // Kotlin helpers that allow the use of generic types.
inline fun <reified T : Any> sendAndReceive(otherParty: Party, payload: Any): UntrustworthyData<T> { inline fun <reified T : Any> sendAndReceive(otherParty: Party, payload: Any): UntrustworthyData<T> {
return sendAndReceive(otherParty, payload, T::class.java) return sendAndReceive(T::class.java, otherParty, payload)
} }
// TODO: Move the receiveType param to first position for readability
@Suspendable @Suspendable
fun <T : Any> sendAndReceive(otherParty: Party, payload: Any, receiveType: Class<T>): UntrustworthyData<T> { fun <T : Any> sendAndReceive(receiveType: Class<T>, otherParty: Party, payload: Any): UntrustworthyData<T> {
return fsm.sendAndReceive(otherParty, payload, receiveType, sessionFlow) return fsm.sendAndReceive(otherParty, payload, receiveType, sessionFlow)
} }
inline fun <reified T : Any> receive(otherParty: Party): UntrustworthyData<T> = receive(otherParty, T::class.java) inline fun <reified T : Any> receive(otherParty: Party): UntrustworthyData<T> = receive(T::class.java, otherParty)
// TODO: Move the receiveType param to first position for readability
@Suspendable @Suspendable
fun <T : Any> receive(otherParty: Party, receiveType: Class<T>): UntrustworthyData<T> { fun <T : Any> receive(receiveType: Class<T>, otherParty: Party): UntrustworthyData<T> {
return fsm.receive(otherParty, receiveType, sessionFlow) return fsm.receive(otherParty, receiveType, sessionFlow)
} }

View File

@ -141,15 +141,13 @@ sealed class PortAllocation {
* @param dsl The dsl itself. * @param dsl The dsl itself.
* @return The value returned in the [dsl] closure. * @return The value returned in the [dsl] closure.
*/ */
@JvmOverloads
// TODO: Add an @JvmOverloads annotation
fun <A> driver( fun <A> driver(
isDebug: Boolean = false,
driverDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()), driverDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()),
portAllocation: PortAllocation = PortAllocation.Incremental(10000), portAllocation: PortAllocation = PortAllocation.Incremental(10000),
debugPortAllocation: PortAllocation = PortAllocation.Incremental(5005), debugPortAllocation: PortAllocation = PortAllocation.Incremental(5005),
useTestClock: Boolean = false, useTestClock: Boolean = false,
isDebug: Boolean = false,
dsl: DriverDSLExposedInterface.() -> A dsl: DriverDSLExposedInterface.() -> A
) = genericDriver( ) = genericDriver(
driverDsl = DriverDSL( driverDsl = DriverDSL(

View File

@ -96,9 +96,7 @@ class CordaRPCClient(val host: HostAndPort, override val config: NodeSSLConfigur
* *
* @throws RPCException if the server version is too low or if the server isn't reachable within the given time. * @throws RPCException if the server version is too low or if the server isn't reachable within the given time.
*/ */
@JvmOverloads
// TODO: Add an @JvmOverloads annotation
@Throws(RPCException::class) @Throws(RPCException::class)
fun proxy(timeout: Duration? = null, minVersion: Int = 0): CordaRPCOps { fun proxy(timeout: Duration? = null, minVersion: Int = 0): CordaRPCOps {
return state.locked { return state.locked {