From c57fdd7790e02a723158f91cdb3b697642709a0f Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 8 May 2023 13:00:53 +0100 Subject: [PATCH] Revert "[core] Add common JvmFile for compatibility" This reverts commit 64e3d6c0f2d317fd6363ac957b9c30c893c0af95. --- .../src/commonMain/kotlin/jvm/JvmFile.kt | 54 ----------------- .../src/jvmBaseMain/kotlin/jvm/JvmFile.kt | 13 ----- .../src/nativeMain/kotlin/jvm/JvmFile.kt | 58 ------------------- 3 files changed, 125 deletions(-) delete mode 100644 mirai-core-utils/src/commonMain/kotlin/jvm/JvmFile.kt delete mode 100644 mirai-core-utils/src/jvmBaseMain/kotlin/jvm/JvmFile.kt delete mode 100644 mirai-core-utils/src/nativeMain/kotlin/jvm/JvmFile.kt diff --git a/mirai-core-utils/src/commonMain/kotlin/jvm/JvmFile.kt b/mirai-core-utils/src/commonMain/kotlin/jvm/JvmFile.kt deleted file mode 100644 index 299f8775a..000000000 --- a/mirai-core-utils/src/commonMain/kotlin/jvm/JvmFile.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2019-2023 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/dev/LICENSE - */ - -package net.mamoe.mirai.utils.jvm - -import io.ktor.utils.io.errors.* - -@CompatibilityOnlyJvmFile -public expect class JvmFile { - public constructor(pathname: String) - public constructor(parent: String, child: String) - - public fun getName(): String? - public fun getParent(): String? - public fun getParentFile(): JvmFile? - - public fun getPath(): String - public fun isAbsolute(): Boolean - public fun getAbsolutePath(): String - public fun getAbsoluteFile(): JvmFile - - @Throws(IOException::class) - public fun getCanonicalPath(): String - - @Throws(IOException::class) - public fun getCanonicalFile(): JvmFile? - - @Throws(IOException::class) - public fun createNewFile(): Boolean - - public fun length(): Long - public fun delete(): Boolean - - public fun listFiles(): Array? - - public fun mkdir(): Boolean - public fun mkdirs(): Boolean - public fun renameTo(file: JvmFile): Boolean -} - -@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.FUNCTION) -@RequiresOptIn( - "JvmFile is only used for compatibility and for simplifying expect/actual structure. " + - "It allows you to use java.io.File in commonMain and is intended only for maintaining compatibility with legacy code in commonMain." + - "JvmFile is not implemented in Native and you must deprecate the implementation on nativeMain as HIDDEN." + - "Do not design new APIs using JvmFile." -) -public annotation class CompatibilityOnlyJvmFile \ No newline at end of file diff --git a/mirai-core-utils/src/jvmBaseMain/kotlin/jvm/JvmFile.kt b/mirai-core-utils/src/jvmBaseMain/kotlin/jvm/JvmFile.kt deleted file mode 100644 index 903abf305..000000000 --- a/mirai-core-utils/src/jvmBaseMain/kotlin/jvm/JvmFile.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2019-2023 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/dev/LICENSE - */ - -package net.mamoe.mirai.utils.jvm - -@CompatibilityOnlyJvmFile -public actual typealias JvmFile = java.io.File \ No newline at end of file diff --git a/mirai-core-utils/src/nativeMain/kotlin/jvm/JvmFile.kt b/mirai-core-utils/src/nativeMain/kotlin/jvm/JvmFile.kt deleted file mode 100644 index cc6d0ba53..000000000 --- a/mirai-core-utils/src/nativeMain/kotlin/jvm/JvmFile.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019-2023 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/dev/LICENSE - */ - -package net.mamoe.mirai.utils.jvm - -import io.ktor.utils.io.errors.* - -@Suppress("DEPRECATION_ERROR") -@Deprecated("JvmFile is not implemented on native", level = DeprecationLevel.HIDDEN) -@CompatibilityOnlyJvmFile -public actual class JvmFile { - public actual fun getName(): String? = throw NotImplementedError() - - public actual fun getParent(): String? = throw NotImplementedError() - - public actual fun getParentFile(): JvmFile? = throw NotImplementedError() - - public actual fun getPath(): String = throw NotImplementedError() - - public actual fun isAbsolute(): Boolean = throw NotImplementedError() - public actual fun getAbsolutePath(): String = throw NotImplementedError() - public actual fun getAbsoluteFile(): JvmFile = throw NotImplementedError() - - @Throws(IOException::class) - public actual fun getCanonicalPath(): String = throw NotImplementedError() - - @Throws(IOException::class) - public actual fun getCanonicalFile(): JvmFile? = throw NotImplementedError() - - @Throws(IOException::class) - public actual fun createNewFile(): Boolean = throw NotImplementedError() - - public actual fun length(): Long = throw NotImplementedError() - - public actual fun delete(): Boolean = throw NotImplementedError() - - public actual fun listFiles(): Array? = throw NotImplementedError() - - public actual fun mkdir(): Boolean = throw NotImplementedError() - - public actual fun mkdirs(): Boolean = throw NotImplementedError() - - public actual fun renameTo(file: JvmFile): Boolean = throw NotImplementedError() - - public actual constructor(pathname: String) { - throw NotImplementedError() - } - - public actual constructor(parent: String, child: String) { - throw NotImplementedError() - } -} \ No newline at end of file