From 7b2eb651be575e3cb4b394c49be514fdb91a75ab Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Fri, 25 Nov 2016 15:09:27 +0100 Subject: [PATCH] Suppress or fix the few remaining compiler warnings --- .../net/corda/node/services/NodeVaultServiceTest.kt | 1 - .../src/main/kotlin/net/corda/simulation/IRSSimulation.kt | 1 + .../main/kotlin/net/corda/simulation/TradeSimulation.kt | 1 + .../corda/vega/analytics/example/OGSwapPricingExample.kt | 8 +++----- .../src/main/kotlin/net/corda/vega/portfolio/Portfolio.kt | 4 +++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/node/src/test/kotlin/net/corda/node/services/NodeVaultServiceTest.kt b/node/src/test/kotlin/net/corda/node/services/NodeVaultServiceTest.kt index fa5717b66f..744e4c5073 100644 --- a/node/src/test/kotlin/net/corda/node/services/NodeVaultServiceTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/NodeVaultServiceTest.kt @@ -112,7 +112,6 @@ class NodeVaultServiceTest { services.vaultService.addNoteToTransaction(usefulTX.id, "USD Sample Note 1") services.vaultService.addNoteToTransaction(usefulTX.id, "USD Sample Note 2") services.vaultService.addNoteToTransaction(usefulTX.id, "USD Sample Note 3") - val results = services.vaultService.getTransactionNotes(usefulTX.id) assertEquals(3, services.vaultService.getTransactionNotes(usefulTX.id).count()) // Issue more Money (GBP) diff --git a/samples/irs-demo/src/main/kotlin/net/corda/simulation/IRSSimulation.kt b/samples/irs-demo/src/main/kotlin/net/corda/simulation/IRSSimulation.kt index 6d18246569..aaea02868e 100644 --- a/samples/irs-demo/src/main/kotlin/net/corda/simulation/IRSSimulation.kt +++ b/samples/irs-demo/src/main/kotlin/net/corda/simulation/IRSSimulation.kt @@ -118,6 +118,7 @@ class IRSSimulation(networkSendManuallyPumped: Boolean, runAsync: Boolean, laten irs.fixedLeg.fixedRatePayer = node1.info.legalIdentity irs.floatingLeg.floatingRatePayer = node2.info.legalIdentity + @Suppress("UNCHECKED_CAST") val acceptorTx = node2.initiateSingleShotFlow(Instigator::class) { Acceptor(it) }.flatMap { (it.fsm as FlowStateMachine).resultFuture } diff --git a/samples/irs-demo/src/main/kotlin/net/corda/simulation/TradeSimulation.kt b/samples/irs-demo/src/main/kotlin/net/corda/simulation/TradeSimulation.kt index e483083c1f..35766073ee 100644 --- a/samples/irs-demo/src/main/kotlin/net/corda/simulation/TradeSimulation.kt +++ b/samples/irs-demo/src/main/kotlin/net/corda/simulation/TradeSimulation.kt @@ -50,6 +50,7 @@ class TradeSimulation(runAsync: Boolean, latencyInjector: InMemoryMessagingNetwo val amount = 1000.DOLLARS + @Suppress("UNCHECKED_CAST") val buyerFuture = buyer.initiateSingleShotFlow(Seller::class) { Buyer(it, notary.info.notaryIdentity, amount, CommercialPaper.State::class.java) }.flatMap { (it.fsm as FlowStateMachine).resultFuture } diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/example/OGSwapPricingExample.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/example/OGSwapPricingExample.kt index 3b66669e4d..9f224e6ffd 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/example/OGSwapPricingExample.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/example/OGSwapPricingExample.kt @@ -6,6 +6,7 @@ * * Please see distribution for license. */ + package net.corda.vega.analytics.example import com.google.common.collect.ImmutableList @@ -52,7 +53,7 @@ import java.time.LocalDate fun main(args: Array) { val swapPricingExample = SwapPricingExample() - swapPricingExample.main(args) + swapPricingExample.main() } /** @@ -64,13 +65,10 @@ fun testOGTradeContract() { } class SwapPricingExample { - /** * Runs the example, pricing the instruments, producing the output as an ASCII table. - - * @param args ignored */ - fun main(args: Array) { + fun main() { // setup calculation runner component, which needs life-cycle management // a typical application might use dependency injection to obtain the instance val runner = CalculationRunner.ofMultiThreaded() diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/portfolio/Portfolio.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/portfolio/Portfolio.kt index c7bbff9dfa..3b6be1c0d7 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/portfolio/Portfolio.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/portfolio/Portfolio.kt @@ -5,8 +5,8 @@ import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.StateRef import net.corda.core.contracts.TransactionState import net.corda.core.crypto.Party -import net.corda.core.sum import net.corda.core.node.ServiceHub +import net.corda.core.sum import net.corda.vega.contracts.IRSState import net.corda.vega.contracts.SwapData import java.time.LocalDate @@ -34,6 +34,8 @@ fun List>.toPortfolio(): Portfolio { return Portfolio(this) } +// TODO: This should probably have its generics fixed and moved into the core platform API. +@Suppress("UNCHECKED_CAST") fun List.toStateAndRef(services: ServiceHub): List> { return services.vaultService.statesForRefs(this).map { StateAndRef(it.value as TransactionState, it.key)