From 291a55d2d2e6018023b9e18a323a113b8c650e72 Mon Sep 17 00:00:00 2001 From: Matthew Nesbit Date: Wed, 6 Sep 2017 16:48:54 +0100 Subject: [PATCH] Remove some trivial syntax related warning messages. Fix whitespace Address PR comment --- .../contracts/asset/cash/selection/CashSelectionH2Impl.kt | 5 ++--- .../net/corda/node/services/vault/VaultQueryTests.kt | 3 +-- .../main/kotlin/net/corda/netmap/VisualiserViewModel.kt | 4 ++-- .../kotlin/net/corda/demobench/model/NodeController.kt | 4 ++-- .../main/kotlin/net/corda/demobench/views/NodeTabView.kt | 8 ++++---- .../src/main/kotlin/net/corda/explorer/views/Network.kt | 2 +- .../net/corda/explorer/views/cordapps/cash/CashViewer.kt | 8 ++++---- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt index 5687027c3a..e402103630 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt +++ b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt @@ -7,7 +7,6 @@ import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.StateRef import net.corda.core.contracts.TransactionState import net.corda.core.crypto.SecureHash -import net.corda.core.utilities.toBase58String import net.corda.core.identity.AbstractParty import net.corda.core.identity.Party import net.corda.core.node.ServiceHub @@ -30,8 +29,8 @@ class CashSelectionH2Impl : CashSelection { val log = loggerFor() } - override fun isCompatible(metaData: DatabaseMetaData): Boolean { - return metaData.driverName == JDBC_DRIVER_NAME + override fun isCompatible(metadata: DatabaseMetaData): Boolean { + return metadata.driverName == JDBC_DRIVER_NAME } // coin selection retry loop counter, sleep (msecs) and lock for selecting states diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt index b1516a14ea..17fe519f61 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt @@ -3,7 +3,6 @@ package net.corda.node.services.vault import net.corda.core.contracts.* import net.corda.core.crypto.SecureHash import net.corda.core.crypto.entropyToKeyPair -import net.corda.core.utilities.toBase58String import net.corda.core.identity.Party import net.corda.core.identity.PartyAndCertificate import net.corda.core.node.services.* @@ -1060,7 +1059,7 @@ class VaultQueryTests : TestDependencyInjectionBase() { } database.transaction { @Suppress("EXPECTED_CONDITION") - val pagingSpec = PageSpecification(DEFAULT_PAGE_NUM, MAX_PAGE_SIZE + 1) // overflow = -2147483648 + val pagingSpec = PageSpecification(DEFAULT_PAGE_NUM, @Suppress("INTEGER_OVERFLOW")MAX_PAGE_SIZE + 1) // overflow = -2147483648 val criteria = VaultQueryCriteria(status = Vault.StateStatus.ALL) vaultQuerySvc.queryBy(criteria, paging = pagingSpec) } 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 954359b89e..228088417e 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 @@ -7,9 +7,9 @@ import javafx.scene.layout.StackPane import javafx.scene.shape.Circle import javafx.scene.shape.Line import javafx.util.Duration -import net.corda.core.utilities.commonName import net.corda.core.node.ScreenCoordinate import net.corda.core.utilities.ProgressTracker +import net.corda.core.utilities.commonName import net.corda.netmap.simulation.IRSSimulation import net.corda.testing.node.MockNetwork import org.bouncycastle.asn1.x500.X500Name @@ -85,7 +85,7 @@ class VisualiserViewModel { // bottom left: -23.2031,29.8406 // top right: 33.0469,64.3209 try { - return node.place.coordinate!!.project(view.mapImage.fitWidth, view.mapImage.fitHeight, 64.3209, 29.8406, -23.2031, 33.0469) + return node.place.coordinate.project(view.mapImage.fitWidth, view.mapImage.fitHeight, 64.3209, 29.8406, -23.2031, 33.0469) } catch(e: Exception) { throw Exception("Cannot project ${node.info.legalIdentity}", e) } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt index e4d0b0ef5e..a9fdd71bc5 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt @@ -56,8 +56,8 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() { baseDir, getX509Name( myLegalName = nodeData.legalName.value.trim(), - email = "corda@city.${location.countryCode!!.toLowerCase()}.example", - nearestCity = location.description!!, + email = "corda@city.${location.countryCode.toLowerCase()}.example", + nearestCity = location.description, country = location.countryCode ), nodeData.p2pPort.value, diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt index 7f1f8d44c0..f70ccd11f7 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt @@ -14,15 +14,15 @@ import javafx.scene.layout.Pane import javafx.scene.layout.Priority import javafx.stage.FileChooser import javafx.util.StringConverter -import net.corda.core.utilities.commonName import net.corda.core.internal.div import net.corda.core.internal.exists +import net.corda.core.internal.readAllLines +import net.corda.core.internal.writeLines import net.corda.core.node.CityDatabase import net.corda.core.node.WorldMapLocation -import net.corda.core.internal.readAllLines +import net.corda.core.utilities.commonName import net.corda.core.utilities.normaliseLegalName import net.corda.core.utilities.validateLegalName -import net.corda.core.internal.writeLines import net.corda.demobench.model.* import net.corda.demobench.ui.CloseableTab import org.controlsfx.control.CheckListView @@ -220,7 +220,7 @@ class NodeTabView : Fragment() { imageview { image = flags.get()[it.countryCode] } - label(it.description!!) + label(it.description) alignment = Pos.CENTER_LEFT } } diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt index f75f3aa1f7..0481534d5b 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt @@ -99,7 +99,7 @@ class Network : CordaView() { copyableLabel(SimpleObjectProperty(node.legalIdentity.owningKey.toBase58String())).apply { minWidth = 400.0 } } row("Services :") { label(node.advertisedServices.map { it.info }.joinToString(", ")) } - node.getWorldMapLocation()?.apply { row("Location :") { label(this@apply.description!!) } } + node.getWorldMapLocation()?.apply { row("Location :") { label(this@apply.description) } } } } setOnMouseClicked { 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 e332157467..86ab57bc53 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 @@ -22,8 +22,8 @@ import net.corda.client.jfx.utils.* import net.corda.core.contracts.Amount import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.withoutIssuer -import net.corda.core.utilities.commonName import net.corda.core.identity.AbstractParty +import net.corda.core.utilities.commonName import net.corda.explorer.formatters.AmountFormatter import net.corda.explorer.formatters.PartyNameFormatter import net.corda.explorer.identicon.identicon @@ -174,11 +174,11 @@ class CashViewer : CordaView("Cash") { * Next we create subgroups based on currency. [memberStates] here is all states holding currency [currency] issued by [issuer] above. * Note that these states will not be displayed in the TreeTable, but rather in the side pane if the user clicks on the row. */ - val currencyNodes = AggregatedList(memberStates, { it.state.data.amount.token.product }) { currency, memberStates -> + val currencyNodes = AggregatedList(memberStates, { it.state.data.amount.token.product }) { currency, groupedMemberStates -> /** * We sum the states in the subgroup, to be displayed in the "Local Currency" column */ - val amounts = memberStates.map { it.state.data.amount.withoutIssuer() } + val amounts = groupedMemberStates.map { it.state.data.amount.withoutIssuer() } val sumAmount = amounts.foldObservable(Amount(0, currency), Amount::plus) /** @@ -190,7 +190,7 @@ class CashViewer : CordaView("Cash") { /** * Finally assemble the actual TreeTable Currency node. */ - TreeItem(ViewerNode.CurrencyNode(sumAmount, equivSumAmount, memberStates)) + TreeItem(ViewerNode.CurrencyNode(sumAmount, equivSumAmount, groupedMemberStates)) } /**