From d1aa80b8c79a4abc1406b934553d62015fd11fd2 Mon Sep 17 00:00:00 2001 From: Philip Wedemann <22521688+hfhbd@users.noreply.github.com> Date: Sun, 18 Aug 2024 23:59:27 +0200 Subject: [PATCH] Remove existing jvm converter functions (#384) --- .../api/jvm/kotlinx-uuid-core.api | 5 ---- .../kotlin/app/softwork/uuid/Converting.kt | 20 --------------- .../app/softwork/uuid/JavaConvertingTest.kt | 25 ------------------- .../app/softwork/uuid/JavaSpecificTests.kt | 22 ---------------- 4 files changed, 72 deletions(-) delete mode 100644 kotlinx-uuid-core/src/jvmMain/kotlin/app/softwork/uuid/Converting.kt delete mode 100644 kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaConvertingTest.kt delete mode 100644 kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaSpecificTests.kt diff --git a/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api b/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api index 33f0f57..4748545 100644 --- a/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api +++ b/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api @@ -7,11 +7,6 @@ public final class app/softwork/uuid/BinarySerializer : kotlinx/serialization/KS public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlin/uuid/Uuid;)V } -public final class app/softwork/uuid/ConvertingKt { - public static final fun toJavaUUID (Lkotlin/uuid/Uuid;)Ljava/util/UUID; - public static final fun toKotlinUuid (Ljava/util/UUID;)Lkotlin/uuid/Uuid; -} - public final class app/softwork/uuid/NameBasedGeneratorKt { public static final fun generateUuid (Lkotlin/uuid/Uuid$Companion;Lkotlin/uuid/Uuid;Ljava/lang/String;)Lkotlin/uuid/Uuid; public static final fun generateUuid (Lkotlin/uuid/Uuid$Companion;[B)Lkotlin/uuid/Uuid; diff --git a/kotlinx-uuid-core/src/jvmMain/kotlin/app/softwork/uuid/Converting.kt b/kotlinx-uuid-core/src/jvmMain/kotlin/app/softwork/uuid/Converting.kt deleted file mode 100644 index d6f772a..0000000 --- a/kotlinx-uuid-core/src/jvmMain/kotlin/app/softwork/uuid/Converting.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2020-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package app.softwork.uuid - -import java.util.* -import kotlin.uuid.Uuid - -/** - * Converts this [UUID] value to a [Uuid] value - * by using the default [java.util.UUID.toString] representation. - */ -public fun UUID.toKotlinUuid(): Uuid = Uuid.parse(toString()) - -/** - * Converts this [Uuid] value to a [Uuid] value - * by using the default [kotlin.uuid.Uuid.toString] representation. - */ -public fun Uuid.toJavaUUID(): UUID = UUID.fromString(toString()) diff --git a/kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaConvertingTest.kt b/kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaConvertingTest.kt deleted file mode 100644 index 2ae0db2..0000000 --- a/kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaConvertingTest.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package app.softwork.uuid - -import kotlin.test.* -import kotlin.uuid.Uuid - -class JavaConvertingTest { - - @Test - fun toJavaUUID() { - val kotlinUUID = Uuid.parse(SOME_UUID_STRING) - val javaUUID = kotlinUUID.toJavaUUID() - assertEquals(SOME_UUID_STRING, javaUUID.toString()) - } - - @Test - fun fromJavaUUID() { - val javaUUID = java.util.UUID.fromString(SOME_UUID_STRING) - val kotlinUUID = javaUUID.toKotlinUuid() - assertEquals(SOME_UUID_STRING, kotlinUUID.toString()) - } -} diff --git a/kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaSpecificTests.kt b/kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaSpecificTests.kt deleted file mode 100644 index 06b249d..0000000 --- a/kotlinx-uuid-core/src/jvmTest/kotlin/app/softwork/uuid/JavaSpecificTests.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2020-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package app.softwork.uuid - -import java.security.* -import kotlin.random.* -import kotlin.test.* -import kotlin.uuid.Uuid - -class JavaSpecificTests { - @Test - fun secure() { - Uuid.random(SecureRandom().asKotlinRandom()).assertRandomGenerated() - } - - private fun Uuid.assertRandomGenerated() { - assertTrue(isRfcVariant) - assertEquals(4, versionNumber) - } -}