diff --git a/.gitignore b/.gitignore index f4bd2aaafb..e970a3e795 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -TODO - # Eclipse, ctags, Mac metadata, log files .classpath .project diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt b/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt index 139f7db55c..140eee6d8c 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt @@ -158,7 +158,7 @@ class CommercialPaper : Contract { * to redeem the paper. We must therefore send enough money to the key that owns the paper to satisfy the face * value, and then ensure the paper is removed from the ledger. * - * @throws InsufficientBalanceException if the wallet doesn't contain enough money to pay the redeemer + * @throws InsufficientBalanceException if the wallet doesn't contain enough money to pay the redeemer. */ @Throws(InsufficientBalanceException::class) fun generateRedeem(tx: TransactionBuilder, paper: StateAndRef, wallet: List>) { diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt b/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt index 2c4f3d584d..3ee0f7bdf9 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt @@ -98,7 +98,7 @@ abstract class RatePaymentEvent(date: LocalDate, } /** - * Basic class for the Fixed Rate Payments on the fixed leg - see [RatePaymentEvent] + * Basic class for the Fixed Rate Payments on the fixed leg - see [RatePaymentEvent]. * Assumes that the rate is valid. */ class FixedRatePaymentEvent(date: LocalDate, @@ -121,7 +121,7 @@ class FixedRatePaymentEvent(date: LocalDate, } /** - * Basic class for the Floating Rate Payments on the floating leg - see [RatePaymentEvent] + * Basic class for the Floating Rate Payments on the floating leg - see [RatePaymentEvent]. * If the rate is null returns a zero payment. // TODO: Is this the desired behaviour? */ class FloatingRatePaymentEvent(date: LocalDate, @@ -148,7 +148,7 @@ class FloatingRatePaymentEvent(date: LocalDate, override fun asCSV(): String = "$accrualStartDate,$accrualEndDate,$dayCountFactor,$days,$date,${notional.token},${notional},$fixingDate,$rate,$flow" /** - * Used for making immutables + * Used for making immutables. */ fun withNewRate(newRate: Rate): FloatingRatePaymentEvent = FloatingRatePaymentEvent(date, accrualStartDate, accrualEndDate, dayCountBasisDay, @@ -177,8 +177,8 @@ class FloatingRatePaymentEvent(date: LocalDate, /** - * The Interest Rate Swap class. For a quick overview of what an IRS is, see here - http://www.pimco.co.uk/EN/Education/Pages/InterestRateSwapsBasics1-08.aspx (no endorsement) - * This contract has 4 significant data classes within it, the "Common", "Calculation", "FixedLeg" and "FloatingLeg" + * The Interest Rate Swap class. For a quick overview of what an IRS is, see here - http://www.pimco.co.uk/EN/Education/Pages/InterestRateSwapsBasics1-08.aspx (no endorsement). + * This contract has 4 significant data classes within it, the "Common", "Calculation", "FixedLeg" and "FloatingLeg". * It also has 4 commands, "Agree", "Fix", "Pay" and "Mature". * Currently, we are not interested (excuse pun) in valuing the swap, calculating the PVs, DFs and all that good stuff (soon though). * This is just a representation of a vanilla Fixed vs Floating (same currency) IRS in the R3 prototype model. @@ -212,7 +212,7 @@ class InterestRateSwap() : Contract { /** * The Calculation data class is "mutable" through out the life of the swap, as in, it's the only thing that contains * data that will changed from state to state (Recall that the design insists that everything is immutable, so we actually - * copy / update for each transition) + * copy / update for each transition). */ data class Calculation( val expression: Expression, @@ -230,7 +230,7 @@ class InterestRateSwap() : Contract { } /** - * Returns the fixing for that date + * Returns the fixing for that date. */ fun getFixing(date: LocalDate): FloatingRatePaymentEvent = floatingLegPaymentSchedule.values.single { it.fixingDate == date } @@ -587,7 +587,7 @@ class InterestRateSwap() : Contract { } /** - * The state class contains the 4 major data classes + * The state class contains the 4 major data classes. */ data class State( val fixedLeg: FixedLeg, @@ -650,7 +650,7 @@ class InterestRateSwap() : Contract { } /** - * For evaluating arbitrary java on the platform + * For evaluating arbitrary java on the platform. */ fun evaluateCalculation(businessDate: LocalDate, expression: Expression = calculation.expression): Any { diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/IRSUtils.kt b/contracts/src/main/kotlin/com/r3corda/contracts/IRSUtils.kt index 7a44906783..93bb7c27cc 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/IRSUtils.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/IRSUtils.kt @@ -43,7 +43,7 @@ open class PercentageRatioUnit(percentageAsString: String) : RatioUnit(BigDecima val String.percent: PercentageRatioUnit get() = PercentageRatioUnit(this) /** - * Parent of the Rate family. Used to denote fixed rates, floating rates, reference rates etc + * Parent of the Rate family. Used to denote fixed rates, floating rates, reference rates etc. */ open class Rate(val ratioUnit: RatioUnit? = null) { override fun equals(other: Any?): Boolean { @@ -82,7 +82,7 @@ class FixedRate(ratioUnit: RatioUnit) : Rate(ratioUnit) { } /** - * The parent class of the Floating rate classes + * The parent class of the Floating rate classes. */ open class FloatingRate : Rate(null) diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/asset/Cash.kt b/contracts/src/main/kotlin/com/r3corda/contracts/asset/Cash.kt index 65f721bd62..8753a6b265 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/asset/Cash.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/asset/Cash.kt @@ -37,7 +37,7 @@ class Cash : FungibleAsset() { * Motivation: it's the difference between a state object referencing a programRef, which references a * legalContractReference and a state object which directly references both. The latter allows the legal wording * to evolve without requiring code changes. But creates a risk that users create objects governed by a program - * that is inconsistent with the legal contract + * that is inconsistent with the legal contract. */ override val legalContractReference: SecureHash = SecureHash.sha256("https://www.big-book-of-banking-law.gov/cash-claims.html") @@ -258,4 +258,4 @@ val DUMMY_CASH_ISSUER by lazy { Party("Snake Oil Issuer", DUMMY_CASH_ISSUER_KEY. /** An extension property that lets you write 100.DOLLARS.CASH */ val Amount.CASH: Cash.State get() = Cash.State(Amount(quantity, Issued(DUMMY_CASH_ISSUER, token)), NullPublicKey) /** An extension property that lets you get a cash state from an issued token, under the [NullPublicKey] */ -val Amount>.STATE: Cash.State get() = Cash.State(this, NullPublicKey) \ No newline at end of file +val Amount>.STATE: Cash.State get() = Cash.State(this, NullPublicKey) diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/asset/FungibleAsset.kt b/contracts/src/main/kotlin/com/r3corda/contracts/asset/FungibleAsset.kt index c935db7594..a50d35b14e 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/asset/FungibleAsset.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/asset/FungibleAsset.kt @@ -23,7 +23,7 @@ class InsufficientBalanceException(val amountMissing: Amount) : Except * See [Cash] for an example subclass that implements currency. * * @param T a type that represents the asset in question. This should describe the basic type of the asset - * (GBP, USD, oil, shares in company , etc.) and any additional metadata (issuer, grade, class, etc.) + * (GBP, USD, oil, shares in company , etc.) and any additional metadata (issuer, grade, class, etc.). */ abstract class FungibleAsset : Contract { /** A state representing a cash claim against some party */ @@ -139,4 +139,4 @@ fun Iterable.sumFungible() = filterIsInstance Iterable.sumFungibleOrNull() = filterIsInstance>().map { it.amount }.sumOrNull() /** Sums the asset states in the list, returning zero of the given token if there are none. */ -fun Iterable.sumFungibleOrZero(token: Issued) = filterIsInstance>().map { it.amount }.sumOrZero(token) \ No newline at end of file +fun Iterable.sumFungibleOrZero(token: Issued) = filterIsInstance>().map { it.amount }.sumOrZero(token) diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/asset/Obligation.kt b/contracts/src/main/kotlin/com/r3corda/contracts/asset/Obligation.kt index c440d7b333..da45a0bb2a 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/asset/Obligation.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/asset/Obligation.kt @@ -39,7 +39,7 @@ class Obligation

: Contract { * Motivation: it's the difference between a state object referencing a programRef, which references a * legalContractReference and a state object which directly references both. The latter allows the legal wording * to evolve without requiring code changes. But creates a risk that users create objects governed by a program - * that is inconsistent with the legal contract + * that is inconsistent with the legal contract. */ override val legalContractReference: SecureHash = SecureHash.sha256("https://www.big-book-of-banking-law.example.gov/cash-settlement.html") @@ -224,7 +224,7 @@ class Obligation

: Contract { /** * A command stating that the obligor is settling some or all of the amount owed by transferring a suitable * state object to the beneficiary. If this reduces the balance to zero, the state object is destroyed. - * @see [MoveCommand] + * @see [MoveCommand]. */ data class Settle

(override val aggregateState: IssuanceDefinition

, val amount: Amount

) : Commands, IssuanceCommands

diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/testing/WalletFiller.kt b/contracts/src/main/kotlin/com/r3corda/contracts/testing/WalletFiller.kt index 456b8dd391..eed49f7d4f 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/testing/WalletFiller.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/testing/WalletFiller.kt @@ -24,7 +24,7 @@ import java.util.* * * The service hub needs to provide at least a key management service and a storage service. * - * @return a wallet object that represents the generated states (it will NOT be the full wallet from the service hub!) + * @return a wallet object that represents the generated states (it will NOT be the full wallet from the service hub!). */ fun ServiceHub.fillWithSomeTestCash(howMuch: Amount, notary: Party = DUMMY_NOTARY, @@ -81,4 +81,4 @@ private fun calculateRandomlySizedAmounts(howMuch: Amount, min: Int, m } check(amounts.sum() == howMuch.quantity) return amounts -} \ No newline at end of file +} diff --git a/contracts/src/test/kotlin/com/r3corda/contracts/IRSTests.kt b/contracts/src/test/kotlin/com/r3corda/contracts/IRSTests.kt index 643d4f7581..0af693b5af 100644 --- a/contracts/src/test/kotlin/com/r3corda/contracts/IRSTests.kt +++ b/contracts/src/test/kotlin/com/r3corda/contracts/IRSTests.kt @@ -240,7 +240,7 @@ class IRSTests { } /** - * Utility so I don't have to keep typing this + * Utility so I don't have to keep typing this. */ fun singleIRS(irsSelector: Int = 1): InterestRateSwap.State { return generateIRSTxn(irsSelector).outputs.map { it.data }.filterIsInstance().single() @@ -256,7 +256,7 @@ class IRSTests { } /** - * Testing a simple IRS, add a few fixings and then display as CSV + * Testing a simple IRS, add a few fixings and then display as CSV. */ @Test fun `IRS Export test`() { @@ -280,7 +280,7 @@ class IRSTests { } /** - * Make sure it has a schedule and the schedule has some unfixed rates + * Make sure it has a schedule and the schedule has some unfixed rates. */ @Test fun `next fixing date`() { @@ -289,7 +289,7 @@ class IRSTests { } /** - * Iterate through all the fix dates and add something + * Iterate through all the fix dates and add something. */ @Test fun generateIRSandFixSome() { @@ -472,7 +472,7 @@ class IRSTests { } /** - * This will be modified once we adapt the IRS to be cross currency + * This will be modified once we adapt the IRS to be cross currency. */ @Test fun `ensure same currency notionals`() { diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/ContractsDSL.kt b/core/src/main/kotlin/com/r3corda/core/contracts/ContractsDSL.kt index 894fef8ff8..54196668ca 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/ContractsDSL.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/ContractsDSL.kt @@ -105,7 +105,7 @@ fun List>.getTimestampByName(vararg names: Stri /** * Simple functionality for verifying a move command. Verifies that each input has a signature from its owning key. * - * @param T the type of the move command + * @param T the type of the move command. */ @Throws(IllegalArgumentException::class) // TODO: Can we have a common Move command for all contracts and avoid the reified type parameter here? @@ -117,7 +117,7 @@ inline fun verifyMoveCommand(inputs: List verifyMoveCommand(inputs: List, diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/FinanceTypes.kt b/core/src/main/kotlin/com/r3corda/core/contracts/FinanceTypes.kt index 49c9a5a441..e00182c232 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/FinanceTypes.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/FinanceTypes.kt @@ -28,7 +28,7 @@ import java.util.* * TODO: It may make sense to replace this with convenience extensions over the JSR 354 MonetaryAmount interface, * in particular for use during calculations. This may also resolve... * TODO: Think about how positive-only vs positive-or-negative amounts can be represented in the type system. - * TODO: Add either a scaling factor, or a variant for use in calculations + * TODO: Add either a scaling factor, or a variant for use in calculations. * * @param T the type of the token, for example [Currency]. */ @@ -153,14 +153,14 @@ enum class AccrualAdjustment { /** * This is utilised in the [DateRollConvention] class to determine which way we should initially step when - * finding a business day + * finding a business day. */ enum class DateRollDirection(val value: Long) { FORWARD(1), BACKWARD(-1) } /** - * This reflects what happens if a date on which a business event is supposed to happen actually falls upon a non-working day - * Depending on the accounting requirement, we can move forward until we get to a business day, or backwards - * There are some additional rules which are explained in the individual cases below + * This reflects what happens if a date on which a business event is supposed to happen actually falls upon a non-working day. + * Depending on the accounting requirement, we can move forward until we get to a business day, or backwards. + * There are some additional rules which are explained in the individual cases below. */ enum class DateRollConvention { // direction() cannot be a val due to the throw in the Actual instance @@ -419,4 +419,4 @@ enum class NetType { * can be a multilateral netting transaction, and may be created by a central clearing service. */ PAYMENT -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt b/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt index 28b293512b..543e6c8b6e 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt @@ -111,7 +111,7 @@ data class TransactionState( /** * Copies the underlying state, replacing the notary field with the new value. - * To replace the notary, we need an approval (signature) from _all_ participants of the [ContractState] + * To replace the notary, we need an approval (signature) from _all_ participants of the [ContractState]. */ fun withNotary(newNotary: Party) = TransactionState(this.data, newNotary) } @@ -164,7 +164,7 @@ data class ScheduledStateRef(val ref: StateRef, override val scheduledAt: Instan /** * This class represents the lifecycle activity that a contract state of type [LinearState] would like to perform at a given point in time. - * e.g. run a fixing protocol + * e.g. run a fixing protocol. * * Note the use of [ProtocolLogicRef] to represent a safe way to transport a [ProtocolLogic] out of the contract sandbox. * @@ -176,9 +176,9 @@ data class ScheduledStateRef(val ref: StateRef, override val scheduledAt: Instan data class ScheduledActivity(val logicRef: ProtocolLogicRef, override val scheduledAt: Instant) : Scheduled /** - * A state that evolves by superseding itself, all of which share the common "thread" + * A state that evolves by superseding itself, all of which share the common "thread". * - * This simplifies the job of tracking the current version of certain types of state in e.g. a wallet + * This simplifies the job of tracking the current version of certain types of state in e.g. a wallet. */ interface LinearState : ContractState { /** Unique thread id within the wallets of all parties */ @@ -196,7 +196,7 @@ interface SchedulableState : ContractState { * * The state has no reference to it's own StateRef, so supply that for use as input to any ProtocolLogic constructed. * - * @return null if there is no activity to schedule + * @return null if there is no activity to schedule. */ fun nextScheduledActivity(thisStateRef: StateRef, protocolLogicRefFactory: ProtocolLogicRefFactory): ScheduledActivity? } @@ -217,18 +217,18 @@ interface DealState : LinearState { /** * Generate a partial transaction representing an agreement (command) to this deal, allowing a general - * deal/agreement protocol to generate the necessary transaction for potential implementations + * deal/agreement protocol to generate the necessary transaction for potential implementations. * * TODO: Currently this is the "inception" transaction but in future an offer of some description might be an input state ref * * TODO: This should more likely be a method on the Contract (on a common interface) and the changes to reference a - * Contract instance from a ContractState are imminent, at which point we can move this out of here + * Contract instance from a ContractState are imminent, at which point we can move this out of here. */ fun generateAgreement(notary: Party): TransactionBuilder } /** - * Interface adding fixing specific methods + * Interface adding fixing specific methods. */ interface FixableDealState : DealState { /** @@ -237,10 +237,10 @@ interface FixableDealState : DealState { fun nextFixingOf(): FixOf? /** - * Generate a fixing command for this deal and fix + * Generate a fixing command for this deal and fix. * * TODO: This would also likely move to methods on the Contract once the changes to reference - * the Contract from the ContractState are in + * the Contract from the ContractState are in. */ fun generateFix(ptx: TransactionBuilder, oldState: StateAndRef<*>, fix: Fix) } @@ -319,7 +319,7 @@ data class AuthenticatedObject( /** * If present in a transaction, contains a time that was verified by the timestamping authority/authorities whose - * public keys are identified in the containing [Command] object. The true time must be between (after, before) + * public keys are identified in the containing [Command] object. The true time must be between (after, before). */ // TODO: Timestamps are now always provided by the consensus service for the transaction, rather than potentially // having multiple timestamps on a transaction. As such, it likely makes more sense for time to be a field on the diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt index 9860144d3c..e032b2c6bb 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt @@ -32,7 +32,7 @@ open class TransactionBuilder( val time: TimestampCommand? get() = commands.mapNotNull { it.value as? TimestampCommand }.singleOrNull() /** - * Creates a copy of the builder + * Creates a copy of the builder. */ fun copy(): TransactionBuilder = TransactionBuilder( @@ -90,7 +90,7 @@ open class TransactionBuilder( * Checks that the given signature matches one of the commands and that it is a correct signature over the tx, then * adds it. * - * @throws SignatureException if the signature didn't match the transaction contents + * @throws SignatureException if the signature didn't match the transaction contents. * @throws IllegalArgumentException if the signature key doesn't appear in any command. */ fun checkAndAddSignature(sig: DigitalSignature.WithKey) { @@ -101,7 +101,7 @@ open class TransactionBuilder( /** * Checks that the given signature matches one of the commands and that it is a correct signature over the tx. * - * @throws SignatureException if the signature didn't match the transaction contents + * @throws SignatureException if the signature didn't match the transaction contents. * @throws IllegalArgumentException if the signature key doesn't appear in any command. */ fun checkSignature(sig: DigitalSignature.WithKey) { diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionGraphSearch.kt b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionGraphSearch.kt index de10cf3891..9ed20cef31 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionGraphSearch.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionGraphSearch.kt @@ -13,8 +13,8 @@ import java.util.concurrent.Callable * * In future, this should support restricting the search by time, and other types of useful query. * - * @param transactions map of transaction id to [SignedTransaction] - * @param startPoints transactions to use as starting points for the search + * @param transactions map of transaction id to [SignedTransaction]. + * @param startPoints transactions to use as starting points for the search. */ class TransactionGraphSearch(val transactions: ReadOnlyTransactionStorage, val startPoints: List) : Callable> { diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionTypes.kt b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionTypes.kt index d43e13cfd3..86304863bd 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionTypes.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionTypes.kt @@ -38,7 +38,7 @@ sealed class TransactionType { /** * Return the list of public keys that that require signatures for the transaction type. - * Note: the notary key is checked separately for all transactions and need not be included + * Note: the notary key is checked separately for all transactions and need not be included. */ abstract fun getRequiredSigners(tx: TransactionForVerification): Set @@ -52,7 +52,7 @@ sealed class TransactionType { /** * Check the transaction is contract-valid by running the verify() for each input and output state contract. - * If any contract fails to verify, the whole transaction is considered to be invalid + * If any contract fails to verify, the whole transaction is considered to be invalid. */ override fun verifyTransaction(tx: TransactionForVerification) { // TODO: Check that notary is unchanged @@ -92,7 +92,7 @@ sealed class TransactionType { /** * Check that the difference between inputs and outputs is only the notary field, - * and that all required signing public keys are present + * and that all required signing public keys are present. */ override fun verifyTransaction(tx: TransactionForVerification) { try { @@ -111,4 +111,4 @@ sealed class TransactionType { return participantKeys } } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionVerification.kt b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionVerification.kt index 7affb51685..3ae3f9ed59 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionVerification.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionVerification.kt @@ -69,7 +69,7 @@ data class TransactionForVerification(val inputs: List, operator fun plus(sigList: Collection) = withAdditionalSignatures(sigList) /** - * Returns the set of missing signatures - a signature must be present for each signer public key + * Returns the set of missing signatures - a signature must be present for each signer public key. */ fun getMissingSignatures(): Set { val requiredKeys = tx.signers.toSet() @@ -176,4 +176,4 @@ data class LedgerTransaction( ) : NamedByHash { @Suppress("UNCHECKED_CAST") fun outRef(index: Int) = StateAndRef(outputs[index] as TransactionState, StateRef(id, index)) -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/crypto/CryptoUtilities.kt b/core/src/main/kotlin/com/r3corda/core/crypto/CryptoUtilities.kt index 45b545153e..1bace21711 100644 --- a/core/src/main/kotlin/com/r3corda/core/crypto/CryptoUtilities.kt +++ b/core/src/main/kotlin/com/r3corda/core/crypto/CryptoUtilities.kt @@ -77,8 +77,8 @@ open class DigitalSignature(bits: ByteArray, val covering: Int = 0) : OpaqueByte * A serialized piece of data and its signature. Enforces signature validity in order to deserialize the data * contained within. * - * @param raw the raw serialized data - * @param sig the (unverified) signature for the data + * @param raw the raw serialized data. + * @param sig the (unverified) signature for the data. */ open class SignedData(val raw: SerializedBytes, val sig: DigitalSignature.WithKey) { /** diff --git a/core/src/main/kotlin/com/r3corda/core/math/Interpolators.kt b/core/src/main/kotlin/com/r3corda/core/math/Interpolators.kt index f5b0eb2859..86d029819c 100644 --- a/core/src/main/kotlin/com/r3corda/core/math/Interpolators.kt +++ b/core/src/main/kotlin/com/r3corda/core/math/Interpolators.kt @@ -11,7 +11,7 @@ interface InterpolatorFactory { } /** - * Interpolates values between the given data points using straight lines + * Interpolates values between the given data points using straight lines. */ class LinearInterpolator(private val xs: DoubleArray, private val ys: DoubleArray) : Interpolator { init { @@ -105,8 +105,8 @@ class CubicSplineInterpolator(private val xs: DoubleArray, private val ys: Doubl } /** - * Represents a polynomial function of arbitrary degree - * @param coefficients polynomial coefficients in the order of degree (constant first, followed by higher degree term coefficients) + * Represents a polynomial function of arbitrary degree. + * @param coefficients polynomial coefficients in the order of degree (constant first, followed by higher degree term coefficients). */ class Polynomial(private val coefficients: DoubleArray) { private val reversedCoefficients = coefficients.reversed() @@ -118,7 +118,7 @@ class Polynomial(private val coefficients: DoubleArray) { * A *spline* is function piecewise-defined by polynomial functions. * Points at which polynomial pieces connect are known as *knots*. * - * @param segmentMap a mapping between a knot and the polynomial that covers the subsequent interval + * @param segmentMap a mapping between a knot and the polynomial that covers the subsequent interval. */ class SplineFunction(private val segmentMap: TreeMap) { fun getValue(x: Double): Double { diff --git a/core/src/main/kotlin/com/r3corda/core/node/CordaPluginRegistry.kt b/core/src/main/kotlin/com/r3corda/core/node/CordaPluginRegistry.kt index 89492ee373..75ffdf8524 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/CordaPluginRegistry.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/CordaPluginRegistry.kt @@ -16,8 +16,8 @@ interface CordaPluginRegistry { * A Map with an entry for each consumed protocol used by the webAPIs. * The key of each map entry should contain the ProtocolLogic class name. * The associated map values are the union of all concrete class names passed to the protocol constructor. - * Standard java.lang.* and kotlin.* types do not need to be included explicitly - * This is used to extend the white listed protocols that can be initiated from the ServiceHub invokeProtocolAsync method + * Standard java.lang.* and kotlin.* types do not need to be included explicitly. + * This is used to extend the white listed protocols that can be initiated from the ServiceHub invokeProtocolAsync method. */ val requiredProtocols: Map> -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/node/ServiceHub.kt b/core/src/main/kotlin/com/r3corda/core/node/ServiceHub.kt index d1cf7fa0fd..0800dc8f87 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/ServiceHub.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/ServiceHub.kt @@ -42,7 +42,7 @@ interface ServiceHub { * Given a list of [SignedTransaction]s, writes them to the local storage for validated transactions and then * sends them to the wallet for further processing. * - * @param txs The transactions to record + * @param txs The transactions to record. */ fun recordTransactions(txs: Iterable) @@ -50,14 +50,14 @@ interface ServiceHub { * Given some [SignedTransaction]s, writes them to the local storage for validated transactions and then * sends them to the wallet for further processing. * - * @param txs The transactions to record + * @param txs The transactions to record. */ fun recordTransactions(vararg txs: SignedTransaction) = recordTransactions(txs.toList()) /** - * Given a [StateRef] loads the referenced transaction and looks up the specified output [ContractState] + * Given a [StateRef] loads the referenced transaction and looks up the specified output [ContractState]. * - * @throws TransactionResolutionException if the [StateRef] points to a non-existent transaction + * @throws TransactionResolutionException if the [StateRef] points to a non-existent transaction. */ fun loadState(stateRef: StateRef): TransactionState<*> { val definingTx = storageService.validatedTransactions.getTransaction(stateRef.txhash) ?: throw TransactionResolutionException(stateRef.txhash) @@ -67,7 +67,7 @@ interface ServiceHub { /** * Will check [logicType] and [args] against a whitelist and if acceptable then construct and initiate the protocol. * - * @throws IllegalProtocolLogicException or IllegalArgumentException if there are problems with the [logicType] or [args] + * @throws IllegalProtocolLogicException or IllegalArgumentException if there are problems with the [logicType] or [args]. */ fun invokeProtocolAsync(logicType: Class>, vararg args: Any?): ListenableFuture -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/node/services/AttachmentStorage.kt b/core/src/main/kotlin/com/r3corda/core/node/services/AttachmentStorage.kt index ae46e73b91..afc59f1f4d 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/services/AttachmentStorage.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/services/AttachmentStorage.kt @@ -22,7 +22,7 @@ interface AttachmentStorage { * to the raw byte stream is required. * * @throws FileAlreadyExistsException if the given byte stream has already been inserted. - * @throws IllegalArgumentException if the given byte stream is empty or a [JarInputStream] + * @throws IllegalArgumentException if the given byte stream is empty or a [JarInputStream]. * @throws IOException if something went wrong. */ fun importAttachment(jar: InputStream): SecureHash diff --git a/core/src/main/kotlin/com/r3corda/core/node/services/NetworkMapCache.kt b/core/src/main/kotlin/com/r3corda/core/node/services/NetworkMapCache.kt index 5ffa78ae11..4490da7716 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/services/NetworkMapCache.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/services/NetworkMapCache.kt @@ -65,9 +65,9 @@ interface NetworkMapCache { * Add a network map service; fetches a copy of the latest map from the service and subscribes to any further * updates. * - * @param net the network messaging service + * @param net the network messaging service. * @param service the network map service to fetch current state from. - * @param subscribe if the cache should subscribe to updates + * @param subscribe if the cache should subscribe to updates. * @param ifChangedSinceVer an optional version number to limit updating the map based on. If the latest map * version is less than or equal to the given version, no update is fetched. */ @@ -75,19 +75,19 @@ interface NetworkMapCache { subscribe: Boolean, ifChangedSinceVer: Int? = null): ListenableFuture /** - * Adds a node to the local cache (generally only used for adding ourselves) + * Adds a node to the local cache (generally only used for adding ourselves). */ fun addNode(node: NodeInfo) /** - * Removes a node from the local cache + * Removes a node from the local cache. */ fun removeNode(node: NodeInfo) /** * Deregister from updates from the given map service. * - * @param net the network messaging service + * @param net the network messaging service. * @param service the network map service to fetch current state from. */ fun deregisterForUpdates(net: MessagingService, service: NodeInfo): ListenableFuture @@ -96,4 +96,4 @@ interface NetworkMapCache { sealed class NetworkCacheError : Exception() { /** Indicates a failure to deregister, because of a rejected request from the remote node */ class DeregistrationFailed : NetworkCacheError() -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/node/services/Services.kt b/core/src/main/kotlin/com/r3corda/core/node/services/Services.kt index deff8a419a..5f0247b791 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/services/Services.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/services/Services.kt @@ -29,7 +29,7 @@ val TOPIC_DEFAULT_POSTFIX = ".0" * * [states] Holds the list of states that are *active* and *relevant*. * Active means they haven't been consumed yet (or we don't know about it). - * Relevant means they contain at least one of our pubkeys + * Relevant means they contain at least one of our pubkeys. */ class Wallet(val states: List>) { @Suppress("UNCHECKED_CAST") @@ -80,7 +80,7 @@ interface WalletService { val currentWallet: Wallet /** - * Returns a snapshot of the heads of LinearStates + * Returns a snapshot of the heads of LinearStates. */ val linearHeads: Map> @@ -206,4 +206,4 @@ interface SchedulerService { /** Unschedule all activity for a TX output, probably because it was consumed. */ fun unscheduleStateActivity(ref: StateRef) -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/node/services/TimestampChecker.kt b/core/src/main/kotlin/com/r3corda/core/node/services/TimestampChecker.kt index 1aeeb9a902..2c757d7dba 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/services/TimestampChecker.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/services/TimestampChecker.kt @@ -7,7 +7,7 @@ import java.time.Clock import java.time.Duration /** - * Checks if the given timestamp falls within the allowed tolerance interval + * Checks if the given timestamp falls within the allowed tolerance interval. */ class TimestampChecker(val clock: Clock = Clock.systemUTC(), val tolerance: Duration = 30.seconds) { @@ -23,4 +23,4 @@ class TimestampChecker(val clock: Clock = Clock.systemUTC(), if (after != null && now until after > tolerance) return false return true } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/node/services/UniquenessProvider.kt b/core/src/main/kotlin/com/r3corda/core/node/services/UniquenessProvider.kt index c54290e5ab..c55e745b58 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/services/UniquenessProvider.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/services/UniquenessProvider.kt @@ -6,7 +6,7 @@ import com.r3corda.core.crypto.SecureHash /** * A service that records input states of the given transaction and provides conflict information - * if any of the inputs have already been used in another transaction + * if any of the inputs have already been used in another transaction. */ interface UniquenessProvider { /** Commits all input states of the given transaction */ @@ -17,7 +17,7 @@ interface UniquenessProvider { /** * Specifies the transaction id, the position of the consumed state in the inputs, and - * the caller identity requesting the commit + * the caller identity requesting the commit. * * TODO: need to do more design work to prevent privacy problems: knowing the id of a * transaction, by the rules of our system the party can obtain it and see its contents. @@ -27,4 +27,4 @@ interface UniquenessProvider { data class ConsumingTx(val id: SecureHash, val inputIndex: Int, val requestingParty: Party) } -class UniquenessException(val error: UniquenessProvider.Conflict) : Exception() \ No newline at end of file +class UniquenessException(val error: UniquenessProvider.Conflict) : Exception() diff --git a/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt b/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt index 5b0154cb81..248627a3fb 100644 --- a/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt +++ b/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt @@ -15,7 +15,7 @@ import kotlin.reflect.jvm.javaType import kotlin.reflect.primaryConstructor /** - * A class for conversion to and from [ProtocolLogic] and [ProtocolLogicRef] instances + * A class for conversion to and from [ProtocolLogic] and [ProtocolLogicRef] instances. * * Validation of types is performed on the way in and way out in case this object is passed between JVMs which might have differing * whitelists. @@ -151,9 +151,9 @@ class ProtocolLogicRefFactory(private val protocolWhitelist: Map, msg: String) : IllegalArgumentException("${ProtocolLogicRef::class.java.simpleName} cannot be constructed for ${ProtocolLogic::class.java.simpleName} of type ${type.name} $msg") /** - * A class representing a [ProtocolLogic] instance which would be possible to safely pass out of the contract sandbox + * A class representing a [ProtocolLogic] instance which would be possible to safely pass out of the contract sandbox. * - * Only allows a String reference to the ProtocolLogic class, and only allows restricted argument types as per [ProtocolLogicRefFactory] + * Only allows a String reference to the ProtocolLogic class, and only allows restricted argument types as per [ProtocolLogicRefFactory]. */ // TODO: align this with the existing [ProtocolRef] in the bank-side API (probably replace some of the API classes) data class ProtocolLogicRef internal constructor(val protocolLogicClassName: String, val appContext: AppContext, val args: Map) @@ -166,4 +166,4 @@ data class AppContext(val attachments: List) { // TODO: build a real [AttachmentsClassLoader] etc val classLoader: ClassLoader get() = this.javaClass.classLoader -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolStateMachine.kt b/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolStateMachine.kt index 217df1752d..c48af0afae 100644 --- a/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolStateMachine.kt +++ b/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolStateMachine.kt @@ -8,7 +8,7 @@ import org.slf4j.Logger /** - * The interface of [ProtocolStateMachineImpl] exposing methods and properties required by ProtocolLogic for compilation + * The interface of [ProtocolStateMachineImpl] exposing methods and properties required by ProtocolLogic for compilation. */ interface ProtocolStateMachine { @Suspendable diff --git a/core/src/main/kotlin/com/r3corda/core/serialization/Kryo.kt b/core/src/main/kotlin/com/r3corda/core/serialization/Kryo.kt index 09371124b4..851f26ade1 100644 --- a/core/src/main/kotlin/com/r3corda/core/serialization/Kryo.kt +++ b/core/src/main/kotlin/com/r3corda/core/serialization/Kryo.kt @@ -113,7 +113,7 @@ object SerializedBytesSerializer : Serializer>() { /** * Can be called on any object to convert it to a byte array (wrapped by [SerializedBytes]), regardless of whether - * the type is marked as serializable or was designed for it (so be careful!) + * the type is marked as serializable or was designed for it (so be careful!). */ fun T.serialize(kryo: Kryo = THREAD_LOCAL_KRYO.get()): SerializedBytes { val stream = ByteArrayOutputStream() diff --git a/core/src/main/kotlin/com/r3corda/core/serialization/SerializationToken.kt b/core/src/main/kotlin/com/r3corda/core/serialization/SerializationToken.kt index 9aa1fa4d4d..23758e20db 100644 --- a/core/src/main/kotlin/com/r3corda/core/serialization/SerializationToken.kt +++ b/core/src/main/kotlin/com/r3corda/core/serialization/SerializationToken.kt @@ -27,7 +27,7 @@ interface SerializeAsToken { } /** - * This represents a token in the serialized stream for an instance of a type that implements [SerializeAsToken] + * This represents a token in the serialized stream for an instance of a type that implements [SerializeAsToken]. */ interface SerializationToken { fun fromToken(context: SerializeAsTokenContext): Any @@ -130,4 +130,4 @@ abstract class SingletonSerializeAsToken() : SerializeAsToken { private val token = SingletonSerializationToken(this) override fun toToken(context: SerializeAsTokenContext) = SingletonSerializationToken.registerWithContext(token, this, context) -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/core/testing/InMemoryWalletService.kt b/core/src/main/kotlin/com/r3corda/core/testing/InMemoryWalletService.kt index 45bf312a3d..edf4ab298b 100644 --- a/core/src/main/kotlin/com/r3corda/core/testing/InMemoryWalletService.kt +++ b/core/src/main/kotlin/com/r3corda/core/testing/InMemoryWalletService.kt @@ -43,7 +43,7 @@ open class InMemoryWalletService(private val services: ServiceHub) : SingletonSe get() = _updatesPublisher /** - * Returns a snapshot of the heads of LinearStates + * Returns a snapshot of the heads of LinearStates. */ override val linearHeads: Map> get() = currentWallet.let { wallet -> diff --git a/core/src/main/kotlin/com/r3corda/core/testing/LedgerDSLInterpreter.kt b/core/src/main/kotlin/com/r3corda/core/testing/LedgerDSLInterpreter.kt index f86d189324..3fc960871f 100644 --- a/core/src/main/kotlin/com/r3corda/core/testing/LedgerDSLInterpreter.kt +++ b/core/src/main/kotlin/com/r3corda/core/testing/LedgerDSLInterpreter.kt @@ -12,14 +12,14 @@ interface OutputStateLookup { /** * Retrieves an output previously defined by [TransactionDSLInterpreter._output] with a label passed in. * @param clazz The class object holding the type of the output state expected. - * @param label The label of the to-be-retrieved output state - * @return The output [StateAndRef] + * @param label The label of the to-be-retrieved output state. + * @return The output [StateAndRef]. */ fun retrieveOutputStateAndRef(clazz: Class, label: String): StateAndRef } /** - * This interface asserts that the DSL at hand is capable of verifying its underlying construct(ledger/transaction) + * This interface asserts that the DSL at hand is capable of verifying its underlying construct(ledger/transaction). */ interface Verifies { /** @@ -28,7 +28,7 @@ interface Verifies { fun verifies(): EnforceVerifyOrFail /** - * Asserts that verifies() throws + * Asserts that verifies() throws. * @param expectedMessage An optional string to be searched for in the raised exception. */ fun failsWith(expectedMessage: String?): EnforceVerifyOrFail { @@ -59,7 +59,7 @@ interface Verifies { } /** - * Asserts that [verifies] throws, with no condition on the exception message + * Asserts that [verifies] throws, with no condition on the exception message. */ fun fails() = failsWith(null) diff --git a/core/src/main/kotlin/com/r3corda/core/testing/TestDSL.kt b/core/src/main/kotlin/com/r3corda/core/testing/TestDSL.kt index 11fa7523f7..4e0fc5a048 100644 --- a/core/src/main/kotlin/com/r3corda/core/testing/TestDSL.kt +++ b/core/src/main/kotlin/com/r3corda/core/testing/TestDSL.kt @@ -68,7 +68,7 @@ fun LedgerDSLInterpreter.ledger( } /** - * If you jumped here from a compiler error make sure the last line of your test tests for a transaction verify or fail + * If you jumped here from a compiler error make sure the last line of your test tests for a transaction verify or fail. * This is a dummy type that can only be instantiated by functions in this module. This way we can ensure that all tests * will have as the last line either an accept or a failure test. The name is deliberately long to help make sense of * the triggered diagnostic. diff --git a/core/src/main/kotlin/com/r3corda/core/testing/TransactionDSLInterpreter.kt b/core/src/main/kotlin/com/r3corda/core/testing/TransactionDSLInterpreter.kt index f640604f1d..44d74fcf7b 100644 --- a/core/src/main/kotlin/com/r3corda/core/testing/TransactionDSLInterpreter.kt +++ b/core/src/main/kotlin/com/r3corda/core/testing/TransactionDSLInterpreter.kt @@ -35,7 +35,7 @@ interface TransactionDSLInterpreter : Verifies, OutputStateLookup { /** * Adds an [Attachment] reference to the transaction. - * @param attachmentId The hash of the attachment, possibly returned by [LedgerDSLInterpreter.attachment] + * @param attachmentId The hash of the attachment, possibly returned by [LedgerDSLInterpreter.attachment]. */ fun attachment(attachmentId: SecureHash) diff --git a/core/src/main/kotlin/com/r3corda/protocols/NotaryProtocol.kt b/core/src/main/kotlin/com/r3corda/protocols/NotaryProtocol.kt index 2157ca8dbf..4973767b29 100644 --- a/core/src/main/kotlin/com/r3corda/protocols/NotaryProtocol.kt +++ b/core/src/main/kotlin/com/r3corda/protocols/NotaryProtocol.kt @@ -27,10 +27,10 @@ object NotaryProtocol { /** * A protocol to be used for obtaining a signature from a [NotaryService] ascertaining the transaction - * timestamp is correct and none of its inputs have been used in another completed transaction + * timestamp is correct and none of its inputs have been used in another completed transaction. * * @throws NotaryException in case the any of the inputs to the transaction have been consumed - * by another transaction or the timestamp is invalid + * by another transaction or the timestamp is invalid. */ class Client(private val stx: SignedTransaction, override val progressTracker: ProgressTracker = Client.tracker()) : ProtocolLogic() { @@ -157,7 +157,7 @@ object NotaryProtocol { * history chain. * As a result, the Notary _will commit invalid transactions_ as well, but as it also records the identity of * the caller, it is possible to raise a dispute and verify the validity of the transaction and subsequently - * undo the commit of the input states (the exact mechanism still needs to be worked out) + * undo the commit of the input states (the exact mechanism still needs to be worked out). */ @Suspendable open fun beforeCommit(stx: SignedTransaction, reqIdentity: Party) { @@ -234,4 +234,4 @@ sealed class NotaryError { class TransactionInvalid : NotaryError() class SignaturesMissing(val missingSigners: List) : NotaryError() -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt b/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt index 3429807fed..b091ba8123 100644 --- a/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt +++ b/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt @@ -400,7 +400,7 @@ object TwoPartyDealProtocol { } /** - * One side of the fixing protocol for an interest rate swap, but could easily be generalised furher + * One side of the fixing protocol for an interest rate swap, but could easily be generalised furher. * * As per the [Fixer], do not infer too much from this class name in terms of business roles. This * is just the "side" of the protocol run by the party with the floating leg as a way of deciding who @@ -477,4 +477,4 @@ object TwoPartyDealProtocol { } } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/r3corda/protocols/ValidatingNotaryProtocol.kt b/core/src/main/kotlin/com/r3corda/protocols/ValidatingNotaryProtocol.kt index 0b45e7f15a..1845128786 100644 --- a/core/src/main/kotlin/com/r3corda/protocols/ValidatingNotaryProtocol.kt +++ b/core/src/main/kotlin/com/r3corda/protocols/ValidatingNotaryProtocol.kt @@ -14,7 +14,7 @@ import java.security.SignatureException * A notary commit protocol that makes sure a given transaction is valid before committing it. This does mean that the calling * party has to reveal the whole transaction history; however, we avoid complex conflict resolution logic where a party * has its input states "blocked" by a transaction from another party, and needs to establish whether that transaction was - * indeed valid + * indeed valid. */ class ValidatingNotaryProtocol(otherSide: Party, sessionIdForSend: Long, @@ -53,4 +53,4 @@ class ValidatingNotaryProtocol(otherSide: Party, private fun validateDependencies(reqIdentity: Party, wtx: WireTransaction) { subProtocol(ResolveTransactionsProtocol(wtx, reqIdentity)) } -} \ No newline at end of file +} diff --git a/core/src/test/kotlin/com/r3corda/core/crypto/Base58Test.kt b/core/src/test/kotlin/com/r3corda/core/crypto/Base58Test.kt index 2800bbb32d..be2b89c3c1 100644 --- a/core/src/test/kotlin/com/r3corda/core/crypto/Base58Test.kt +++ b/core/src/test/kotlin/com/r3corda/core/crypto/Base58Test.kt @@ -8,7 +8,7 @@ import kotlin.test.assertTrue import kotlin.test.fail /** - * Modified from the bitcoinj library + * Modified from the bitcoinj library. */ class Base58Test { @Test diff --git a/node/src/main/kotlin/com/r3corda/node/api/APIServer.kt b/node/src/main/kotlin/com/r3corda/node/api/APIServer.kt index 9883faab5f..451532e3c2 100644 --- a/node/src/main/kotlin/com/r3corda/node/api/APIServer.kt +++ b/node/src/main/kotlin/com/r3corda/node/api/APIServer.kt @@ -32,7 +32,7 @@ interface APIServer { fun serverTime(): LocalDateTime /** - * Report whether this node is started up or not + * Report whether this node is started up or not. */ @GET @Path("status") diff --git a/node/src/main/kotlin/com/r3corda/node/api/Query.kt b/node/src/main/kotlin/com/r3corda/node/api/Query.kt index 92962e18c9..b7ce582596 100644 --- a/node/src/main/kotlin/com/r3corda/node/api/Query.kt +++ b/node/src/main/kotlin/com/r3corda/node/api/Query.kt @@ -1,7 +1,7 @@ package com.r3corda.node.api /** - * Extremely rudimentary query language which should most likely be replaced with a product + * Extremely rudimentary query language which should most likely be replaced with a product. */ interface StatesQuery { companion object { diff --git a/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt index f21b8708be..cf494cc40d 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt @@ -71,7 +71,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, // TODO: Persist this, as well as whether the node is registered. /** - * Sequence number of changes sent to the network map service, when registering/de-registering this node + * Sequence number of changes sent to the network map service, when registering/de-registering this node. */ var networkMapSeq: Long = 1 @@ -202,7 +202,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, /** - * Run any tasks that are needed to ensure the node is in a correct state before running start() + * Run any tasks that are needed to ensure the node is in a correct state before running start(). */ open fun setup(): AbstractNode { createNodeDir() diff --git a/node/src/main/kotlin/com/r3corda/node/internal/Node.kt b/node/src/main/kotlin/com/r3corda/node/internal/Node.kt index 7646fa7aca..205ffc736e 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/Node.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/Node.kt @@ -42,15 +42,15 @@ class ConfigurationException(message: String) : Exception(message) * @param dir A [Path] to a location on disk where working files can be found or stored. * @param p2pAddr The host and port that this server will use. It can't find out its own external hostname, so you * have to specify that yourself. - * @param configuration This is typically loaded from a .properties file + * @param configuration This is typically loaded from a .properties file. * @param networkMapAddress An external network map service to use. Should only ever be null when creating the first * network map service, while bootstrapping a network. * @param advertisedServices The services this node advertises. This must be a subset of the services it runs, * but nodes are not required to advertise services they run (hence subset). * @param clientAPIs A list of JAX-RS annotated classes to register * which will be used to register any extra client web interfaces the node requires for demos to use. - * Listed clientAPI classes are assumed to have to take a single APIServer constructor parameter - * @param clock The clock used within the node and by all protocols etc + * Listed clientAPI classes are assumed to have to take a single APIServer constructor parameter. + * @param clock The clock used within the node and by all protocols etc. */ class Node(dir: Path, val p2pAddr: HostAndPort, val webServerAddr: HostAndPort, configuration: NodeConfiguration, networkMapAddress: NodeInfo?, advertisedServices: Set, diff --git a/node/src/main/kotlin/com/r3corda/node/internal/testing/TestClock.kt b/node/src/main/kotlin/com/r3corda/node/internal/testing/TestClock.kt index baa7085c21..fdfa24ca60 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/testing/TestClock.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/testing/TestClock.kt @@ -12,7 +12,7 @@ import javax.annotation.concurrent.ThreadSafe /** - * A [Clock] that can have the time advanced for use in testing + * A [Clock] that can have the time advanced for use in testing. */ @ThreadSafe class TestClock(private var delegateClock: Clock = Clock.systemUTC()) : MutableClock(), SerializeAsToken { diff --git a/node/src/main/kotlin/com/r3corda/node/services/api/AbstractNodeService.kt b/node/src/main/kotlin/com/r3corda/node/services/api/AbstractNodeService.kt index d688a8e834..dc354efbc0 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/api/AbstractNodeService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/api/AbstractNodeService.kt @@ -19,9 +19,9 @@ abstract class AbstractNodeService(val net: MessagingService, val networkMapCach /** * Register a handler for a message topic. In comparison to using net.addMessageHandler() this manages a lot of * common boilerplate code. Exceptions are caught and passed to the provided consumer. If you just want a simple - * acknowledgement response with no content, use [com.r3corda.core.messaging.Ack] + * acknowledgement response with no content, use [com.r3corda.core.messaging.Ack]. * - * @param topic the topic, without the default session ID postfix (".0) + * @param topic the topic, without the default session ID postfix (".0). * @param handler a function to handle the deserialised request and return an optional response (if return type not Unit) * @param exceptionConsumer a function to which any thrown exception is passed. */ @@ -47,10 +47,10 @@ abstract class AbstractNodeService(val net: MessagingService, val networkMapCach /** * Register a handler for a message topic. In comparison to using net.addMessageHandler() this manages a lot of * common boilerplate code. Exceptions are propagated to the messaging layer. If you just want a simple - * acknowledgement response with no content, use [com.r3corda.core.messaging.Ack] + * acknowledgement response with no content, use [com.r3corda.core.messaging.Ack]. * - * @param topic the topic, without the default session ID postfix (".0) - * @param handler a function to handle the deserialised request and return an optional response (if return type not Unit) + * @param topic the topic, without the default session ID postfix (".0). + * @param handler a function to handle the deserialised request and return an optional response (if return type not Unit). */ protected inline fun addMessageHandler(topic: String, diff --git a/node/src/main/kotlin/com/r3corda/node/services/api/ServiceHubInternal.kt b/node/src/main/kotlin/com/r3corda/node/services/api/ServiceHubInternal.kt index d60c20ab67..e55e853235 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/api/ServiceHubInternal.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/api/ServiceHubInternal.kt @@ -16,7 +16,7 @@ abstract class ServiceHubInternal : ServiceHub { * sends them to the wallet for further processing. This is intended for implementations to call from * [recordTransactions]. * - * @param txs The transactions to record + * @param txs The transactions to record. */ internal fun recordTransactionsInternal(writableStorageService: TxWritableStorageService, txs: Iterable) { txs.forEach { writableStorageService.validatedTransactions.addTransaction(it) } @@ -26,7 +26,7 @@ abstract class ServiceHubInternal : ServiceHub { /** * TODO: borrowing this method from service manager work in another branch. It's required to avoid circular dependency * between SMM and the scheduler. That particular problem should also be resolved by the service manager work - * itself, at which point this method would not be needed (by the scheduler) + * itself, at which point this method would not be needed (by the scheduler). */ abstract fun startProtocol(loggerName: String, logic: ProtocolLogic): ListenableFuture @@ -36,4 +36,4 @@ abstract class ServiceHubInternal : ServiceHub { val logic = protocolLogicRefFactory.toProtocolLogic(logicRef) as ProtocolLogic return startProtocol(logicType.simpleName, logic) } -} \ No newline at end of file +} diff --git a/node/src/main/kotlin/com/r3corda/node/services/clientapi/NodeInterestRates.kt b/node/src/main/kotlin/com/r3corda/node/services/clientapi/NodeInterestRates.kt index d69dd39e2a..7f1f489fad 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/clientapi/NodeInterestRates.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/clientapi/NodeInterestRates.kt @@ -97,7 +97,7 @@ object NodeInterestRates { } /** - * Register the protocol that is used with the Fixing integration tests + * Register the protocol that is used with the Fixing integration tests. */ class FixingServicePlugin : CordaPluginRegistry { override val webApis: List> = emptyList() @@ -252,7 +252,7 @@ object NodeInterestRates { /** * Returns the interest rate for a given [Tenor], - * or _null_ if the rate is not found and cannot be interpolated + * or _null_ if the rate is not found and cannot be interpolated. */ fun getRate(tenor: Tenor): BigDecimal? { return rates.getOrElse(tenor) { @@ -297,4 +297,4 @@ object NodeInterestRates { val name = words.dropLast(2).joinToString(" ") return FixOf(name, LocalDate.parse(date), Tenor(tenorString)) } -} \ No newline at end of file +} diff --git a/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt b/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt index b5abfacada..fa0d5a3c74 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt @@ -17,9 +17,9 @@ import javax.annotation.concurrent.ThreadSafe * on a separate/firewalled service. * - Use the protocol framework so requests to fetch keys can be suspended whilst a human signs off on the request. * - Use deterministic key derivation. - * - Possibly have some sort of TREZOR-like two-factor authentication ability + * - Possibly have some sort of TREZOR-like two-factor authentication ability. * - * etc + * etc. */ @ThreadSafe class E2ETestKeyManagementService(initialKeys: Set) : SingletonSerializeAsToken(), KeyManagementService { @@ -47,4 +47,4 @@ class E2ETestKeyManagementService(initialKeys: Set) : SingletonSerializ } return keypair } -} \ No newline at end of file +} diff --git a/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryMessagingNetwork.kt b/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryMessagingNetwork.kt index 65f22209f9..09b0e54b5e 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryMessagingNetwork.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryMessagingNetwork.kt @@ -85,9 +85,9 @@ class InMemoryMessagingNetwork(val sendManuallyPumped: Boolean) : SingletonSeria /** * Creates a node at the given address: useful if you want to recreate a node to simulate a restart. * - * @param manuallyPumped see [createNode] + * @param manuallyPumped see [createNode]. * @param id the numeric ID to use, e.g. set to whatever ID the node used last time. - * @param description text string that identifies this node for message logging (if is enabled) or null to autogenerate + * @param description text string that identifies this node for message logging (if is enabled) or null to autogenerate. */ fun createNodeWithID(manuallyPumped: Boolean, id: Int, description: String? = null): MessagingServiceBuilder { return Builder(manuallyPumped, Handle(id, description ?: "In memory node $id")) diff --git a/node/src/main/kotlin/com/r3corda/node/services/transactions/NotaryService.kt b/node/src/main/kotlin/com/r3corda/node/services/transactions/NotaryService.kt index 6287861bac..ad409fade3 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/transactions/NotaryService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/transactions/NotaryService.kt @@ -12,12 +12,12 @@ import com.r3corda.protocols.NotaryProtocol /** * A Notary service acts as the final signer of a transaction ensuring two things: - * - The (optional) timestamp of the transaction is valid + * - The (optional) timestamp of the transaction is valid. * - None of the referenced input states have previously been consumed by a transaction signed by this Notary * * A transaction has to be signed by a Notary to be considered valid (except for output-only transactions without a timestamp). * - * This is the base implementation that can be customised with specific Notary transaction commit protocol + * This is the base implementation that can be customised with specific Notary transaction commit protocol. */ abstract class NotaryService(val smm: StateMachineManager, net: MessagingService, diff --git a/node/src/main/kotlin/com/r3corda/node/servlets/Config.kt b/node/src/main/kotlin/com/r3corda/node/servlets/Config.kt index 3fb1a37bad..e209cb6ec6 100644 --- a/node/src/main/kotlin/com/r3corda/node/servlets/Config.kt +++ b/node/src/main/kotlin/com/r3corda/node/servlets/Config.kt @@ -8,10 +8,10 @@ import javax.ws.rs.ext.Provider /** * Primary purpose is to install Kotlin extensions for Jackson ObjectMapper so data classes work - * and to organise serializers / deserializers for java.time.* classes as necessary + * and to organise serializers / deserializers for java.time.* classes as necessary. */ @Provider class Config(val services: ServiceHub) : ContextResolver { val defaultObjectMapper = JsonSupport.createDefaultMapper(services.identityService) override fun getContext(type: Class<*>) = defaultObjectMapper -} \ No newline at end of file +} diff --git a/node/src/main/kotlin/com/r3corda/node/servlets/ResponseFilter.kt b/node/src/main/kotlin/com/r3corda/node/servlets/ResponseFilter.kt index 9dbb25413a..8605f02334 100644 --- a/node/src/main/kotlin/com/r3corda/node/servlets/ResponseFilter.kt +++ b/node/src/main/kotlin/com/r3corda/node/servlets/ResponseFilter.kt @@ -6,7 +6,7 @@ import javax.ws.rs.container.ContainerResponseFilter import javax.ws.rs.ext.Provider /** - * This adds headers needed for cross site scripting on API clients + * This adds headers needed for cross site scripting on API clients. */ @Provider class ResponseFilter : ContainerResponseFilter { @@ -18,7 +18,7 @@ class ResponseFilter : ContainerResponseFilter { * * We don't want this scriptable from any web page anywhere, but for demo reasons * we're making this really easy to access pending a proper security approach including - * access control and authentication at a network and software level + * access control and authentication at a network and software level. * */ headers.add("Access-Control-Allow-Origin", "*") diff --git a/node/src/main/kotlin/com/r3corda/node/utilities/ClockUtils.kt b/node/src/main/kotlin/com/r3corda/node/utilities/ClockUtils.kt index 1b0790b4a2..09a2d69846 100644 --- a/node/src/main/kotlin/com/r3corda/node/utilities/ClockUtils.kt +++ b/node/src/main/kotlin/com/r3corda/node/utilities/ClockUtils.kt @@ -77,7 +77,7 @@ abstract class MutableClock : Clock() { * of it being mutated. Just returns if [MutableClock] mutates, so needs to be * called in a loop. * - * @throws InterruptedException if interrupted by something other than a [MutableClock] + * @throws InterruptedException if interrupted by something other than a [MutableClock]. */ @Suppress("UNUSED_VALUE") // This is here due to the compiler thinking version is not used @Suspendable @@ -107,9 +107,9 @@ private fun Clock.doInterruptibly(runnable: SuspendableRunnable) { /** * Wait until the given [Future] is complete or the deadline is reached, with support for [MutableClock] implementations - * used in demos or testing. This will also substitute a Fiber compatible Future if required + * used in demos or testing. This will also substitute a Fiber compatible Future if required. * - * @return true if the [Future] is complete, false if the deadline was reached + * @return true if the [Future] is complete, false if the deadline was reached. */ @Suspendable fun Clock.awaitWithDeadline(deadline: Instant, future: Future<*> = SettableFuture()): Boolean { diff --git a/node/src/main/kotlin/com/r3corda/node/utilities/FiberBox.kt b/node/src/main/kotlin/com/r3corda/node/utilities/FiberBox.kt index eddd7e8f26..4b3097d1e6 100644 --- a/node/src/main/kotlin/com/r3corda/node/utilities/FiberBox.kt +++ b/node/src/main/kotlin/com/r3corda/node/utilities/FiberBox.kt @@ -12,7 +12,7 @@ import kotlin.concurrent.withLock /** - * Modelled on [ThreadBox], but with support for waiting that is compatible with Quasar [Fiber]s and [MutableClock]s + * Modelled on [ThreadBox], but with support for waiting that is compatible with Quasar [Fiber]s and [MutableClock]s. * * It supports 3 main operations, all of which operate in a similar context to the [locked] method * of [ThreadBox]. i.e. in the context of the content. @@ -74,4 +74,4 @@ class FiberBox(private val content: T, private val lock: Lock = ReentrantLock lock.unlock() } } -} \ No newline at end of file +} diff --git a/node/src/main/kotlin/com/r3corda/node/utilities/JsonSupport.kt b/node/src/main/kotlin/com/r3corda/node/utilities/JsonSupport.kt index 675429d5a5..8f80cf502d 100644 --- a/node/src/main/kotlin/com/r3corda/node/utilities/JsonSupport.kt +++ b/node/src/main/kotlin/com/r3corda/node/utilities/JsonSupport.kt @@ -109,7 +109,7 @@ object JsonSupport { } /** - * Implemented as a class so that we can instantiate for T + * Implemented as a class so that we can instantiate for T. */ class SecureHashDeserializer : JsonDeserializer() { override fun deserialize(parser: JsonParser, context: DeserializationContext): T { diff --git a/src/integration-test/kotlin/com/r3corda/core/testing/utilities/TestTimestamp.kt b/src/integration-test/kotlin/com/r3corda/core/testing/utilities/TestTimestamp.kt index b620d54524..9af2ba711d 100644 --- a/src/integration-test/kotlin/com/r3corda/core/testing/utilities/TestTimestamp.kt +++ b/src/integration-test/kotlin/com/r3corda/core/testing/utilities/TestTimestamp.kt @@ -5,7 +5,7 @@ import java.util.* /** * [timestamp] holds a formatted (UTC) timestamp that's set the first time it is queried. This is used to - * provide a uniform timestamp for tests + * provide a uniform timestamp for tests. */ class TestTimestamp { companion object { diff --git a/src/main/kotlin/com/r3corda/demos/DemoClock.kt b/src/main/kotlin/com/r3corda/demos/DemoClock.kt index d113d31056..04f8544530 100644 --- a/src/main/kotlin/com/r3corda/demos/DemoClock.kt +++ b/src/main/kotlin/com/r3corda/demos/DemoClock.kt @@ -8,7 +8,7 @@ import java.time.* import javax.annotation.concurrent.ThreadSafe /** - * A [Clock] that can have the date advanced for use in demos + * A [Clock] that can have the date advanced for use in demos. */ @ThreadSafe class DemoClock(private var delegateClock: Clock = Clock.systemUTC()) : MutableClock(), SerializeAsToken { @@ -41,4 +41,4 @@ class DemoClock(private var delegateClock: Clock = Clock.systemUTC()) : MutableC return delegateClock.zone } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt index 619287e7de..a7a5c50931 100644 --- a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt @@ -64,7 +64,7 @@ enum class IRSDemoRole { sealed class CliParams { /** - * Corresponds to roles 'SetupNodeA' and 'SetupNodeB' + * Corresponds to roles 'SetupNodeA' and 'SetupNodeB'. */ class SetupNode( val node: IRSDemoNode, @@ -73,7 +73,7 @@ sealed class CliParams { ) : CliParams() /** - * Corresponds to roles 'NodeA' and 'NodeB' + * Corresponds to roles 'NodeA' and 'NodeB'. */ class RunNode( val node: IRSDemoNode, @@ -90,7 +90,7 @@ sealed class CliParams { ) : CliParams() /** - * Corresponds to role 'Trade' + * Corresponds to role 'Trade'. */ class Trade( val apiAddress: HostAndPort, @@ -98,7 +98,7 @@ sealed class CliParams { ) : CliParams() /** - * Corresponds to role 'Date' + * Corresponds to role 'Date'. */ class DateChange( val apiAddress: HostAndPort, diff --git a/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt b/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt index de4f754fc1..50d96c23ce 100644 --- a/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt +++ b/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt @@ -18,7 +18,7 @@ import com.r3corda.protocols.TwoPartyDealProtocol * API call from a single party without bi-directional access to the database of offers etc. * * In the "real world", we'd probably have the offers sitting in the platform prior to the agreement step - * or the protocol would have to reach out to external systems (or users) to verify the deals + * or the protocol would have to reach out to external systems (or users) to verify the deals. */ object AutoOfferProtocol { val TOPIC = "autooffer.topic" diff --git a/src/main/kotlin/com/r3corda/demos/protocols/ExitServerProtocol.kt b/src/main/kotlin/com/r3corda/demos/protocols/ExitServerProtocol.kt index 5258e3dead..da1f54bb49 100644 --- a/src/main/kotlin/com/r3corda/demos/protocols/ExitServerProtocol.kt +++ b/src/main/kotlin/com/r3corda/demos/protocols/ExitServerProtocol.kt @@ -35,7 +35,7 @@ object ExitServerProtocol { /** * This takes a Java Integer rather than Kotlin Int as that is what we end up with in the calling map and currently - * we do not support coercing numeric types in the reflective search for matching constructors + * we do not support coercing numeric types in the reflective search for matching constructors. */ class Broadcast(val exitCode: Int) : ProtocolLogic() { diff --git a/src/main/kotlin/com/r3corda/demos/protocols/UpdateBusinessDayProtocol.kt b/src/main/kotlin/com/r3corda/demos/protocols/UpdateBusinessDayProtocol.kt index ce9884bce0..c4bd14e67e 100644 --- a/src/main/kotlin/com/r3corda/demos/protocols/UpdateBusinessDayProtocol.kt +++ b/src/main/kotlin/com/r3corda/demos/protocols/UpdateBusinessDayProtocol.kt @@ -11,7 +11,7 @@ import com.r3corda.node.services.network.MockNetworkMapCache import java.time.LocalDate /** - * This is a less temporary, demo-oriented way of initiating processing of temporal events + * This is a less temporary, demo-oriented way of initiating processing of temporal events. */ object UpdateBusinessDayProtocol {