mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
Minor: tighten variance when possible (via the Inspector)
This commit is contained in:
parent
0a2f313d40
commit
2be91ff516
@ -142,7 +142,7 @@ inline fun <T> logElapsedTime(label: String, logger: Logger? = null, body: () ->
|
||||
*
|
||||
* val ii = state.locked { i }
|
||||
*/
|
||||
class ThreadBox<T>(content: T, val lock: ReentrantLock = ReentrantLock()) {
|
||||
class ThreadBox<out T>(content: T, val lock: ReentrantLock = ReentrantLock()) {
|
||||
val content = content
|
||||
inline fun <R> locked(body: T.() -> R): R = lock.withLock { body(content) }
|
||||
inline fun <R> alreadyLocked(body: T.() -> R): R {
|
||||
@ -164,7 +164,7 @@ abstract class RetryableException(message: String) : Exception(message)
|
||||
* will not be serialized to disk, and if it's missing (or the first time it's accessed), the initializer will be
|
||||
* used to set it up. Note that the initializer will be called with the TransientProperty object locked.
|
||||
*/
|
||||
class TransientProperty<T>(private val initializer: () -> T) {
|
||||
class TransientProperty<out T>(private val initializer: () -> T) {
|
||||
@Transient private var v: T? = null
|
||||
|
||||
@Synchronized
|
||||
|
@ -132,7 +132,7 @@ interface IssuanceDefinition
|
||||
*
|
||||
* @param P the type of product underlying the definition, for example [Currency].
|
||||
*/
|
||||
data class Issued<P>(
|
||||
data class Issued<out P>(
|
||||
val issuer: PartyAndReference,
|
||||
val product: P
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ import com.r3corda.core.contracts.ContractState
|
||||
import com.r3corda.core.contracts.TransactionForContract
|
||||
import java.util.*
|
||||
|
||||
interface GroupVerify<S, T : Any> {
|
||||
interface GroupVerify<in S, in T : Any> {
|
||||
/**
|
||||
*
|
||||
* @return the set of commands that are consumed IF this clause is matched, and cannot be used to match a
|
||||
|
@ -24,7 +24,7 @@ import org.slf4j.Logger
|
||||
* If you'd like to use another ProtocolLogic class as a component of your own, construct it on the fly and then pass
|
||||
* it to the [subProtocol] method. It will return the result of that protocol when it completes.
|
||||
*/
|
||||
abstract class ProtocolLogic<T> {
|
||||
abstract class ProtocolLogic<out T> {
|
||||
|
||||
/** Reference to the [Fiber] instance that is the top level controller for the entire flow. */
|
||||
lateinit var psm: ProtocolStateMachine<*>
|
||||
|
@ -72,7 +72,7 @@ class NonEmptySet<T>(initial: T) : MutableSet<T> {
|
||||
override fun hashCode(): Int = set.hashCode()
|
||||
override fun toString(): String = set.toString()
|
||||
|
||||
inner class Iterator<T>(val iterator: MutableIterator<T>) : MutableIterator<T> {
|
||||
inner class Iterator<out T>(val iterator: MutableIterator<T>) : MutableIterator<T> {
|
||||
override fun hasNext(): Boolean = iterator.hasNext()
|
||||
override fun next(): T = iterator.next()
|
||||
override fun remove() =
|
||||
|
@ -16,8 +16,8 @@ class RecordingMap<K, V>(private val wrappedMap: MutableMap<K, V>,
|
||||
// If/when Kotlin supports data classes inside sealed classes, that would be preferable to this.
|
||||
interface Record
|
||||
|
||||
data class Get<K>(val key: K) : Record
|
||||
data class Put<K, V>(val key: K, val value: V) : Record
|
||||
data class Get<out K>(val key: K) : Record
|
||||
data class Put<out K, out V>(val key: K, val value: V) : Record
|
||||
|
||||
private val _records = Collections.synchronizedList(ArrayList<Record>())
|
||||
|
||||
|
@ -11,7 +11,7 @@ package com.r3corda.core.utilities
|
||||
* - Are any objects *reachable* from this object mismatched or not what you expected?
|
||||
* - Is it suspiciously large or small?
|
||||
*/
|
||||
class UntrustworthyData<T>(private val fromUntrustedWorld: T) {
|
||||
class UntrustworthyData<out T>(private val fromUntrustedWorld: T) {
|
||||
val data: T
|
||||
@Deprecated("Accessing the untrustworthy data directly without validating it first is a bad idea")
|
||||
get() = fromUntrustedWorld
|
||||
|
@ -27,7 +27,7 @@ import java.util.*
|
||||
* @param T The ultimate type of the data being fetched.
|
||||
* @param W The wire type of the data being fetched, for when it isn't the same as the ultimate type.
|
||||
*/
|
||||
abstract class FetchDataProtocol<T : NamedByHash, W : Any>(
|
||||
abstract class FetchDataProtocol<T : NamedByHash, in W : Any>(
|
||||
protected val requests: Set<SecureHash>,
|
||||
protected val otherSide: Party) : ProtocolLogic<FetchDataProtocol.Result<T>>() {
|
||||
|
||||
@ -36,7 +36,7 @@ abstract class FetchDataProtocol<T : NamedByHash, W : Any>(
|
||||
class DownloadedVsRequestedDataMismatch(val requested: SecureHash, val got: SecureHash) : BadAnswer()
|
||||
|
||||
data class Request(val hashes: List<SecureHash>, override val replyToParty: Party, override val sessionID: Long) : PartyRequestMessage
|
||||
data class Result<T : NamedByHash>(val fromDisk: List<T>, val downloaded: List<T>)
|
||||
data class Result<out T : NamedByHash>(val fromDisk: List<T>, val downloaded: List<T>)
|
||||
|
||||
@Suspendable
|
||||
override fun call(): Result<T> {
|
||||
|
@ -44,7 +44,7 @@ object TwoPartyDealProtocol {
|
||||
}
|
||||
|
||||
// This object is serialised to the network and is the first protocol message the seller sends to the buyer.
|
||||
data class Handshake<T>(
|
||||
data class Handshake<out T>(
|
||||
val payload: T,
|
||||
val publicKey: PublicKey,
|
||||
val sessionID: Long
|
||||
@ -58,7 +58,7 @@ object TwoPartyDealProtocol {
|
||||
* There's a good chance we can push at least some of this logic down into core protocol logic
|
||||
* and helper methods etc.
|
||||
*/
|
||||
abstract class Primary<U>(override val progressTracker: ProgressTracker = Primary.tracker()) : ProtocolLogic<SignedTransaction>() {
|
||||
abstract class Primary<out U>(override val progressTracker: ProgressTracker = Primary.tracker()) : ProtocolLogic<SignedTransaction>() {
|
||||
|
||||
companion object {
|
||||
object AWAITING_PROPOSAL : ProgressTracker.Step("Handshaking and awaiting transaction proposal")
|
||||
|
@ -28,7 +28,7 @@ import java.security.PublicKey
|
||||
* use the new updated state for future transactions.
|
||||
*/
|
||||
abstract class AbstractStateReplacementProtocol<T> {
|
||||
interface Proposal<T> {
|
||||
interface Proposal<out T> {
|
||||
val stateRef: StateRef
|
||||
val modification: T
|
||||
val stx: SignedTransaction
|
||||
|
Loading…
x
Reference in New Issue
Block a user