Skip to content

Commit 334ed48

Browse files
author
Joel Dudley
authored
Adds overload anotations and reorganizes param orders to improve java interop.
1 parent 7cb4cbc commit 334ed48

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,18 @@ abstract class FlowLogic<out T> {
5151

5252
// Kotlin helpers that allow the use of generic types.
5353
inline fun <reified T : Any> sendAndReceive(otherParty: Party, payload: Any): UntrustworthyData<T> {
54-
return sendAndReceive(otherParty, payload, T::class.java)
54+
return sendAndReceive(T::class.java, otherParty, payload)
5555
}
5656

57-
// TODO: Move the receiveType param to first position for readability
58-
5957
@Suspendable
60-
fun <T : Any> sendAndReceive(otherParty: Party, payload: Any, receiveType: Class<T>): UntrustworthyData<T> {
58+
fun <T : Any> sendAndReceive(receiveType: Class<T>, otherParty: Party, payload: Any): UntrustworthyData<T> {
6159
return fsm.sendAndReceive(otherParty, payload, receiveType, sessionFlow)
6260
}
6361

64-
inline fun <reified T : Any> receive(otherParty: Party): UntrustworthyData<T> = receive(otherParty, T::class.java)
65-
66-
// TODO: Move the receiveType param to first position for readability
62+
inline fun <reified T : Any> receive(otherParty: Party): UntrustworthyData<T> = receive(T::class.java, otherParty)
6763

6864
@Suspendable
69-
fun <T : Any> receive(otherParty: Party, receiveType: Class<T>): UntrustworthyData<T> {
65+
fun <T : Any> receive(receiveType: Class<T>, otherParty: Party): UntrustworthyData<T> {
7066
return fsm.receive(otherParty, receiveType, sessionFlow)
7167
}
7268

node/src/main/kotlin/net/corda/node/driver/Driver.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,13 @@ sealed class PortAllocation {
141141
* @param dsl The dsl itself.
142142
* @return The value returned in the [dsl] closure.
143143
*/
144-
145-
// TODO: Add an @JvmOverloads annotation
146-
144+
@JvmOverloads
147145
fun <A> driver(
146+
isDebug: Boolean = false,
148147
driverDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()),
149148
portAllocation: PortAllocation = PortAllocation.Incremental(10000),
150149
debugPortAllocation: PortAllocation = PortAllocation.Incremental(5005),
151150
useTestClock: Boolean = false,
152-
isDebug: Boolean = false,
153151
dsl: DriverDSLExposedInterface.() -> A
154152
) = genericDriver(
155153
driverDsl = DriverDSL(

node/src/main/kotlin/net/corda/node/services/messaging/CordaRPCClient.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ class CordaRPCClient(val host: HostAndPort, override val config: NodeSSLConfigur
9696
*
9797
* @throws RPCException if the server version is too low or if the server isn't reachable within the given time.
9898
*/
99-
100-
// TODO: Add an @JvmOverloads annotation
101-
99+
@JvmOverloads
102100
@Throws(RPCException::class)
103101
fun proxy(timeout: Duration? = null, minVersion: Int = 0): CordaRPCOps {
104102
return state.locked {

0 commit comments

Comments
 (0)