diff --git a/client/jackson/src/test/kotlin/net/corda/jackson/StringToMethodCallParserTest.kt b/client/jackson/src/test/kotlin/net/corda/jackson/StringToMethodCallParserTest.kt index 2944427ac6..7c46e4919b 100644 --- a/client/jackson/src/test/kotlin/net/corda/jackson/StringToMethodCallParserTest.kt +++ b/client/jackson/src/test/kotlin/net/corda/jackson/StringToMethodCallParserTest.kt @@ -10,7 +10,7 @@ class StringToMethodCallParserTest { fun simple() = "simple" fun string(note: String) = note fun twoStrings(a: String, b: String) = a + b - fun simpleObject(hash: SecureHash.SHA256) = hash.toString()!! + fun simpleObject(hash: SecureHash.SHA256) = hash.toString() fun complexObject(pair: Pair) = pair fun overload(a: String) = a diff --git a/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt b/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt index da8402d23f..46460ad55f 100644 --- a/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt +++ b/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt @@ -119,7 +119,7 @@ class CordaRPCClientImpl(private val session: ClientSession, private var producer: ClientProducer? = null - class ObservableDeserializer() : Serializer>() { + class ObservableDeserializer : Serializer>() { override fun read(kryo: Kryo, input: Input, type: Class>): Observable { val qName = kryo.context[RPCKryoQNameKey] as String val rpcName = kryo.context[RPCKryoMethodNameKey] as String diff --git a/core/src/main/kotlin/net/corda/core/contracts/Structures.kt b/core/src/main/kotlin/net/corda/core/contracts/Structures.kt index adec0b201f..3b3a50ad7f 100644 --- a/core/src/main/kotlin/net/corda/core/contracts/Structures.kt +++ b/core/src/main/kotlin/net/corda/core/contracts/Structures.kt @@ -244,7 +244,7 @@ interface LinearState : ContractState { * Standard clause to verify the LinearState safety properties. */ @CordaSerializable - class ClauseVerifier() : Clause() { + class ClauseVerifier : Clause() { override fun verify(tx: TransactionForContract, inputs: List, outputs: List, diff --git a/core/src/main/kotlin/net/corda/core/crypto/EncodingUtils.kt b/core/src/main/kotlin/net/corda/core/crypto/EncodingUtils.kt index b84ad53452..43388514ef 100644 --- a/core/src/main/kotlin/net/corda/core/crypto/EncodingUtils.kt +++ b/core/src/main/kotlin/net/corda/core/crypto/EncodingUtils.kt @@ -33,7 +33,7 @@ fun String.base58ToByteArray(): ByteArray = Base58.decode(this) fun String.base64ToByteArray(): ByteArray = Base64.getDecoder().decode(this) /** Hex-String to [ByteArray]. Accept any hex form (capitalized, lowercase, mixed). */ -fun String.hexToByteArray(): ByteArray = DatatypeConverter.parseHexBinary(this); +fun String.hexToByteArray(): ByteArray = DatatypeConverter.parseHexBinary(this) // Encoding changers diff --git a/core/src/main/kotlin/net/corda/core/schemas/requery/converters/VaultStateStatusConverter.kt b/core/src/main/kotlin/net/corda/core/schemas/requery/converters/VaultStateStatusConverter.kt index 8824eae43c..89e902aa32 100644 --- a/core/src/main/kotlin/net/corda/core/schemas/requery/converters/VaultStateStatusConverter.kt +++ b/core/src/main/kotlin/net/corda/core/schemas/requery/converters/VaultStateStatusConverter.kt @@ -6,4 +6,4 @@ import net.corda.core.node.services.Vault /** * Converter which persists a [Vault.StateStatus] enum using its enum ordinal representation */ -class VaultStateStatusConverter() : EnumOrdinalConverter(Vault.StateStatus::class.java) +class VaultStateStatusConverter : EnumOrdinalConverter(Vault.StateStatus::class.java) diff --git a/core/src/main/kotlin/net/corda/core/serialization/SerializationToken.kt b/core/src/main/kotlin/net/corda/core/serialization/SerializationToken.kt index 798db529d9..515651c4c3 100644 --- a/core/src/main/kotlin/net/corda/core/serialization/SerializationToken.kt +++ b/core/src/main/kotlin/net/corda/core/serialization/SerializationToken.kt @@ -127,7 +127,7 @@ data class SingletonSerializationToken private constructor(private val className * A base class for implementing large objects / components / services that need to serialize themselves to a string token * to indicate which instance the token is a serialized form of. */ -abstract class SingletonSerializeAsToken() : SerializeAsToken { +abstract class SingletonSerializeAsToken : SerializeAsToken { @Suppress("LeakingThis") private val token = SingletonSerializationToken(this) diff --git a/core/src/main/kotlin/net/corda/flows/ResolveTransactionsFlow.kt b/core/src/main/kotlin/net/corda/flows/ResolveTransactionsFlow.kt index 209cdec5b4..69245c7186 100644 --- a/core/src/main/kotlin/net/corda/flows/ResolveTransactionsFlow.kt +++ b/core/src/main/kotlin/net/corda/flows/ResolveTransactionsFlow.kt @@ -69,7 +69,7 @@ class ResolveTransactionsFlow(private val txHashes: Set, } @CordaSerializable - class ExcessivelyLargeTransactionGraph() : Exception() + class ExcessivelyLargeTransactionGraph : Exception() // Transactions to verify after the dependencies. private var stx: SignedTransaction? = null diff --git a/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt b/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt index 27be90fab2..8be0537665 100644 --- a/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt +++ b/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt @@ -37,7 +37,7 @@ class TransactionSerializationTests { } interface Commands : CommandData { - class Move() : TypeOnlyCommandData(), Commands + class Move : TypeOnlyCommandData(), Commands } } diff --git a/core/src/test/kotlin/net/corda/core/testing/Generators.kt b/core/src/test/kotlin/net/corda/core/testing/Generators.kt index 232bd89513..9fd14dedfc 100644 --- a/core/src/test/kotlin/net/corda/core/testing/Generators.kt +++ b/core/src/test/kotlin/net/corda/core/testing/Generators.kt @@ -96,7 +96,7 @@ class AmountGenerator(val tokenGenerator: Generator) : Generator(Currency::class.java) { +class CurrencyGenerator : Generator(Currency::class.java) { companion object { val currencies = Currency.getAvailableCurrencies().toList() } diff --git a/experimental/sandbox/src/main/java/net/corda/sandbox/CandidacyStatus.java b/experimental/sandbox/src/main/java/net/corda/sandbox/CandidacyStatus.java index 9684dc2f08..9247254a2d 100644 --- a/experimental/sandbox/src/main/java/net/corda/sandbox/CandidacyStatus.java +++ b/experimental/sandbox/src/main/java/net/corda/sandbox/CandidacyStatus.java @@ -214,8 +214,6 @@ public class CandidacyStatus { return false; if (!Objects.equals(this.reason, other.reason)) return false; - if (this.recursiveDepth != other.recursiveDepth) - return false; - return true; + return this.recursiveDepth == other.recursiveDepth; } } diff --git a/experimental/sandbox/src/main/java/net/corda/sandbox/Utils.java b/experimental/sandbox/src/main/java/net/corda/sandbox/Utils.java index c185ba2500..fae8d21b8e 100644 --- a/experimental/sandbox/src/main/java/net/corda/sandbox/Utils.java +++ b/experimental/sandbox/src/main/java/net/corda/sandbox/Utils.java @@ -178,11 +178,7 @@ public final class Utils { * @return */ public static boolean shouldAttemptToTransitivelyLoad(final String qualifiedClassName) { - if (JAVA_PATTERN_QUALIFIED.asPredicate().test(qualifiedClassName)) { - return false; - } - - return true; + return !JAVA_PATTERN_QUALIFIED.asPredicate().test(qualifiedClassName); } /** @@ -200,11 +196,7 @@ public final class Utils { return false; } - if (SANDBOX_PATTERN_INTERNAL.asPredicate().test(clazzName)) { - return false; - } - - return true; + return !SANDBOX_PATTERN_INTERNAL.asPredicate().test(clazzName); } diff --git a/experimental/sandbox/src/test/java/net/corda/sandbox/TestUtils.java b/experimental/sandbox/src/test/java/net/corda/sandbox/TestUtils.java index aa37ace2a2..d8e0fd0007 100644 --- a/experimental/sandbox/src/test/java/net/corda/sandbox/TestUtils.java +++ b/experimental/sandbox/src/test/java/net/corda/sandbox/TestUtils.java @@ -62,7 +62,7 @@ public class TestUtils { assertEquals(throwCost, RuntimeCostAccounter.getThrowCost()); } - public static Class transformClass(final String classFName, final int originalLength, final int newLength) throws IOException, Exception { + public static Class transformClass(final String classFName, final int originalLength, final int newLength) throws Exception { byte[] basic = getBytes(classFName); assertEquals(originalLength, basic.length); final byte[] tfmd = instrumentWithCosts(basic, new HashSet<>()); diff --git a/experimental/src/main/kotlin/net/corda/contracts/universal/Arrangement.kt b/experimental/src/main/kotlin/net/corda/contracts/universal/Arrangement.kt index ee155f05f7..3969736763 100644 --- a/experimental/src/main/kotlin/net/corda/contracts/universal/Arrangement.kt +++ b/experimental/src/main/kotlin/net/corda/contracts/universal/Arrangement.kt @@ -11,7 +11,7 @@ import java.util.* interface Arrangement // A base arrangement with no rights and no obligations. Contract cancellation/termination is a transition to ``Zero``. -class Zero() : Arrangement { +class Zero : Arrangement { override fun hashCode(): Int { return 0 } @@ -46,7 +46,7 @@ data class RollOut(val startDate: LocalDate, val endDate: LocalDate, val frequen // Continuation of roll out // May only be used inside template for RollOut -class Continuation() : Arrangement { +class Continuation : Arrangement { override fun hashCode(): Int { return 1 } diff --git a/experimental/src/main/kotlin/net/corda/contracts/universal/Literal.kt b/experimental/src/main/kotlin/net/corda/contracts/universal/Literal.kt index 7b8b0ccea7..81af567385 100644 --- a/experimental/src/main/kotlin/net/corda/contracts/universal/Literal.kt +++ b/experimental/src/main/kotlin/net/corda/contracts/universal/Literal.kt @@ -196,4 +196,4 @@ class RollOutBuilder(val startDate: LocalDate, val endDate: LocalDate, val fr RollOut(startDate, endDate, frequency, super.final()) } -class Dummy {} +class Dummy diff --git a/finance/src/main/kotlin/net/corda/contracts/CommercialPaper.kt b/finance/src/main/kotlin/net/corda/contracts/CommercialPaper.kt index 6b08dff730..fb3678dd46 100644 --- a/finance/src/main/kotlin/net/corda/contracts/CommercialPaper.kt +++ b/finance/src/main/kotlin/net/corda/contracts/CommercialPaper.kt @@ -152,7 +152,7 @@ class CommercialPaper : Contract { } } - class Redeem() : Clause>() { + class Redeem : Clause>() { override val requiredCommands: Set> = setOf(Commands.Redeem::class.java) override fun verify(tx: TransactionForContract, diff --git a/finance/src/test/kotlin/net/corda/contracts/CommercialPaperTests.kt b/finance/src/test/kotlin/net/corda/contracts/CommercialPaperTests.kt index 73b86a5943..5c283cb715 100644 --- a/finance/src/test/kotlin/net/corda/contracts/CommercialPaperTests.kt +++ b/finance/src/test/kotlin/net/corda/contracts/CommercialPaperTests.kt @@ -62,7 +62,7 @@ class KotlinCommercialPaperTest : ICommercialPaperTestTemplate { override fun getMoveCommand(): CommandData = CommercialPaper.Commands.Move() } -class KotlinCommercialPaperLegacyTest() : ICommercialPaperTestTemplate { +class KotlinCommercialPaperLegacyTest : ICommercialPaperTestTemplate { override fun getPaper(): ICommercialPaperState = CommercialPaperLegacy.State( issuance = MEGA_CORP.ref(123), owner = MEGA_CORP_PUBKEY, diff --git a/node-schemas/src/test/kotlin/net/corda/node/services/vault/schemas/VaultSchemaTest.kt b/node-schemas/src/test/kotlin/net/corda/node/services/vault/schemas/VaultSchemaTest.kt index b4edd4c94e..3503bad008 100644 --- a/node-schemas/src/test/kotlin/net/corda/node/services/vault/schemas/VaultSchemaTest.kt +++ b/node-schemas/src/test/kotlin/net/corda/node/services/vault/schemas/VaultSchemaTest.kt @@ -76,7 +76,7 @@ class VaultSchemaTest { data.close() } - private class VaultNoopContract() : Contract { + private class VaultNoopContract : Contract { override val legalContractReference = SecureHash.sha256("") data class VaultNoopState(override val owner: CompositeKey) : OwnableState { diff --git a/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt b/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt index daace87216..a150acd75b 100644 --- a/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt +++ b/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt @@ -202,12 +202,12 @@ abstract class MQSecurityTest : NodeBasedTest() { fun assertSendAttackFails(address: String) { val message = attacker.createMessage() - assertEquals(true, attacker.producer.isBlockOnNonDurableSend()) + assertEquals(true, attacker.producer.isBlockOnNonDurableSend) assertAttackFails(address, "SEND") { attacker.producer.send(address, message) } - assertEquals(0, message.getDeliveryCount()) - assertEquals(0, message.getBodySize()) + assertEquals(0, message.deliveryCount) + assertEquals(0, message.bodySize) } fun assertConsumeAttackFails(queue: String) { diff --git a/node/src/main/kotlin/net/corda/node/services/identity/InMemoryIdentityService.kt b/node/src/main/kotlin/net/corda/node/services/identity/InMemoryIdentityService.kt index 1711097ef3..9ade992c8f 100644 --- a/node/src/main/kotlin/net/corda/node/services/identity/InMemoryIdentityService.kt +++ b/node/src/main/kotlin/net/corda/node/services/identity/InMemoryIdentityService.kt @@ -16,7 +16,7 @@ import javax.annotation.concurrent.ThreadSafe * Simple identity service which caches parties and provides functionality for efficient lookup. */ @ThreadSafe -class InMemoryIdentityService() : SingletonSerializeAsToken(), IdentityService { +class InMemoryIdentityService : SingletonSerializeAsToken(), IdentityService { companion object { private val log = loggerFor() } diff --git a/node/src/main/kotlin/net/corda/node/services/messaging/NodeMessagingClient.kt b/node/src/main/kotlin/net/corda/node/services/messaging/NodeMessagingClient.kt index ba08978632..998c2074af 100644 --- a/node/src/main/kotlin/net/corda/node/services/messaging/NodeMessagingClient.kt +++ b/node/src/main/kotlin/net/corda/node/services/messaging/NodeMessagingClient.kt @@ -153,7 +153,7 @@ class NodeMessagingClient(override val config: NodeConfiguration, // TODO Add broker CN to config for host verification in case the embedded broker isn't used val tcpTransport = ArtemisTcpTransport.tcpTransport(ConnectionDirection.Outbound(), serverHostPort, config) val locator = ActiveMQClient.createServerLocatorWithoutHA(tcpTransport) - locator.setMinLargeMessageSize(ArtemisMessagingServer.MAX_FILE_SIZE) + locator.minLargeMessageSize = ArtemisMessagingServer.MAX_FILE_SIZE clientFactory = locator.createSessionFactory() // Login using the node username. The broker will authentiate us as its node (as opposed to another peer) diff --git a/node/src/main/kotlin/net/corda/node/services/messaging/RPCDispatcher.kt b/node/src/main/kotlin/net/corda/node/services/messaging/RPCDispatcher.kt index ed0eae56c0..7acd066da6 100644 --- a/node/src/main/kotlin/net/corda/node/services/messaging/RPCDispatcher.kt +++ b/node/src/main/kotlin/net/corda/node/services/messaging/RPCDispatcher.kt @@ -52,7 +52,7 @@ abstract class RPCDispatcher(val ops: RPCOps, val userService: RPCUserService, v // // When the observables are deserialised on the client side, the handle is read from the byte stream and // the queue is filtered to extract just those observations. - class ObservableSerializer() : Serializer>() { + class ObservableSerializer : Serializer>() { private fun toQName(kryo: Kryo): String = kryo.context[RPCKryoQNameKey] as String private fun toDispatcher(kryo: Kryo): RPCDispatcher = kryo.context[RPCKryoDispatcherKey] as RPCDispatcher diff --git a/node/src/main/kotlin/net/corda/node/services/transactions/InMemoryUniquenessProvider.kt b/node/src/main/kotlin/net/corda/node/services/transactions/InMemoryUniquenessProvider.kt index 58509e328d..566043f9fe 100644 --- a/node/src/main/kotlin/net/corda/node/services/transactions/InMemoryUniquenessProvider.kt +++ b/node/src/main/kotlin/net/corda/node/services/transactions/InMemoryUniquenessProvider.kt @@ -11,7 +11,7 @@ import javax.annotation.concurrent.ThreadSafe /** A dummy Uniqueness provider that stores the whole history of consumed states in memory */ @ThreadSafe -class InMemoryUniquenessProvider() : UniquenessProvider { +class InMemoryUniquenessProvider : UniquenessProvider { /** For each input state store the consuming transaction information */ private val committedStates = ThreadBox(HashMap()) diff --git a/node/src/main/kotlin/net/corda/node/services/transactions/PersistentUniquenessProvider.kt b/node/src/main/kotlin/net/corda/node/services/transactions/PersistentUniquenessProvider.kt index e9c533153c..1b17ae0e98 100644 --- a/node/src/main/kotlin/net/corda/node/services/transactions/PersistentUniquenessProvider.kt +++ b/node/src/main/kotlin/net/corda/node/services/transactions/PersistentUniquenessProvider.kt @@ -16,7 +16,7 @@ import javax.annotation.concurrent.ThreadSafe /** A RDBMS backed Uniqueness provider */ @ThreadSafe -class PersistentUniquenessProvider() : UniquenessProvider, SingletonSerializeAsToken() { +class PersistentUniquenessProvider : UniquenessProvider, SingletonSerializeAsToken() { companion object { private val TABLE_NAME = "${NODE_DATABASE_PREFIX}notary_commit_log" private val log = loggerFor() @@ -66,7 +66,7 @@ class PersistentUniquenessProvider() : UniquenessProvider, SingletonSerializeAsT if (consumingTx != null) conflictingStates[inputState] = consumingTx } if (conflictingStates.isNotEmpty()) { - log.debug("Failure, input states already committed: ${conflictingStates.keys.toString()}") + log.debug("Failure, input states already committed: ${conflictingStates.keys}") UniquenessProvider.Conflict(conflictingStates) } else { states.forEachIndexed { i, stateRef -> diff --git a/node/src/main/kotlin/net/corda/node/utilities/registration/HTTPNetworkRegistrationService.kt b/node/src/main/kotlin/net/corda/node/utilities/registration/HTTPNetworkRegistrationService.kt index 8c7aa991b4..7d5ccae2b5 100644 --- a/node/src/main/kotlin/net/corda/node/utilities/registration/HTTPNetworkRegistrationService.kt +++ b/node/src/main/kotlin/net/corda/node/utilities/registration/HTTPNetworkRegistrationService.kt @@ -61,7 +61,7 @@ class HTTPNetworkRegistrationService(val server: URL) : NetworkRegistrationServi throw IOException("Unexpected response code ${connection.responseCode} - ${connection.errorMessage}") } - private val HttpURLConnection.charset: String get() = MediaType.parse(getContentType()).charset().or(Charsets.UTF_8).name() + private val HttpURLConnection.charset: String get() = MediaType.parse(contentType).charset().or(Charsets.UTF_8).name() private val HttpURLConnection.errorMessage: String get() = IOUtils.toString(errorStream, charset) } diff --git a/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt b/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt index 796a3b4138..59f7d61414 100644 --- a/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt +++ b/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt @@ -165,7 +165,7 @@ class TwoPartyTradeFlowTests { val bobTransactionsBeforeCrash = databaseTransaction(bobNode.database) { (storage as DBTransactionStorage).transactions } - assertThat(bobTransactionsBeforeCrash).isNotEmpty() + assertThat(bobTransactionsBeforeCrash).isNotEmpty // .. and let's imagine that Bob's computer has a power cut. He now has nothing now beyond what was on disk. bobNode.stop() diff --git a/node/src/test/kotlin/net/corda/node/services/NodeAttachmentStorageTest.kt b/node/src/test/kotlin/net/corda/node/services/NodeAttachmentStorageTest.kt index 403d8d12fe..097ed449f7 100644 --- a/node/src/test/kotlin/net/corda/node/services/NodeAttachmentStorageTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/NodeAttachmentStorageTest.kt @@ -106,7 +106,7 @@ class NodeAttachmentStorageTest { val id = testJar.read { storage.importAttachment(it) } // Corrupt the file in the store. - val bytes = testJar.readAll(); + val bytes = testJar.readAll() val corruptBytes = "arggghhhh".toByteArray() System.arraycopy(corruptBytes, 0, bytes, 0, corruptBytes.size) val corruptAttachment = AttachmentEntity() diff --git a/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt b/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt index 849e8cc83b..ac95c4c897 100644 --- a/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt +++ b/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt @@ -139,7 +139,7 @@ object FixingFlow { constructor(ref: StateRef) : this(ref, tracker()) companion object { - class LOADING() : ProgressTracker.Step("Loading state to decide fixing role") + class LOADING : ProgressTracker.Step("Loading state to decide fixing role") fun tracker() = ProgressTracker(LOADING()) } diff --git a/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/IRSTests.kt b/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/IRSTests.kt index 6b9bf6e151..5b5dd375a1 100644 --- a/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/IRSTests.kt +++ b/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/IRSTests.kt @@ -402,7 +402,7 @@ class IRSTests { fun `ensure failure occurs when there are inbound states for an agreement command`() { val irs = singleIRS() transaction { - input() { irs } + input { irs } output("irs post agreement") { irs } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } timestamp(TEST_TX_TIME) @@ -415,7 +415,7 @@ class IRSTests { val irs = singleIRS() val emptySchedule = mutableMapOf() transaction { - output() { + output { irs.copy(calculation = irs.calculation.copy(fixedLegPaymentSchedule = emptySchedule)) } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -429,7 +429,7 @@ class IRSTests { val irs = singleIRS() val emptySchedule = mutableMapOf() transaction { - output() { + output { irs.copy(calculation = irs.calculation.copy(floatingLegPaymentSchedule = emptySchedule)) } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -442,7 +442,7 @@ class IRSTests { fun `ensure notionals are non zero`() { val irs = singleIRS() transaction { - output() { + output { irs.copy(irs.fixedLeg.copy(notional = irs.fixedLeg.notional.copy(quantity = 0))) } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -451,7 +451,7 @@ class IRSTests { } transaction { - output() { + output { irs.copy(irs.fixedLeg.copy(notional = irs.floatingLeg.notional.copy(quantity = 0))) } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -465,7 +465,7 @@ class IRSTests { val irs = singleIRS() val modifiedIRS = irs.copy(fixedLeg = irs.fixedLeg.copy(fixedRate = FixedRate(PercentageRatioUnit("-0.1")))) transaction { - output() { + output { modifiedIRS } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -482,7 +482,7 @@ class IRSTests { val irs = singleIRS() val modifiedIRS = irs.copy(fixedLeg = irs.fixedLeg.copy(notional = Amount(irs.fixedLeg.notional.quantity, Currency.getInstance("JPY")))) transaction { - output() { + output { modifiedIRS } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -496,7 +496,7 @@ class IRSTests { val irs = singleIRS() val modifiedIRS = irs.copy(fixedLeg = irs.fixedLeg.copy(notional = Amount(irs.floatingLeg.notional.quantity + 1, irs.floatingLeg.notional.token))) transaction { - output() { + output { modifiedIRS } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -510,7 +510,7 @@ class IRSTests { val irs = singleIRS() val modifiedIRS1 = irs.copy(fixedLeg = irs.fixedLeg.copy(terminationDate = irs.fixedLeg.effectiveDate.minusDays(1))) transaction { - output() { + output { modifiedIRS1 } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -520,7 +520,7 @@ class IRSTests { val modifiedIRS2 = irs.copy(floatingLeg = irs.floatingLeg.copy(terminationDate = irs.floatingLeg.effectiveDate.minusDays(1))) transaction { - output() { + output { modifiedIRS2 } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -535,7 +535,7 @@ class IRSTests { val modifiedIRS3 = irs.copy(floatingLeg = irs.floatingLeg.copy(terminationDate = irs.fixedLeg.terminationDate.minusDays(1))) transaction { - output() { + output { modifiedIRS3 } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -546,7 +546,7 @@ class IRSTests { val modifiedIRS4 = irs.copy(floatingLeg = irs.floatingLeg.copy(effectiveDate = irs.fixedLeg.effectiveDate.minusDays(1))) transaction { - output() { + output { modifiedIRS4 } command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() } @@ -575,7 +575,7 @@ class IRSTests { oldIRS.common) transaction { - input() { + input { oldIRS } @@ -586,7 +586,7 @@ class IRSTests { InterestRateSwap.Commands.Refix(Fix(FixOf("ICE LIBOR", ld, Tenor("3M")), bd)) } timestamp(TEST_TX_TIME) - output() { newIRS } + output { newIRS } this.verifies() } @@ -594,7 +594,7 @@ class IRSTests { tweak { command(ORACLE_PUBKEY) { InterestRateSwap.Commands.Refix(Fix(FixOf("ICE LIBOR", ld, Tenor("3M")), bd)) } timestamp(TEST_TX_TIME) - output() { oldIRS } + output { oldIRS } this `fails with` "There is at least one difference in the IRS floating leg payment schedules" } @@ -607,7 +607,7 @@ class IRSTests { val firstResetValue = newIRS.calculation.floatingLegPaymentSchedule[firstResetKey] val modifiedFirstResetValue = firstResetValue!!.copy(notional = Amount(firstResetValue.notional.quantity, Currency.getInstance("JPY"))) - output() { + output { newIRS.copy( newIRS.fixedLeg, newIRS.floatingLeg, @@ -627,7 +627,7 @@ class IRSTests { val latestReset = newIRS.calculation.floatingLegPaymentSchedule.filter { it.value.rate is FixedRate }.maxBy { it.key } val modifiedLatestResetValue = latestReset!!.value.copy(notional = Amount(latestReset.value.notional.quantity, Currency.getInstance("JPY"))) - output() { + output { newIRS.copy( newIRS.fixedLeg, newIRS.floatingLeg, diff --git a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/NetworkMapVisualiser.kt b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/NetworkMapVisualiser.kt index 17cf419142..914ecc1cd9 100644 --- a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/NetworkMapVisualiser.kt +++ b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/NetworkMapVisualiser.kt @@ -52,7 +52,7 @@ class NetworkMapVisualiser : Application() { sealed class RunningPausedState { class Running(val tickTimer: TimerTask) : RunningPausedState() - class Paused() : RunningPausedState() + class Paused : RunningPausedState() val buttonLabel: RunPauseButtonLabel get() { diff --git a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserView.kt b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserView.kt index e5b874d112..e6ba2d4ac2 100644 --- a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserView.kt +++ b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserView.kt @@ -25,7 +25,7 @@ import net.corda.netmap.VisualiserViewModel.Style data class TrackerWidget(val vbox: VBox, val cursorBox: Pane, val label: Label, val cursor: Polygon) -internal class VisualiserView() { +internal class VisualiserView { lateinit var root: Pane lateinit var stage: Stage lateinit var splitter: SplitPane @@ -70,7 +70,7 @@ internal class VisualiserView() { //repositionNodes() } } - scaleMap(displayStyle); + scaleMap(displayStyle) root = Pane(mapImage) root.background = Background(BackgroundFill(backgroundColor, CornerRadii.EMPTY, Insets.EMPTY)) scrollPane = buildScrollPane(backgroundColor, displayStyle) diff --git a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserViewModel.kt b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserViewModel.kt index 85e1c967ae..2df50a60ee 100644 --- a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserViewModel.kt +++ b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/VisualiserViewModel.kt @@ -105,8 +105,8 @@ class VisualiserViewModel { val yOffset = -80 val circleX = view.stageWidth / 2 + xOffset val circleY = view.stageHeight / 2 + yOffset - val x: Double = radius * Math.cos(tangentRad) + circleX; - val y: Double = radius * Math.sin(tangentRad) + circleY; + val x: Double = radius * Math.cos(tangentRad) + circleX + val y: Double = radius * Math.sin(tangentRad) + circleY return Pair(x, y) } diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/AnalyticsEngine.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/AnalyticsEngine.kt index 81622f022e..a0bea3ea32 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/AnalyticsEngine.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/AnalyticsEngine.kt @@ -80,7 +80,7 @@ class OGSIMMAnalyticsEngine : AnalyticsEngine() { var totalSensitivities = CurrencyParameterSensitivities.empty() var totalCurrencyExposure = MultiCurrencyAmount.empty() for (resolvedTrade in trades) { - val swap = resolvedTrade.getProduct() + val swap = resolvedTrade.product val pointSensitivities = pricer.presentValueSensitivity(swap, combinedRatesProvider).build() val sensitivities = combinedRatesProvider.parameterSensitivity(pointSensitivities) diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt index bd5a9c1a69..0647e8da8d 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt @@ -11,20 +11,20 @@ import com.opengamma.strata.pricer.rate.ImmutableRatesProvider */ @Suppress("UNUSED_PARAMETER") -class PortfolioNormalizer(eur: Currency?, combinedRatesProvider: ImmutableRatesProvider?) {} +class PortfolioNormalizer(eur: Currency?, combinedRatesProvider: ImmutableRatesProvider?) /** * Stub class for the real BIMM implementation */ @Suppress("UNUSED_PARAMETER") -class RwamBimmNotProductClassesCalculator(fxRateProvider: MarketDataFxRateProvider?, eur: Currency?, instance: Any) {} +class RwamBimmNotProductClassesCalculator(fxRateProvider: MarketDataFxRateProvider?, eur: Currency?, instance: Any) /** * Stub class for the real BIMM implementation */ @Suppress("UNUSED_PARAMETER") class IsdaConfiguration { - object INSTANCE {} + object INSTANCE } /** diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/api/SwapDataView.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/api/SwapDataView.kt index 3af0ea999b..9a694293ee 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/api/SwapDataView.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/api/SwapDataView.kt @@ -24,8 +24,7 @@ data class SwapDataView( var IM: Double? = null, var MTM: Double? = null, var margined: Boolean = false, - var marginedText: String = "❌️") { -} + var marginedText: String = "❌️") fun SwapData.toView(viewingParty: Party, portfolio: Portfolio? = null, presentValue: MultiCurrencyAmount? = null, diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/OGTrade.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/OGTrade.kt index e0f8928a3b..4d036a92a0 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/OGTrade.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/OGTrade.kt @@ -31,7 +31,7 @@ data class OGTrade(override val legalContractReference: SecureHash = SecureHash. class Group : GroupClauseVerifier(AnyOf(Agree())) { override fun groupStates(tx: TransactionForContract): List> // Group by Trade ID for in / out states - = tx.groupStates() { state -> state.linearId } + = tx.groupStates { state -> state.linearId } } class Agree : Clause() { diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/PortfolioSwap.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/PortfolioSwap.kt index 0fe3028e3f..39da0398a2 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/PortfolioSwap.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/contracts/PortfolioSwap.kt @@ -33,7 +33,7 @@ data class PortfolioSwap(override val legalContractReference: SecureHash = Secur class Group : GroupClauseVerifier(FirstOf(Agree(), Update())) { override fun groupStates(tx: TransactionForContract): List> // Group by Trade ID for in / out states - = tx.groupStates() { state -> state.linearId } + = tx.groupStates { state -> state.linearId } } class Update : Clause() { diff --git a/test-utils/src/main/kotlin/net/corda/testing/NodeApi.kt b/test-utils/src/main/kotlin/net/corda/testing/NodeApi.kt index e5b0595e61..c812beec84 100644 --- a/test-utils/src/main/kotlin/net/corda/testing/NodeApi.kt +++ b/test-utils/src/main/kotlin/net/corda/testing/NodeApi.kt @@ -29,7 +29,7 @@ class NodeApi { } private fun waitForNodeStartup(nodeWebserverAddr: HostAndPort) { - val url = URL("http://${nodeWebserverAddr.toString()}/api/status") + val url = URL("http://$nodeWebserverAddr/api/status") var retries = 0 var respCode: Int do { @@ -45,10 +45,10 @@ class NodeApi { "Node hasn't started" } catch(e: SocketException) { respCode = -1 - "Could not connect: ${e.toString()}" + "Could not connect: $e" } catch (e: IOException) { respCode = -1 - "IOException: ${e.toString()}" + "IOException: $e" } if (retries > NODE_WAIT_RETRY_COUNT) { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt index 1336072344..8d870315b4 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt @@ -3,7 +3,7 @@ package net.corda.demobench.ui import javafx.scene.control.Label import javafx.scene.layout.HBox -class PropertyLabel() : HBox() { +class PropertyLabel : HBox() { val nameLabel = Label() val valueLabel = Label() diff --git a/tools/demobench/src/main/kotlin/org/h2/server/web/LocalWebServer.kt b/tools/demobench/src/main/kotlin/org/h2/server/web/LocalWebServer.kt index 312291a4d1..a1cda62688 100644 --- a/tools/demobench/src/main/kotlin/org/h2/server/web/LocalWebServer.kt +++ b/tools/demobench/src/main/kotlin/org/h2/server/web/LocalWebServer.kt @@ -12,7 +12,7 @@ class LocalWebServer : WebServer() { @Throws(SQLException::class) override fun addSession(conn: Connection): String { val session = createNewSession("local") - session.setConnection(conn) + session.connection = conn session.put("url", conn.metaData.url) val s = session.get("sessionId") as String return url + "/frame.jsp?jsessionid=" + s diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/TransactionViewer.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/TransactionViewer.kt index b48aa28d7c..01f14e3c89 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/TransactionViewer.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/TransactionViewer.kt @@ -156,7 +156,7 @@ class TransactionViewer : CordaView("Transactions") { private fun ObservableList>.getParties() = map { it.state.data.participants.map { getModel().lookup(it) } } private fun ObservableList>.toText() = map { it.contract().javaClass.simpleName }.groupBy { it }.map { "${it.key} (${it.value.size})" }.joinToString() - private class TransactionWidget() : BorderPane() { + private class TransactionWidget : BorderPane() { private val partiallyResolvedTransactions by observableListReadOnly(TransactionDataModel::partiallyResolvedTransactions) // TODO : Add a scrolling table to show latest transaction. diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/CashViewer.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/CashViewer.kt index 064c86cf7f..8506f0aa67 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/CashViewer.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/CashViewer.kt @@ -213,7 +213,7 @@ class CashViewer : CordaView("Cash") { treeItem } - cashViewerTable.apply() { + cashViewerTable.apply { root = TreeItem() val children: List> = root.children Bindings.bindContent(children, cashViewerIssueNodes) @@ -280,7 +280,7 @@ class CashViewer : CordaView("Cash") { } } - private class CashWidget() : VBox() { + private class CashWidget : VBox() { // Inject data. private val reportingCurrency by observableValue(SettingsModel::reportingCurrencyProperty) private val cashStates by observableList(ContractStateModel::cashStates)