Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update kotlin core dependencies to v1.9.0 #540

Merged
merged 12 commits into from
Jul 25, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ kotlin {
*/
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
languageSettings.run {
optIn("kotlin.RequiresOptIn")
optIn("kotlinx.cinterop.ExperimentalForeignApi")
optIn("kotlin.experimental.ExperimentalNativeApi")
}
}
val commonMain by getting
val commonTest by getting {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.8.22"
kotlin = "1.9.0"
okio = "3.4.0"
serialization = "1.5.1"
diktat = "1.2.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,6 @@ enum class CurrentOs {
LINUX, MACOS, UNDEFINED, WINDOWS
}

/**
* Atomic values
*/
expect class AtomicInt(value: Int) {
kgevorkyan marked this conversation as resolved.
Show resolved Hide resolved
/**
* @return value
*/
fun get(): Int

/**
* @param delta increments the value_ by delta
* @return the new value
*/
fun addAndGet(delta: Int): Int
}

/**
* Atomic boolean
*/
@Suppress("FUNCTION_BOOLEAN_PREFIX")
expect class AtomicBoolean(value: Boolean) {
/**
* @return value
*/
fun get(): Boolean

/**
* @param expect expected value
* @param update updated value
* @return the result of the comparison
*/
fun compareAndSet(expect: Boolean, update: Boolean): Boolean
}

/**
* Class that holds value and shares atomic reference to the value (native only)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ package com.saveourtool.save.core.utils

import com.saveourtool.save.core.config.OutputStreamType

actual class AtomicInt actual constructor(value: Int) {
actual fun get(): Int = error("Not implemented for JS")
actual fun addAndGet(delta: Int): Int = error("Not implemented for JS")
}

actual class AtomicBoolean actual constructor(value: Boolean) {
actual fun get(): Boolean = error("Not implemented for JS")
actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean = error("Not implemented for JS")
}

@Suppress("USE_DATA_CLASS")
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
private var value: T = valueToStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ package com.saveourtool.save.core.utils

import com.saveourtool.save.core.config.OutputStreamType

actual typealias AtomicInt = java.util.concurrent.atomic.AtomicInteger

actual typealias AtomicBoolean = java.util.concurrent.atomic.AtomicBoolean

@Suppress("USE_DATA_CLASS")
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
private val holder: java.util.concurrent.atomic.AtomicReference<T> = java.util.concurrent.atomic.AtomicReference(valueToStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,9 @@ import platform.posix.fprintf
import platform.posix.stderr
import platform.posix.stdout

/**
* Atomic values
*/
actual class AtomicInt actual constructor(value: Int) {
private val holder = kotlin.native.concurrent.AtomicInt(value)

/**
* @return value
*/
actual fun get(): Int = holder.value

/**
* @param delta increments the value_ by delta
* @return the new value
*/
actual fun addAndGet(delta: Int): Int = holder.addAndGet(delta)
}

@Suppress("FUNCTION_BOOLEAN_PREFIX")
actual class AtomicBoolean actual constructor(value: Boolean) {
private val holder = kotlin.native.concurrent.AtomicReference(value)

/**
* @return value
*/
actual fun get(): Boolean = holder.value

/**
* @param expect expected value
* @param update updated value
* @return the result of the comparison
*/
actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean = holder.compareAndSet(expect, update)
}

@Suppress("USE_DATA_CLASS")
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
private val holder: kotlin.native.concurrent.AtomicReference<T> = kotlin.native.concurrent.AtomicReference(valueToStore)
private val holder: kotlin.concurrent.AtomicReference<T> = kotlin.concurrent.AtomicReference(valueToStore)
actual fun get(): T = holder.value
actual fun set(newValue: T) {
holder.value = newValue
Expand Down Expand Up @@ -104,7 +69,7 @@ actual fun writeToConsole(msg: String, outputType: OutputStreamType) {
* @param msg a message string
* @param output output stream (stdout or stderr)
*/
fun processStandardStreams(msg: String, output: OutputStreamType) {
private fun processStandardStreams(msg: String, output: OutputStreamType) {
val stream = when (output) {
OutputStreamType.STDERR -> stderr
else -> stdout
Expand Down
Loading