From eedf207bf4c9b723db685e6b7a9191bef9745486 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 31 Aug 2020 20:57:06 +0200 Subject: Add explicit API visibility This change adds explicit visibility modifiers to the public interfaces and enables Kotlin 1.4's explicit API mode. --- .../opendc-core/src/main/kotlin/org/opendc/core/Environment.kt | 2 +- simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt | 6 +++--- simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt | 2 +- simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt | 2 +- simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt | 2 +- .../kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt | 2 +- .../opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt | 2 +- .../src/main/kotlin/org/opendc/core/resource/TagContainer.kt | 4 ++-- .../src/main/kotlin/org/opendc/core/services/ServiceKey.kt | 4 ++-- .../src/main/kotlin/org/opendc/core/workload/Workload.kt | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) (limited to 'simulator/opendc-core/src') diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt index 3baef092..a5055cff 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt @@ -31,4 +31,4 @@ package org.opendc.core * @property description A small textual description about the environment that is being modeled. * @property platforms The cloud platforms (such as AWS or GCE) in this environment. */ -data class Environment(val name: String, val description: String?, val platforms: List) +public data class Environment(val name: String, val description: String?, val platforms: List) diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt index 9c1464af..252c40f5 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt @@ -27,14 +27,14 @@ import java.util.* /** * An object that has a unique identity. */ -interface Identity { +public interface Identity { /** * A unique, opaque, system-generated value, representing the object. */ - val uid: UUID + public val uid: UUID /** * A non-empty, human-readable string representing the object. */ - val name: String + public val name: String } diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt index 076df255..5550ffed 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt @@ -31,4 +31,4 @@ import java.util.* * @property name the name of the platform. * @property zones The availability zones available on this platform. */ -data class Platform(override val uid: UUID, override val name: String, val zones: List) : Identity +public data class Platform(override val uid: UUID, override val name: String, val zones: List) : Identity diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt index d4b237e7..fc542cef 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt @@ -25,7 +25,7 @@ package org.opendc.core /** * A user of the cloud network. */ -interface User : Identity { +public interface User : Identity { /** * The name of the user. */ diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt index 0bca4ee5..834f6cf2 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt @@ -36,7 +36,7 @@ import java.util.* * @property name The name of the zone within its platform. * @property services The service registry containing the services of the zone. */ -data class Zone( +public data class Zone( override val uid: UUID, override val name: String, val services: ServiceRegistry diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt index 6c019763..f64b8815 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt @@ -33,7 +33,7 @@ import kotlin.random.Random * A [FaultInjector] that injects uncorrelated faults into the system, meaning that failures of the subsystems are * independent. */ -class UncorrelatedFaultInjector( +public class UncorrelatedFaultInjector( private val clock: Clock, private val alpha: Double, private val beta: Double, diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt index 4a225d9d..4b73ad92 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt @@ -33,5 +33,5 @@ public interface Powerable { /** * The power draw at the device's power supply in watts (W).w */ - val powerDraw: Flow + public val powerDraw: Flow } diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt index 842710d2..6a4ff102 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt @@ -25,10 +25,10 @@ package org.opendc.core.resource /** * An immutable map containing the tags of some resource. */ -typealias TagContainer = Map +public typealias TagContainer = Map /** * Obtain the value of the tag with the specified [key] of type [T]. If the tag does not exist or the tag is of * different type, `null` is returned. */ -inline fun TagContainer.typed(key: String): T? = this[key] as? T +public inline fun TagContainer.typed(key: String): T? = this[key] as? T diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt index 6d475f87..9078ecdd 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt @@ -30,7 +30,7 @@ import java.util.* * * @param T The shape of the messages the service responds to. */ -interface ServiceKey : Identity +public interface ServiceKey : Identity /** * Helper class for constructing a [ServiceKey]. @@ -38,7 +38,7 @@ interface ServiceKey : Identity * @property uid The unique identifier of the service. * @property name The name of the service. */ -abstract class AbstractServiceKey(override val uid: UUID, override val name: String) : ServiceKey { +public abstract class AbstractServiceKey(override val uid: UUID, override val name: String) : ServiceKey { override fun equals(other: Any?): Boolean = other is ServiceKey<*> && uid == other.uid override fun hashCode(): Int = uid.hashCode() override fun toString(): String = "ServiceKey[uid=$uid, name=$name]" diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt index 656020ef..f0bd1137 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt @@ -29,9 +29,9 @@ import org.opendc.core.User * A high-level abstraction that represents the actual work that a set of compute resources perform, such * as running an application on a machine or a whole workflow running multiple tasks on numerous machines. */ -interface Workload : Identity { +public interface Workload : Identity { /** * The owner of this workload. */ - val owner: User + public val owner: User } -- cgit v1.2.3