Skip to content

Commit 114e6e9

Browse files
authored
Update to kotlin 1.9.10 (#544)
1 parent 8767c86 commit 114e6e9

9 files changed

Lines changed: 275 additions & 675 deletions

File tree

buildSrc/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-library.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ kotlin {
6969
* linux mingw macos
7070
*/
7171
sourceSets {
72-
all {
73-
languageSettings.optIn("kotlin.RequiresOptIn")
74-
}
7572
val commonMain by getting
7673
val commonTest by getting {
7774
dependencies {

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[versions]
2-
kotlin = "1.8.22"
2+
kotlin = "1.9.10"
33
okio = "3.4.0"
44
serialization = "1.5.1"
55
diktat = "1.2.5"
66
kotlinx-cli = "0.3.5"
77
kotlinx-datetime = "0.4.0"
8-
kotlinx-coroutines = "1.6.3-native-mt"
8+
kotlinx-coroutines = "1.7.2"
99
junit = "5.10.0"
1010
ktoml = "0.5.0"
1111
multiplatform-diff = "0.4.0"

renovate.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"*"
1616
],
1717
"excludePackagePatterns": [
18-
"^org\\.jetbrains\\.kotlin[.:]",
18+
"^org\\.jetbrains\\.kotlinx?[.:]",
1919
"^org\\.cqfn\\.diktat[.:]diktat-gradle-plugin"
2020
],
2121
"matchUpdateTypes": [
@@ -37,17 +37,10 @@
3737
{
3838
"managers": ["gradle"],
3939
"matchPackagePatterns": [
40-
"^org\\.jetbrains\\.kotlin[.:]"
40+
"^org\\.jetbrains\\.kotlinx?[.:]"
4141
],
4242
"groupName": "Kotlin core dependencies",
4343
"groupSlug": "core-kotlin"
44-
},
45-
{
46-
"managers": ["gradle"],
47-
"matchPackagePatterns": [
48-
"^org\\.jetbrains\\.kotlinx:kotlinx-coroutines.*"
49-
],
50-
"versioning": "docker"
5144
}
5245
]
5346
}

save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,6 @@ enum class CurrentOs {
1515
LINUX, MACOS, UNDEFINED, WINDOWS
1616
}
1717

18-
/**
19-
* Atomic values
20-
*/
21-
expect class AtomicInt(value: Int) {
22-
/**
23-
* @return value
24-
*/
25-
fun get(): Int
26-
27-
/**
28-
* @param delta increments the value_ by delta
29-
* @return the new value
30-
*/
31-
fun addAndGet(delta: Int): Int
32-
}
33-
34-
/**
35-
* Atomic boolean
36-
*/
37-
@Suppress("FUNCTION_BOOLEAN_PREFIX")
38-
expect class AtomicBoolean(value: Boolean) {
39-
/**
40-
* @return value
41-
*/
42-
fun get(): Boolean
43-
44-
/**
45-
* @param expect expected value
46-
* @param update updated value
47-
* @return the result of the comparison
48-
*/
49-
fun compareAndSet(expect: Boolean, update: Boolean): Boolean
50-
}
51-
5218
/**
5319
* Class that holds value and shares atomic reference to the value (native only)
5420
*

save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ package com.saveourtool.save.core.utils
1313

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

16-
actual class AtomicInt actual constructor(value: Int) {
17-
actual fun get(): Int = error("Not implemented for JS")
18-
actual fun addAndGet(delta: Int): Int = error("Not implemented for JS")
19-
}
20-
21-
actual class AtomicBoolean actual constructor(value: Boolean) {
22-
actual fun get(): Boolean = error("Not implemented for JS")
23-
actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean = error("Not implemented for JS")
24-
}
25-
2616
@Suppress("USE_DATA_CLASS")
2717
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
2818
private var value: T = valueToStore

save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
"MISSING_KDOC_TOP_LEVEL",
44
"MISSING_KDOC_ON_FUNCTION",
55
"FILE_NAME_MATCH_CLASS",
6+
"MatchingDeclarationName",
67
)
78

89
package com.saveourtool.save.core.utils
910

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

12-
actual typealias AtomicInt = java.util.concurrent.atomic.AtomicInteger
13-
14-
actual typealias AtomicBoolean = java.util.concurrent.atomic.AtomicBoolean
15-
1613
@Suppress("USE_DATA_CLASS")
1714
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
1815
private val holder: java.util.concurrent.atomic.AtomicReference<T> = java.util.concurrent.atomic.AtomicReference(valueToStore)

save-common/src/nativeMain/kotlin/com/saveourtool/save/core/files/FileUtils.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ import com.saveourtool.save.core.logging.logTrace
99
import okio.FileSystem
1010
import okio.Path
1111
import okio.Path.Companion.toPath
12-
import platform.posix.FTW
1312
import platform.posix.FTW_DEPTH
1413
import platform.posix.nftw
1514
import platform.posix.remove
16-
import platform.posix.stat
1715

18-
import kotlinx.cinterop.ByteVar
19-
import kotlinx.cinterop.CPointer
2016
import kotlinx.cinterop.staticCFunction
2117
import kotlinx.cinterop.toKString
2218

@@ -29,7 +25,8 @@ actual val fs: FileSystem = FileSystem.SYSTEM
2925
*/
3026
@Suppress("MAGIC_NUMBER", "MagicNumber")
3127
actual fun FileSystem.myDeleteRecursively(path: Path) {
32-
nftw(path.toString(), staticCFunction<CPointer<ByteVar>?, CPointer<stat>?, Int, CPointer<FTW>?, Int> { pathName, _, _, _ ->
28+
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
29+
nftw(path.toString(), staticCFunction { pathName, _, _, _ ->
3330
val fileName = pathName!!.toKString()
3431
logTrace("Attempt to delete file $fileName")
3532
remove(fileName)

save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE",
33
"MISSING_KDOC_TOP_LEVEL",
44
"MISSING_KDOC_ON_FUNCTION",
5-
"FILE_NAME_MATCH_CLASS"
5+
"FILE_NAME_MATCH_CLASS",
6+
"MatchingDeclarationName",
67
)
78

89
package com.saveourtool.save.core.utils
@@ -14,44 +15,11 @@ import platform.posix.fprintf
1415
import platform.posix.stderr
1516
import platform.posix.stdout
1617

17-
/**
18-
* Atomic values
19-
*/
20-
actual class AtomicInt actual constructor(value: Int) {
21-
private val holder = kotlin.native.concurrent.AtomicInt(value)
22-
23-
/**
24-
* @return value
25-
*/
26-
actual fun get(): Int = holder.value
27-
28-
/**
29-
* @param delta increments the value_ by delta
30-
* @return the new value
31-
*/
32-
actual fun addAndGet(delta: Int): Int = holder.addAndGet(delta)
33-
}
34-
35-
@Suppress("FUNCTION_BOOLEAN_PREFIX")
36-
actual class AtomicBoolean actual constructor(value: Boolean) {
37-
private val holder = kotlin.native.concurrent.AtomicReference(value)
38-
39-
/**
40-
* @return value
41-
*/
42-
actual fun get(): Boolean = holder.value
43-
44-
/**
45-
* @param expect expected value
46-
* @param update updated value
47-
* @return the result of the comparison
48-
*/
49-
actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean = holder.compareAndSet(expect, update)
50-
}
18+
import kotlinx.cinterop.ExperimentalForeignApi
5119

5220
@Suppress("USE_DATA_CLASS")
5321
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
54-
private val holder: kotlin.native.concurrent.AtomicReference<T> = kotlin.native.concurrent.AtomicReference(valueToStore)
22+
private val holder: kotlin.concurrent.AtomicReference<T> = kotlin.concurrent.AtomicReference(valueToStore)
5523
actual fun get(): T = holder.value
5624
actual fun set(newValue: T) {
5725
holder.value = newValue
@@ -104,11 +72,14 @@ actual fun writeToConsole(msg: String, outputType: OutputStreamType) {
10472
* @param msg a message string
10573
* @param output output stream (stdout or stderr)
10674
*/
107-
fun processStandardStreams(msg: String, output: OutputStreamType) {
75+
private fun processStandardStreams(msg: String, output: OutputStreamType) {
76+
@OptIn(ExperimentalForeignApi::class)
10877
val stream = when (output) {
10978
OutputStreamType.STDERR -> stderr
11079
else -> stdout
11180
}
81+
@OptIn(ExperimentalForeignApi::class)
11282
fprintf(stream, msg.escapePercent() + "\n")
83+
@OptIn(ExperimentalForeignApi::class)
11384
fflush(stream)
11485
}

0 commit comments

Comments
 (0)