diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b7fca2dc97..c5c0a6ef37 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -87,6 +87,12 @@ + + + + + + diff --git a/core/src/main/kotlin/net/corda/core/node/PluginServiceHub.kt b/core/src/main/kotlin/net/corda/core/node/PluginServiceHub.kt index be193d2dfe..aa8066fd54 100644 --- a/core/src/main/kotlin/net/corda/core/node/PluginServiceHub.kt +++ b/core/src/main/kotlin/net/corda/core/node/PluginServiceHub.kt @@ -1,13 +1,6 @@ package net.corda.core.node -import net.corda.core.flows.FlowLogic -import net.corda.core.identity.Party - /** * A service hub to be used by the [CordaPluginRegistry] */ -interface PluginServiceHub : ServiceHub { - @Deprecated("This is no longer used. Instead annotate the flows produced by your factory with @InitiatedBy and have " + - "them point to the initiating flow class.", level = DeprecationLevel.ERROR) - fun registerFlowInitiator(initiatingFlowClass: Class>, serviceFlowFactory: (Party) -> FlowLogic<*>) = Unit -} +interface PluginServiceHub : ServiceHub diff --git a/core/src/main/kotlin/net/corda/core/node/services/IdentityService.kt b/core/src/main/kotlin/net/corda/core/node/services/IdentityService.kt index e45a13405e..95acc08b72 100644 --- a/core/src/main/kotlin/net/corda/core/node/services/IdentityService.kt +++ b/core/src/main/kotlin/net/corda/core/node/services/IdentityService.kt @@ -18,16 +18,6 @@ interface IdentityService { val trustAnchor: TrustAnchor val caCertStore: CertStore - /** - * Verify and then store an identity. - * - * @param party a party representing a legal entity and the certificate path linking them to the network trust root. - * @throws IllegalArgumentException if the certificate path is invalid. - */ - @Throws(CertificateExpiredException::class, CertificateNotYetValidException::class, InvalidAlgorithmParameterException::class) - @Deprecated("Use verifyAndRegisterIdentity() instead, which is the same function with a better name") - fun registerIdentity(party: PartyAndCertificate) - /** * Verify and then store an identity. * diff --git a/core/src/main/kotlin/net/corda/core/utilities/ByteArrays.kt b/core/src/main/kotlin/net/corda/core/utilities/ByteArrays.kt index fd0b6f87a2..23eb6d86e5 100644 --- a/core/src/main/kotlin/net/corda/core/utilities/ByteArrays.kt +++ b/core/src/main/kotlin/net/corda/core/utilities/ByteArrays.kt @@ -131,9 +131,6 @@ open class OpaqueBytes(override val bytes: ByteArray) : ByteSequence() { override val offset: Int get() = 0 } -@Deprecated("Use sequence instead") -fun ByteArray.opaque(): OpaqueBytes = OpaqueBytes(this) - fun ByteArray.sequence(offset: Int = 0, size: Int = this.size) = ByteSequence.of(this, offset, size) fun ByteArray.toHexString(): String = DatatypeConverter.printHexBinary(this) diff --git a/core/src/main/kotlin/net/corda/core/utilities/KotlinUtils.kt b/core/src/main/kotlin/net/corda/core/utilities/KotlinUtils.kt index 2870b34abf..a726dbf7fb 100644 --- a/core/src/main/kotlin/net/corda/core/utilities/KotlinUtils.kt +++ b/core/src/main/kotlin/net/corda/core/utilities/KotlinUtils.kt @@ -74,18 +74,36 @@ val Int.millis: Duration get() = Duration.ofMillis(toLong()) * will not be serialized, and if it's missing (or the first time it's accessed), the initializer will be * used to set it up. */ -@Suppress("DEPRECATION") -fun transient(initializer: () -> T) = TransientProperty(initializer) +fun transient(initializer: () -> T): PropertyDelegate = TransientProperty(initializer) + +/** + * Simple interface encapsulating the implicit Kotlin contract for immutable property delegates. + */ +interface PropertyDelegate { + /** + * Invoked as part of Kotlin delegated properties construct. + */ + operator fun getValue(thisRef: Any?, property: KProperty<*>): T +} + +/** + * Simple interface encapsulating the implicit Kotlin contract for mutable property delegates. + */ +interface VariablePropertyDelegate : PropertyDelegate { + /** + * Invoked as part of Kotlin delegated properties construct. + */ + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) +} -@Deprecated("Use transient") @CordaSerializable -class TransientProperty(private val initialiser: () -> T) { +private class TransientProperty internal constructor(private val initialiser: () -> T) : PropertyDelegate { @Transient private var initialised = false @Transient private var value: T? = null @Suppress("UNCHECKED_CAST") @Synchronized - operator fun getValue(thisRef: Any?, property: KProperty<*>): T { + override operator fun getValue(thisRef: Any?, property: KProperty<*>): T { if (!initialised) { value = initialiser() initialised = true diff --git a/core/src/main/kotlin/net/corda/core/utilities/UntrustworthyData.kt b/core/src/main/kotlin/net/corda/core/utilities/UntrustworthyData.kt index afa519fcec..272b5ec200 100644 --- a/core/src/main/kotlin/net/corda/core/utilities/UntrustworthyData.kt +++ b/core/src/main/kotlin/net/corda/core/utilities/UntrustworthyData.kt @@ -15,11 +15,7 @@ import java.io.Serializable * - Are any objects *reachable* from this object mismatched or not what you expected? * - Is it suspiciously large or small? */ -class UntrustworthyData(private val fromUntrustedWorld: T) { - val data: T - @Deprecated("Accessing the untrustworthy data directly without validating it first is a bad idea") - get() = fromUntrustedWorld - +class UntrustworthyData(@PublishedApi internal val fromUntrustedWorld: T) { @Suspendable @Throws(FlowException::class) fun unwrap(validator: Validator) = validator.validate(fromUntrustedWorld) @@ -32,5 +28,4 @@ class UntrustworthyData(private val fromUntrustedWorld: T) { } } -@Suppress("DEPRECATION") -inline fun UntrustworthyData.unwrap(validator: (T) -> R): R = validator(data) +inline fun UntrustworthyData.unwrap(validator: (T) -> R): R = validator(fromUntrustedWorld) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index e213b707d7..81406ccf1c 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -138,6 +138,10 @@ UNRELEASED * Parties were not displayed for created deals in single view. * Non-default notional amounts caused the creation of new deals to fail. +.. warning:: Renamed configuration property key `basedir` to `baseDirectory`. This will require updating existing configuration files. + +* Removed deprecated parts of the API. + Milestone 14 ------------ diff --git a/docs/source/corda-configuration-file.rst b/docs/source/corda-configuration-file.rst index 2a382e69e8..e2c2365c92 100644 --- a/docs/source/corda-configuration-file.rst +++ b/docs/source/corda-configuration-file.rst @@ -49,7 +49,7 @@ NetworkMapService plus Simple Notary configuration file. Fields ------ -The available config fields are listed below. ``basedir`` is available as a substitution value, containing the absolute +The available config fields are listed below. ``baseDirectory`` is available as a substitution value, containing the absolute path to the node's base directory. :myLegalName: The legal identity of the node acts as a human readable alias to the node's public key and several demos use diff --git a/docs/source/example-code/src/main/resources/example-node.conf b/docs/source/example-code/src/main/resources/example-node.conf index e6a5a706f5..d12273c18a 100644 --- a/docs/source/example-code/src/main/resources/example-node.conf +++ b/docs/source/example-code/src/main/resources/example-node.conf @@ -3,7 +3,7 @@ keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" dataSourceProperties : { dataSourceClassName : org.h2.jdbcx.JdbcDataSource - "dataSource.url" : "jdbc:h2:file:"${basedir}"/persistence" + "dataSource.url" : "jdbc:h2:file:"${baseDirectory}"/persistence" "dataSource.user" : sa "dataSource.password" : "" } diff --git a/experimental/src/main/kotlin/net/corda/finance/contracts/universal/Literal.kt b/experimental/src/main/kotlin/net/corda/finance/contracts/universal/Literal.kt index 8da331cf32..0190b9c2fa 100644 --- a/experimental/src/main/kotlin/net/corda/finance/contracts/universal/Literal.kt +++ b/experimental/src/main/kotlin/net/corda/finance/contracts/universal/Literal.kt @@ -79,31 +79,6 @@ open class ContractBuilder { return c } - @Deprecated(level = DeprecationLevel.ERROR, message = "Not allowed") - fun Action(@Suppress("UNUSED_PARAMETER") name: String, @Suppress("UNUSED_PARAMETER") condition: Perceivable, - @Suppress("UNUSED_PARAMETER") actors: Set, @Suppress("UNUSED_PARAMETER") arrangement: Arrangement) { - } - - @Deprecated(level = DeprecationLevel.ERROR, message = "Not available") - fun String.anytime(@Suppress("UNUSED_PARAMETER") ignore: T) { - } - - @Deprecated(level = DeprecationLevel.ERROR, message = "Not available") - fun String.givenThat(@Suppress("UNUSED_PARAMETER") ignore: T) { - } - - @Deprecated(level = DeprecationLevel.ERROR, message = "Not available") - fun String.givenThat(@Suppress("UNUSED_PARAMETER") ignore1: T, @Suppress("UNUSED_PARAMETER") ignore2: T) { - } - - @Deprecated(level = DeprecationLevel.ERROR, message = "Not available") - fun Party.may(init: ActionBuilder.() -> Action) { - } - - @Deprecated(level = DeprecationLevel.ERROR, message = "Not available") - fun Set.may(init: ActionBuilder.() -> Action) { - } - val start = StartDate() val end = EndDate() diff --git a/finance/src/main/kotlin/net/corda/finance/flows/CashFlowCommand.kt b/finance/src/main/kotlin/net/corda/finance/flows/CashFlowCommand.kt deleted file mode 100644 index ae689ce66b..0000000000 --- a/finance/src/main/kotlin/net/corda/finance/flows/CashFlowCommand.kt +++ /dev/null @@ -1,53 +0,0 @@ -package net.corda.finance.flows - -import net.corda.core.contracts.Amount -import net.corda.core.identity.Party -import net.corda.core.messaging.CordaRPCOps -import net.corda.core.messaging.FlowHandle -import net.corda.core.messaging.startFlow -import net.corda.core.utilities.OpaqueBytes -import net.corda.core.utilities.getOrThrow -import java.util.* - -/** - * A command to initiate the cash flow with. - */ -@Deprecated("Please use the flows directly, these will be removed in a later release") -sealed class CashFlowCommand { - abstract fun startFlow(proxy: CordaRPCOps): FlowHandle - - /** - * A command to initiate the Cash flow with. - */ - data class IssueCash(val amount: Amount, - val issueRef: OpaqueBytes, - val recipient: Party, - val notary: Party, - val anonymous: Boolean) : CashFlowCommand() { - override fun startFlow(proxy: CordaRPCOps): FlowHandle { - proxy.startFlow(::CashIssueFlow, amount, issueRef, notary).returnValue.getOrThrow() - return proxy.startFlow(::CashPaymentFlow, amount, recipient, anonymous) - } - } - - /** - * Pay cash to someone else. - * - * @param amount the amount of currency to issue on to the ledger. - * @param recipient the party to issue the cash to. - */ - data class PayCash(val amount: Amount, val recipient: Party, val issuerConstraint: Party? = null, - val anonymous: Boolean) : CashFlowCommand() { - override fun startFlow(proxy: CordaRPCOps) = proxy.startFlow(::CashPaymentFlow, amount, recipient, anonymous) - } - - /** - * Exit cash from the ledger. - * - * @param amount the amount of currency to exit from the ledger. - * @param issueRef the reference previously specified on the issuance. - */ - data class ExitCash(val amount: Amount, val issueRef: OpaqueBytes) : CashFlowCommand() { - override fun startFlow(proxy: CordaRPCOps) = proxy.startFlow(::CashExitFlow, amount, issueRef) - } -} \ No newline at end of file diff --git a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt index d7feadc2a1..e163ef12cb 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt @@ -35,7 +35,7 @@ object ConfigHelper { val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig)) val finalConfig = configOf( // Add substitution values here - "basedir" to baseDirectory.toString()) + "baseDirectory" to baseDirectory.toString()) .withFallback(configOverrides) .withFallback(appConfig) .withFallback(defaultConfig) diff --git a/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt b/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt index 37bea1cae9..55aa375285 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt @@ -40,11 +40,8 @@ interface NodeConfiguration : NodeSSLConfiguration { } data class FullNodeConfiguration( - // TODO Remove this subsitution value and use baseDirectory as the subsitution instead - @Deprecated( - "This is a substitution value which points to the baseDirectory and is manually added into the config before parsing", - ReplaceWith("baseDirectory")) - val basedir: Path, + /** This is not retrieved from the config file but rather from a command line argument. */ + override val baseDirectory: Path, override val myLegalName: CordaX500Name, override val emailAddress: String, override val keyStorePassword: String, @@ -73,9 +70,6 @@ data class FullNodeConfiguration( val useTestClock: Boolean = false, val detectPublicIp: Boolean = true ) : NodeConfiguration { - /** This is not retrieved from the config file but rather from a command line argument. */ - @Suppress("DEPRECATION") - override val baseDirectory: Path get() = basedir override val exportJMXto: String get() = "http" init { 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 a730e4bf68..d81ccdc9b3 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 @@ -54,10 +54,6 @@ class InMemoryIdentityService(identities: Iterable = emptyS } } - override fun registerIdentity(party: PartyAndCertificate) { - verifyAndRegisterIdentity(party) - } - // TODO: Check the certificate validation logic @Throws(CertificateExpiredException::class, CertificateNotYetValidException::class, InvalidAlgorithmParameterException::class) override fun verifyAndRegisterIdentity(identity: PartyAndCertificate): PartyAndCertificate? { diff --git a/node/src/main/kotlin/net/corda/node/services/identity/PersistentIdentityService.kt b/node/src/main/kotlin/net/corda/node/services/identity/PersistentIdentityService.kt index ddca1ffaee..ed8ba2db4d 100644 --- a/node/src/main/kotlin/net/corda/node/services/identity/PersistentIdentityService.kt +++ b/node/src/main/kotlin/net/corda/node/services/identity/PersistentIdentityService.kt @@ -110,10 +110,6 @@ class PersistentIdentityService(identities: Iterable = empt } } - override fun registerIdentity(party: PartyAndCertificate) { - verifyAndRegisterIdentity(party) - } - // TODO: Check the certificate validation logic @Throws(CertificateExpiredException::class, CertificateNotYetValidException::class, InvalidAlgorithmParameterException::class) override fun verifyAndRegisterIdentity(identity: PartyAndCertificate): PartyAndCertificate? { diff --git a/node/src/main/resources/reference.conf b/node/src/main/resources/reference.conf index 11e2269fce..1b3711c8c4 100644 --- a/node/src/main/resources/reference.conf +++ b/node/src/main/resources/reference.conf @@ -5,7 +5,7 @@ keyStorePassword = "cordacadevpass" trustStorePassword = "trustpass" dataSourceProperties = { dataSourceClassName = org.h2.jdbcx.JdbcDataSource - "dataSource.url" = "jdbc:h2:file:"${basedir}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT="${h2port} + "dataSource.url" = "jdbc:h2:file:"${baseDirectory}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT="${h2port} "dataSource.user" = sa "dataSource.password" = "" } diff --git a/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt b/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt index b76393260e..ef4e7128e4 100644 --- a/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt @@ -14,7 +14,7 @@ class FullNodeConfigurationTest { @Test fun `Artemis special characters not permitted in RPC usernames`() { val testConfiguration = FullNodeConfiguration( - basedir = Paths.get("."), + baseDirectory = Paths.get("."), myLegalName = ALICE.name, networkMapService = null, emailAddress = "", diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/TestDSL.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/TestDSL.kt index 480f13ec34..c4ed78bb77 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/TestDSL.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/TestDSL.kt @@ -41,38 +41,6 @@ import kotlin.collections.set // } // -/** - * Here follows implementations of the [LedgerDSLInterpreter] and [TransactionDSLInterpreter] interfaces to be used in - * tests. Top level primitives [ledger] and [transaction] that bind the interpreter types are also defined here. - */ - -@Deprecated( - message = "ledger doesn't nest, use tweak", - replaceWith = ReplaceWith("tweak"), - level = DeprecationLevel.ERROR) -@Suppress("UNUSED_PARAMETER", "unused") -fun TransactionDSLInterpreter.ledger( - dsl: LedgerDSL.() -> Unit) { -} - -@Deprecated( - message = "transaction doesn't nest, use tweak", - replaceWith = ReplaceWith("tweak"), - level = DeprecationLevel.ERROR) -@Suppress("UNUSED_PARAMETER", "unused") -fun TransactionDSLInterpreter.transaction( - dsl: TransactionDSL.() -> EnforceVerifyOrFail) { -} - -@Deprecated( - message = "ledger doesn't nest, use tweak", - replaceWith = ReplaceWith("tweak"), - level = DeprecationLevel.ERROR) -@Suppress("UNUSED_PARAMETER", "unused") -fun LedgerDSLInterpreter.ledger( - dsl: LedgerDSL.() -> Unit) { -} - /** * 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 diff --git a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt index 3e6604d941..a72f3776b2 100644 --- a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt +++ b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt @@ -199,7 +199,7 @@ class NodeConfigTest { config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345) val nodeConfig = config.toFileConfig() - .withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString())) + .withValue("baseDirectory", ConfigValueFactory.fromAnyRef(baseDir.toString())) .withFallback(ConfigFactory.parseResources("reference.conf")) .resolve() val fullConfig = nodeConfig.parseAs() @@ -229,7 +229,7 @@ class NodeConfigTest { config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345) val nodeConfig = config.toFileConfig() - .withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString())) + .withValue("baseDirectory", ConfigValueFactory.fromAnyRef(baseDir.toString())) .withFallback(ConfigFactory.parseResources("web-reference.conf")) .resolve() val webConfig = WebServerConfig(baseDir, nodeConfig) diff --git a/webserver/src/main/kotlin/net/corda/webserver/WebArgsParser.kt b/webserver/src/main/kotlin/net/corda/webserver/WebArgsParser.kt index d78f9087a7..718678bb73 100644 --- a/webserver/src/main/kotlin/net/corda/webserver/WebArgsParser.kt +++ b/webserver/src/main/kotlin/net/corda/webserver/WebArgsParser.kt @@ -69,7 +69,7 @@ data class CmdLineOptions(val baseDirectory: Path, val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig)) val overrideConfig = ConfigFactory.parseMap(configOverrides + mapOf( // Add substitution values here - "basedir" to baseDirectory.toString()) + "baseDirectory" to baseDirectory.toString()) ) val finalConfig = overrideConfig .withFallback(appConfig)