Explorar o código

Hierarchical MPP:
- JDK in common target
- Disabled common compilations
- Android targets
- Kotlin 1.4.20

Him188 %!s(int64=4) %!d(string=hai) anos
pai
achega
b8002d4b4d
Modificáronse 51 ficheiros con 79 adicións e 3061 borrados
  1. 6 0
      build.gradle.kts
  2. 7 2
      buildSrc/src/main/kotlin/Versions.kt
  3. 2 0
      gradle.properties
  4. 19 2
      mirai-core-api/build.gradle.kts
  5. 7 8
      mirai-core-api/src/commonMain/kotlin/event/select.kt
  6. 0 4
      mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt
  7. 3 3
      mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt
  8. 0 42
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt
  9. 0 37
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt
  10. 0 45
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt
  11. 0 25
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt
  12. 0 47
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt
  13. 0 45
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt
  14. 0 44
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt
  15. 0 32
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt
  16. 0 98
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt
  17. 0 58
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt
  18. 0 45
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt
  19. 0 45
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt
  20. 0 36
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt
  21. 0 32
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt
  22. 0 36
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt
  23. 0 52
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt
  24. 0 36
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt
  25. 0 27
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt
  26. 0 25
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt
  27. 0 46
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt
  28. 0 50
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt
  29. 0 81
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt
  30. 0 51
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt
  31. 0 38
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt
  32. 0 87
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt
  33. 0 31
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt
  34. 0 36
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt
  35. 0 34
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt
  36. 0 34
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt
  37. 0 67
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt
  38. 0 65
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt
  39. 0 107
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt
  40. 0 532
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt
  41. 0 725
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt
  42. 0 60
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt
  43. 0 45
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt
  44. 0 70
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt
  45. 0 40
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt
  46. 0 31
      mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt
  47. 9 2
      mirai-core-api/src/jvmMain/kotlin/BotFactory.kt
  48. 16 1
      mirai-core/build.gradle.kts
  49. 0 1
      mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt
  50. 9 0
      mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt
  51. 1 1
      settings.gradle.kts

+ 6 - 0
build.gradle.kts

@@ -14,6 +14,7 @@ import org.jetbrains.dokka.gradle.DokkaTask
 import org.jetbrains.kotlin.gradle.dsl.*
 import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
 import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
+import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
 import org.jetbrains.kotlin.utils.addToStdlib.safeAs
 
 buildscript {
@@ -139,6 +140,11 @@ fun Project.configureJvmTarget() {
         kotlinOptions.jvmTarget = "1.8"
     }
 
+    kotlinTargets.orEmpty().filterIsInstance<KotlinJvmTarget>().forEach { target ->
+        target.compilations.all { kotlinOptions.jvmTarget = "1.8" }
+        target.testRuns["test"].executionTask.configure { useJUnitPlatform() }
+    }
+
     extensions.findByType(JavaPluginExtension::class.java)?.run {
         sourceCompatibility = JavaVersion.VERSION_1_8
         targetCompatibility = JavaVersion.VERSION_1_8

+ 7 - 2
buildSrc/src/main/kotlin/Versions.kt

@@ -8,6 +8,9 @@
  */
 
 @file:Suppress("ObjectPropertyName", "ObjectPropertyName", "unused")
+
+import org.gradle.api.attributes.Attribute
+
 /*
 * Copyright 2019-2020 Mamoe Technologies and contributors.
 *
@@ -22,7 +25,7 @@ object Versions {
 
     const val kotlinCompiler = "1.4.20"
     const val kotlinStdlib = "1.4.20"
-    const val coroutines = "1.4.0"
+    const val coroutines = "1.4.1"
     const val atomicFU = "0.14.4"
     const val serialization = "1.0.1"
     const val ktor = "1.4.2"
@@ -70,4 +73,6 @@ val `ktor-client-okhttp` = ktor("client-okhttp", Versions.ktor)
 val `ktor-client-serialization-jvm` = ktor("client-serialization-jvm", Versions.ktor)
 
 const val slf4j = "org.slf4j:slf4j-api:" + Versions.slf4j
-const val `log4j-api` = "org.apache.logging.log4j:log4j-api:" + Versions.log4j
+const val `log4j-api` = "org.apache.logging.log4j:log4j-api:" + Versions.log4j
+
+val ATTRIBUTE_MIRAI_TARGET_PLATFORM: Attribute<String> = Attribute.of("mirai.target.platform", String::class.java)

+ 2 - 0
gradle.properties

@@ -14,5 +14,7 @@ kotlin.parallel.tasks.in.project=true
 org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=512m -Dfile.encoding=UTF-8
 org.gradle.parallel=true
 org.gradle.vfs.watch=true
+kotlin.mpp.enableGranularSourceSetsMetadata=true
+kotlin.native.enableDependencyPropagation=false
 #kotlin.mpp.enableGranularSourceSetsMetadata=true
 systemProp.org.gradle.internal.publish.checksums.insecure=true

+ 19 - 2
mirai-core-api/build.gradle.kts

@@ -23,6 +23,14 @@ description = "Mirai API module"
 
 val isAndroidSDKAvailable: Boolean by project
 
+afterEvaluate {
+    tasks.getByName("compileKotlinCommon").enabled = false
+    tasks.getByName("compileTestKotlinCommon").enabled = false
+
+    tasks.getByName("compileCommonMainKotlinMetadata").enabled = false
+    tasks.getByName("compileKotlinMetadata").enabled = false
+}
+
 kotlin {
     explicitApi()
 
@@ -46,10 +54,18 @@ kotlin {
         )
     }
 
-    jvm {
-        withJava()
+    jvm("common") {
+        attributes.attribute(Attribute.of("mirai.target.platform", String::class.java), "common")
     }
 
+    jvm("jvm") {
+        attributes.attribute(Attribute.of("mirai.target.platform", String::class.java), "jvm")
+    }
+
+//    jvm("android") {
+//        attributes.attribute(Attribute.of("mirai.target.platform", String::class.java), "android")
+//    }
+
     sourceSets {
         val commonMain by getting {
             dependencies {
@@ -57,6 +73,7 @@ kotlin {
                 api(kotlin("reflect"))
 
                 api1(`kotlinx-serialization-core`)
+                api1(`kotlinx-serialization-json`)
                 implementation1(`kotlinx-serialization-protobuf`)
                 api1(`kotlinx-io`)
                 api1(`kotlinx-coroutines-io`)

+ 7 - 8
mirai-core-api/src/commonMain/kotlin/event/select.kt

@@ -18,8 +18,6 @@ import net.mamoe.mirai.message.data.PlainText
 import net.mamoe.mirai.message.isContextIdenticalWith
 import net.mamoe.mirai.message.nextMessage
 import net.mamoe.mirai.utils.MiraiExperimentalApi
-import kotlin.jvm.JvmName
-import kotlin.jvm.JvmSynthetic
 
 
 /**
@@ -463,14 +461,15 @@ internal suspend inline fun <R> withSilentTimeoutOrCoroutineScope(
 }
 
 @PublishedApi
-internal val SELECT_MESSAGE_STUB = Any()
+internal val SELECT_MESSAGE_STUB: Any = Any()
 
 @PublishedApi
-internal val ExceptionHandlerIgnoringCancellationException = CoroutineExceptionHandler { _, throwable ->
-    if (throwable !is CancellationException) {
-        throw throwable
+internal val ExceptionHandlerIgnoringCancellationException: CoroutineExceptionHandler =
+    CoroutineExceptionHandler { _, throwable ->
+        if (throwable !is CancellationException) {
+            throw throwable
+        }
     }
-}
 
 @PublishedApi
 @BuilderInference
@@ -582,7 +581,7 @@ internal suspend inline fun <reified T : MessageEvent> T.whileSelectMessagesImpl
     filterContext: Boolean,
     priority: Listener.EventPriority,
     crossinline selectBuilder: @MessageDsl MessageSelectBuilder<T, Boolean>.() -> Unit
-) = withSilentTimeoutOrCoroutineScope(timeoutMillis) {
+): Unit = withSilentTimeoutOrCoroutineScope(timeoutMillis) {
     var deferred: CompletableDeferred<Boolean>? = CompletableDeferred()
     coroutineContext[Job]!!.invokeOnCompletion {
         deferred?.cancel()

+ 0 - 4
mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt

@@ -13,15 +13,12 @@ package net.mamoe.mirai.utils
 
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.SupervisorJob
-import kotlinx.serialization.UnstableDefault
 import kotlinx.serialization.json.Json
 import net.mamoe.mirai.Bot
 import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol
 import kotlin.coroutines.CoroutineContext
 import kotlin.coroutines.EmptyCoroutineContext
 import kotlin.coroutines.coroutineContext
-import kotlin.jvm.JvmStatic
-import kotlin.jvm.JvmSynthetic
 
 /**
  * [Bot] 配置.
@@ -157,7 +154,6 @@ public open class BotConfigurationBase internal constructor() {
     @SinceMirai("1.1.0")
     @MiraiExperimentalApi
     public var json: Json = kotlin.runCatching {
-        @OptIn(UnstableDefault::class)
         Json {
             isLenient = true
             ignoreUnknownKeys = true

+ 3 - 3
mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt

@@ -11,10 +11,10 @@
 
 package net.mamoe.mirai.utils
 
+import kotlinx.atomicfu.AtomicBoolean
 import kotlinx.atomicfu.AtomicRef
 import kotlinx.atomicfu.atomic
 import kotlinx.atomicfu.loop
-import kotlin.jvm.JvmOverloads
 
 /**
  * Collect all the elements into a [MutableList] then cast it as a [List]
@@ -230,7 +230,7 @@ internal open class LockFreeLinkedList<E> {
     internal fun <E> LockFreeLinkedListNode<E>.compareAndSetNextNodeRef(
         expect: LockFreeLinkedListNode<E>,
         update: LockFreeLinkedListNode<E>
-    ) =
+    ): Boolean =
         this.nextNodeRef.compareAndSet(expect, update)
 
     override fun toString(): String = "[" + asSequence().joinToString() + "]"
@@ -812,7 +812,7 @@ internal open class LockFreeLinkedListNode<E>(
     open val nodeValue: E get() = initialNodeValue ?: error("Internal error: nodeValue is not initialized")
 
     @PublishedApi
-    internal val removed = atomic(false)
+    internal val removed: AtomicBoolean = atomic(false)
 
     @Suppress("LeakingThis")
     internal val nextNodeRef: AtomicRef<LockFreeLinkedListNode<E>> = atomic(nextNode ?: this)

+ 0 - 42
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt

@@ -1,42 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class BufferedInputStream : FilterInputStream {
-    public constructor(`in`: InputStream)
-    public constructor(`in`: InputStream, size: Int)
-
-    public open fun read(): Int
-    public open fun read(b: ByteArray, off: Int, len: Int): Int
-    public open fun skip(n: Long): Long
-    public open fun available(): Int
-    public open fun mark(readlimit: Int)
-    public open fun reset()
-    public open fun markSupported(): Boolean
-    public open fun close()
-}  

+ 0 - 37
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt

@@ -1,37 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class BufferedOutputStream : FilterOutputStream {
-    public constructor(out: OutputStream)
-    public constructor(out: OutputStream, size: Int)
-
-    public open fun write(b: Int)
-    public open fun write(b: ByteArray, off: Int, len: Int)
-    public open fun flush()
-}  

+ 0 - 45
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt

@@ -1,45 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class ByteArrayInputStream : InputStream {
-    public constructor(buf: ByteArray)
-    public constructor(buf: ByteArray, offset: Int, length: Int)
-
-    public open fun read(): Int
-    public open fun read(b: ByteArray, off: Int, len: Int): Int
-    public open fun readAllBytes(): ByteArray
-    public open fun readNBytes(b: ByteArray, off: Int, len: Int): Int
-    public open fun transferTo(out: OutputStream): Long
-    public open fun skip(n: Long): Long
-    public open fun available(): Int
-    public open fun markSupported(): Boolean
-    public open fun mark(readAheadLimit: Int)
-    public open fun reset()
-    public open fun close()
-}  

+ 0 - 25
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt

@@ -1,25 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch")
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect class ByteArrayOutputStream() : OutputStream {
-    public constructor(size: Int)
-
-    public override fun write(oneByte: Int)
-    public fun toByteArray(): ByteArray
-    public fun size(): Int
-}

+ 0 - 47
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt

@@ -1,47 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch")
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-import kotlinx.io.core.Closeable
-import kotlinx.io.errors.IOException
-
-
-/**
- * A [Closeable] is a source or destination of data that can be closed.
- * The close method is invoked to release resources that the object is
- * holding (such as open files).
- *
- * @since 1.5
- */
-public expect interface Closeable /* : AutoCloseable */ {
-    /**
-     * Closes this stream and releases any system resources associated
-     * with it. If the stream is already closed then invoking this
-     * method has no effect.
-     *
-     *
-     *  As noted in [AutoCloseable.close], cases where the
-     * close may fail require careful attention. It is strongly advised
-     * to relinquish the underlying resources and to internally
-     * *mark* the `Closeable` as closed, prior to throwing
-     * the `IOException`.
-     *
-     * @throws IOException if an I/O error occurs
-     */
-    @Throws(IOException::class)
-    public fun close()
-}

+ 0 - 45
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt

@@ -1,45 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open interface DataInput {
-    public open fun readFully(b: ByteArray)
-    public open fun readFully(b: ByteArray, off: Int, len: Int)
-    public open fun skipBytes(n: Int): Int
-    public open fun readBoolean(): Boolean
-    public open fun readByte(): Byte
-    public open fun readUnsignedByte(): Int
-    public open fun readShort(): Short
-    public open fun readUnsignedShort(): Int
-    public open fun readChar(): Char
-    public open fun readInt(): Int
-    public open fun readLong(): Long
-    public open fun readFloat(): Float
-    public open fun readDouble(): Double
-    public open fun readLine(): String
-    public open fun readUTF(): String
-}  

+ 0 - 44
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt

@@ -1,44 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open interface DataOutput {
-    public open fun write(b: Int)
-    public open fun write(b: ByteArray)
-    public open fun write(b: ByteArray, off: Int, len: Int)
-    public open fun writeBoolean(v: Boolean)
-    public open fun writeByte(v: Int)
-    public open fun writeShort(v: Int)
-    public open fun writeChar(v: Int)
-    public open fun writeInt(v: Int)
-    public open fun writeLong(v: Long)
-    public open fun writeFloat(v: Float)
-    public open fun writeDouble(v: Double)
-    public open fun writeBytes(s: String)
-    public open fun writeChars(s: String)
-    public open fun writeUTF(s: String)
-}  

+ 0 - 32
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt

@@ -1,32 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class EOFException : IOException {
-    public constructor()
-    public constructor(s: String)
-}

+ 0 - 98
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt

@@ -1,98 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-import kotlin.jvm.JvmStatic
-
-public expect class File : Serializable, Comparable<File> {
-    public constructor(parent: String, child: String)
-    public constructor(parent: File, child: String)
-    public constructor(uri: java.net.URI)
-
-    public open fun getName(): String
-    public open fun getParent(): String
-    public open fun getParentFile(): File
-    public open fun getPath(): String
-    public open fun isAbsolute(): Boolean
-    public open fun getAbsolutePath(): String
-    public open fun getAbsoluteFile(): File
-    public open fun getCanonicalPath(): String
-    public open fun getCanonicalFile(): File
-    public open fun toURL(): java.net.URL
-    public open fun toURI(): java.net.URI
-    public open fun canRead(): Boolean
-    public open fun canWrite(): Boolean
-    public open fun exists(): Boolean
-    public open fun isDirectory(): Boolean
-    public open fun isFile(): Boolean
-    public open fun isHidden(): Boolean
-    public open fun lastModified(): Long
-    public open fun length(): Long
-    public open fun createNewFile(): Boolean
-    public open fun delete(): Boolean
-    public open fun deleteOnExit()
-    public open fun list(): Array<String>?
-
-    //public open fun list(filter: FilenameFilter): Array<String>
-    public open fun listFiles(): Array<File>?
-
-    //public open fun listFiles(filter: FilenameFilter): Array<File>
-    //public open fun listFiles(filter: FileFilter): Array<File>
-    public open fun mkdir(): Boolean
-    public open fun mkdirs(): Boolean
-    public open fun renameTo(dest: File): Boolean
-    public open fun setLastModified(time: Long): Boolean
-    public open fun setReadOnly(): Boolean
-    public open fun setWritable(writable: Boolean, ownerOnly: Boolean): Boolean
-    public open fun setWritable(writable: Boolean): Boolean
-    public open fun setReadable(readable: Boolean, ownerOnly: Boolean): Boolean
-    public open fun setReadable(readable: Boolean): Boolean
-    public open fun setExecutable(executable: Boolean, ownerOnly: Boolean): Boolean
-    public open fun setExecutable(executable: Boolean): Boolean
-    public open fun canExecute(): Boolean
-    public open fun getTotalSpace(): Long
-    public open fun getFreeSpace(): Long
-    public open fun getUsableSpace(): Long
-    public open fun compareTo(pathname: File): Int
-    public open fun equals(obj: Any?): Boolean
-    public open fun hashCode(): Int
-    public open fun toString(): String
-    public open fun toPath(): java.nio.file.Path
-
-    public companion object {
-        @JvmStatic
-        public val separatorChar: Char
-
-        @JvmStatic
-        public val separator: String
-
-        @JvmStatic
-        public val pathSeparatorChar: Char
-
-        @JvmStatic
-        public val pathSeparator: String
-
-        @JvmStatic
-        public fun createTempFile(prefix: String, suffix: String): File
-    }
-}

+ 0 - 58
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt

@@ -1,58 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-import kotlin.jvm.JvmStatic
-
-public expect final class FileDescriptor {
-    public constructor()
-
-    public open fun set(fdo: FileDescriptor, fd: Int)
-    public open fun get(fdo: FileDescriptor): Int
-    public open fun setAppend(fdo: FileDescriptor, append: Boolean)
-    public open fun getAppend(fdo: FileDescriptor): Boolean
-    public open fun close(fdo: FileDescriptor)
-    public open fun registerCleanup(fdo: FileDescriptor)
-    public open fun unregisterCleanup(fdo: FileDescriptor)
-    public open fun setHandle(fdo: FileDescriptor, handle: Long)
-    public open fun getHandle(fdo: FileDescriptor): Long
-    public open fun valid(): Boolean
-    public open fun sync()
-
-    public companion object {
-        @JvmStatic
-        public val `in`: FileDescriptor
-
-        @JvmStatic
-        public val out: FileDescriptor
-
-        @JvmStatic
-        public val err: FileDescriptor
-    }
-}  

+ 0 - 45
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt

@@ -1,45 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class FileInputStream : InputStream {
-    public constructor(name: String)
-    public constructor(file: File)
-    public constructor(fdObj: FileDescriptor)
-
-    public open fun read(): Int
-    public open fun read(b: ByteArray): Int
-    public open fun read(b: ByteArray, off: Int, len: Int): Int
-    public open fun skip(n: Long): Long
-    public open fun available(): Int
-    public open fun close()
-    public final fun getFD(): FileDescriptor
-
-    //public open fun getChannel(): java.nio.channels.FileChannel
-    protected open fun finalize()
-}  

+ 0 - 45
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt

@@ -1,45 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class FileOutputStream : OutputStream {
-    public constructor(name: String)
-    public constructor(name: String, append: Boolean)
-    public constructor(file: File)
-    public constructor(file: File, append: Boolean)
-    public constructor(fdObj: FileDescriptor)
-
-    public open fun write(b: Int)
-    public open fun write(b: ByteArray)
-    public open fun write(b: ByteArray, off: Int, len: Int)
-    public open fun close()
-    public final fun getFD(): FileDescriptor
-
-    //public open fun getChannel(): java.nio.channels.FileChannel
-    protected final fun finalize()
-}  

+ 0 - 36
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt

@@ -1,36 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class FilterInputStream : InputStream {
-    public open fun read(): Int
-    public open fun read(b: ByteArray): Int
-    public open fun read(b: ByteArray, off: Int, len: Int): Int
-    public open fun skip(n: Long): Long
-    public open fun available(): Int
-    public open fun close()
-    public open fun mark(readlimit: Int)
-    public open fun reset()
-    public open fun markSupported(): Boolean
-}  

+ 0 - 32
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt

@@ -1,32 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class FilterOutputStream : OutputStream {
-    public open fun write(b: Int)
-    public open fun write(b: ByteArray)
-    public open fun write(b: ByteArray, off: Int, len: Int)
-    public open fun flush()
-    public open fun close()
-}  

+ 0 - 36
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt

@@ -1,36 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open class IOException : Exception {
-    public constructor()
-    public constructor(message: String)
-    public constructor(message: String, cause: Throwable)
-    public constructor(cause: Throwable)
-}  

+ 0 - 52
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt

@@ -1,52 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-import kotlin.jvm.JvmStatic
-
-public expect abstract class InputStream : Closeable {
-    public open fun available(): Int
-    public open fun read(): Int
-    public open fun read(b: ByteArray, off: Int, len: Int): Int
-    public open fun readAllBytes(): ByteArray
-    public open fun readNBytes(b: ByteArray, off: Int, len: Int): Int
-    public open fun readNBytes(len: Int): ByteArray
-    public open fun skip(n: Long): Long
-    public open fun close()
-    public open fun read(b: ByteArray): Int
-    public open fun mark(readlimit: Int)
-    public open fun reset()
-    public open fun markSupported(): Boolean
-
-    //public open fun transferTo(out: OutputStream): Long
-    public companion object {
-        @JvmStatic
-        public open fun nullInputStream(): InputStream
-    }
-}  

+ 0 - 36
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt

@@ -1,36 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect open interface ObjectInput : DataInput /*, AutoCloseable*/ {
-    public open fun readObject(): Any?
-    public open fun read(): Int
-    public open fun read(b: ByteArray): Int
-    public open fun read(b: ByteArray, off: Int, len: Int): Int
-    public open fun skip(n: Long): Long
-    public open fun available(): Int
-    public open fun close()
-}  

+ 0 - 27
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt

@@ -1,27 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch")
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-import kotlinx.io.core.Closeable
-
-public expect abstract class OutputStream : Closeable {
-    public override fun close()
-    public open fun flush()
-    public open fun write(buffer: ByteArray, offset: Int, count: Int)
-    public open fun write(buffer: ByteArray)
-    public abstract fun write(oneByte: Int)
-}

+ 0 - 25
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt

@@ -1,25 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.io
-
-public expect interface Serializable   

+ 0 - 46
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt

@@ -1,46 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-public expect open class Inet4Address : InetAddress {
-    public open fun isMulticastAddress(): Boolean
-    public open fun isAnyLocalAddress(): Boolean
-    public open fun isLoopbackAddress(): Boolean
-    public open fun isLinkLocalAddress(): Boolean
-    public open fun isSiteLocalAddress(): Boolean
-    public open fun isMCGlobal(): Boolean
-    public open fun isMCNodeLocal(): Boolean
-    public open fun isMCLinkLocal(): Boolean
-    public open fun isMCSiteLocal(): Boolean
-    public open fun isMCOrgLocal(): Boolean
-    public open fun getAddress(): ByteArray
-    public open fun getHostAddress(): String
-    public open fun hashCode(): Int
-    public open fun equals(obj: Any?): Boolean
-}  

+ 0 - 50
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt

@@ -1,50 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-public expect open class Inet6Address : InetAddress {
-    public open fun isMulticastAddress(): Boolean
-    public open fun isAnyLocalAddress(): Boolean
-    public open fun isLoopbackAddress(): Boolean
-    public open fun isLinkLocalAddress(): Boolean
-    public open fun isSiteLocalAddress(): Boolean
-    public open fun isMCGlobal(): Boolean
-    public open fun isMCNodeLocal(): Boolean
-    public open fun isMCLinkLocal(): Boolean
-    public open fun isMCSiteLocal(): Boolean
-    public open fun isMCOrgLocal(): Boolean
-    public open fun getAddress(): ByteArray
-    public open fun getScopeId(): Int
-
-    //public open fun getScopedInterface(): NetworkInterface
-    public open fun getHostAddress(): String
-    public open fun hashCode(): Int
-    public open fun equals(obj: Any?): Boolean
-    public open fun isIPv4CompatibleAddress(): Boolean
-}  

+ 0 - 81
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt

@@ -1,81 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import kotlin.jvm.JvmStatic
-
-public expect open class InetAddress : java.io.Serializable {
-    public constructor(hostsFileName: String)
-
-    public open fun run(): Nothing?
-    public open fun getOriginalHostName(ia: InetAddress): String
-    public open fun isMulticastAddress(): Boolean
-    public open fun isAnyLocalAddress(): Boolean
-    public open fun isLoopbackAddress(): Boolean
-    public open fun isLinkLocalAddress(): Boolean
-    public open fun isSiteLocalAddress(): Boolean
-    public open fun isMCGlobal(): Boolean
-    public open fun isMCNodeLocal(): Boolean
-    public open fun isMCLinkLocal(): Boolean
-    public open fun isMCSiteLocal(): Boolean
-    public open fun isMCOrgLocal(): Boolean
-    public open fun isReachable(timeout: Int): Boolean
-    public open fun getHostName(): String
-    public open fun getCanonicalHostName(): String
-    public open fun getAddress(): ByteArray
-    public open fun getHostAddress(): String
-    public open fun hashCode(): Int
-    public open fun equals(obj: Any?): Boolean
-    public open fun toString(): String
-    public open fun get(): Array<InetAddress>
-
-    //public open fun compareTo(other: CachedAddresses): Int
-    public open fun getHostByAddr(addr: ByteArray): String
-    public open fun lookupAllHostAddr(host: String): Array<InetAddress>
-
-    public companion object {
-        @JvmStatic
-        public open fun getByAddress(host: String, addr: ByteArray): InetAddress
-
-        @JvmStatic
-        public open fun getByName(host: String): InetAddress
-
-        @JvmStatic
-        public open fun getAllByName(host: String): Array<InetAddress>
-
-        @JvmStatic
-        public open fun getLoopbackAddress(): InetAddress
-
-        @JvmStatic
-        public open fun getByAddress(addr: ByteArray): InetAddress
-
-        @JvmStatic
-        public open fun getLocalHost(): InetAddress
-    }
-}  

+ 0 - 51
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt

@@ -1,51 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import kotlin.jvm.JvmStatic
-
-public expect open class InetSocketAddress : SocketAddress {
-    public constructor(port: Int)
-    public constructor(addr: InetAddress, port: Int)
-    public constructor(hostname: String, port: Int)
-
-    public final fun getPort(): Int
-    public final fun getAddress(): InetAddress
-    public final fun getHostName(): String
-    public final fun getHostString(): String
-    public final fun isUnresolved(): Boolean
-    public open fun toString(): String
-    public final fun equals(obj: Any?): Boolean
-    public final fun hashCode(): Int
-
-    public companion object {
-        @JvmStatic
-        public open fun createUnresolved(host: String, port: Int): InetSocketAddress
-    }
-}  

+ 0 - 38
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt

@@ -1,38 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import kotlin.jvm.JvmStatic
-
-public expect open class Proxy {
-    public open fun address(): SocketAddress
-    public open fun toString(): String
-    public final fun equals(obj: Any?): Boolean
-    public final fun hashCode(): Int
-
-    public companion object {
-        @JvmStatic
-        public val NO_PROXY: Proxy
-    }
-}  

+ 0 - 87
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt

@@ -1,87 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-public expect open class Socket : java.io.Closeable {
-    public constructor()
-    public constructor(proxy: Proxy)
-    public constructor(host: String, port: Int)
-    public constructor(address: InetAddress, port: Int)
-    public constructor(host: String, port: Int, stream: Boolean)
-    public constructor(host: InetAddress, port: Int, stream: Boolean)
-
-    public open fun connect(endpoint: SocketAddress)
-    public open fun connect(endpoint: SocketAddress, timeout: Int)
-    public open fun bind(bindpoint: SocketAddress)
-    public open fun getInetAddress(): InetAddress
-    public open fun getLocalAddress(): InetAddress
-    public open fun getPort(): Int
-    public open fun getLocalPort(): Int
-    public open fun getRemoteSocketAddress(): SocketAddress
-    public open fun getLocalSocketAddress(): SocketAddress
-
-    // public open fun getChannel(): java.nio.channels.SocketChannel
-    public open fun getInputStream(): java.io.InputStream
-    public open fun getOutputStream(): java.io.OutputStream
-    public open fun setTcpNoDelay(on: Boolean)
-    public open fun getTcpNoDelay(): Boolean
-    public open fun setSoLinger(on: Boolean, linger: Int)
-    public open fun getSoLinger(): Int
-    public open fun sendUrgentData(data: Int)
-    public open fun setOOBInline(on: Boolean)
-    public open fun getOOBInline(): Boolean
-    public open fun setSoTimeout(timeout: Int)
-    public open fun getSoTimeout(): Int
-    public open fun setSendBufferSize(size: Int)
-    public open fun getSendBufferSize(): Int
-    public open fun setReceiveBufferSize(size: Int)
-    public open fun getReceiveBufferSize(): Int
-    public open fun setKeepAlive(on: Boolean)
-    public open fun getKeepAlive(): Boolean
-    public open fun setTrafficClass(tc: Int)
-    public open fun getTrafficClass(): Int
-    public open fun setReuseAddress(on: Boolean)
-    public open fun getReuseAddress(): Boolean
-    public open fun close()
-    public open fun shutdownInput()
-    public open fun shutdownOutput()
-    public open fun toString(): String
-    public open fun isConnected(): Boolean
-    public open fun isBound(): Boolean
-    public open fun isClosed(): Boolean
-    public open fun isInputShutdown(): Boolean
-    public open fun isOutputShutdown(): Boolean
-    public open fun <T> setOption(name: SocketOption<T>, value: T): Socket
-    public open fun <T> getOption(name: SocketOption<T>): T
-    public open fun supportedOptions(): Set<SocketOption<*>>
-
-    public companion object {
-        //  @JvmStatic public open fun setSocketImplFactory(fac: SocketImplFactory)
-    }
-}  

+ 0 - 31
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt

@@ -1,31 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-public expect abstract class SocketAddress : java.io.Serializable   

+ 0 - 36
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt

@@ -1,36 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import java.io.IOException
-
-public expect open class SocketException : IOException {
-    public constructor(msg: String)
-    public constructor()
-}  

+ 0 - 34
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt

@@ -1,34 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-public expect open interface SocketOption<T> {
-    public open fun name(): String
-    // public open fun type(): Class<T>
-}  

+ 0 - 34
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt

@@ -1,34 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT",
-    "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-public expect open interface SocketOptions {
-    public open fun setOption(optID: Int, value: Any?)
-    public open fun getOption(optID: Int): Any?
-}  

+ 0 - 67
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt

@@ -1,67 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import java.io.Serializable
-import kotlin.jvm.JvmStatic
-
-public expect class URI : Comparable<URI>, Serializable {
-    public constructor(str: String)
-    public constructor(scheme: String, host: String, path: String, fragment: String)
-    public constructor(scheme: String, ssp: String, fragment: String)
-
-    public open fun parseServerAuthority(): URI
-    public open fun normalize(): URI
-    public open fun resolve(uri: URI): URI
-    public open fun resolve(str: String): URI
-    public open fun relativize(uri: URI): URI
-    public open fun toURL(): URL
-    public open fun getScheme(): String
-    public open fun isAbsolute(): Boolean
-    public open fun isOpaque(): Boolean
-    public open fun getRawSchemeSpecificPart(): String
-    public open fun getSchemeSpecificPart(): String
-    public open fun getRawAuthority(): String
-    public open fun getAuthority(): String
-    public open fun getRawUserInfo(): String
-    public open fun getUserInfo(): String
-    public open fun getHost(): String
-    public open fun getPort(): Int
-    public open fun getRawPath(): String
-    public open fun getPath(): String
-    public open fun getRawQuery(): String
-    public open fun getQuery(): String
-    public open fun getRawFragment(): String
-    public open fun getFragment(): String
-    public open fun equals(ob: Any?): Boolean
-    public open fun hashCode(): Int
-    public open fun compareTo(that: URI): Int
-    public open fun toString(): String
-    public open fun toASCIIString(): String
-    public open fun create(scheme: String, path: String): URI
-
-    public companion object {
-        @JvmStatic
-        public fun create(str: String): URI
-    }
-}  

+ 0 - 65
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt

@@ -1,65 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import java.io.Serializable
-
-public expect class URL : Serializable {
-    public constructor(protocol: String, host: String, port: Int, file: String)
-    public constructor(protocol: String, host: String, file: String)
-    public constructor(spec: String)
-    public constructor(context: URL, spec: String)
-
-    //public constructor(context: URL, spec: String, handler: URLStreamHandler)
-    public open fun getQuery(): String
-    public open fun getPath(): String
-    public open fun getUserInfo(): String
-    public open fun getAuthority(): String
-    public open fun getPort(): Int
-    public open fun getDefaultPort(): Int
-    public open fun getProtocol(): String
-    public open fun getHost(): String
-    public open fun getFile(): String
-    public open fun getRef(): String
-    public open fun equals(obj: Any?): Boolean
-    public open fun hashCode(): Int
-    public open fun sameFile(other: URL): Boolean
-    public open fun toString(): String
-    public open fun toExternalForm(): String
-    public open fun toURI(): URI
-    public open fun openConnection(): URLConnection
-    public open fun openConnection(proxy: Proxy): URLConnection
-    public fun openStream(): java.io.InputStream
-    public fun getContent(): Any?
-
-    //public final fun getContent(classes: Array<Class<?>>): Any?
-    //public open fun createURLStreamHandler(protocol: String): URLStreamHandler
-    public open fun hasNext(): Boolean
-
-    //public open fun next(): java.net.spi.URLStreamHandlerProvider
-    //public open fun run(): URLStreamHandler
-    //public open fun getHandler(u: URL): URLStreamHandler
-    public companion object {
-        //@JvmStatic public open fun setURLStreamHandlerFactory(fac: URLStreamHandlerFactory)
-    }
-}  

+ 0 - 107
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt

@@ -1,107 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "NON_FINAL_MEMBER_IN_OBJECT", "ConvertSecondaryConstructorToPrimary"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.net
-
-import kotlin.jvm.JvmStatic
-
-public expect abstract class URLConnection {
-    protected constructor(url: URL)
-
-    public open fun getContentTypeFor(fileName: String): String
-    public abstract fun connect()
-    public open fun setConnectTimeout(timeout: Int)
-    public open fun getConnectTimeout(): Int
-    public open fun setReadTimeout(timeout: Int)
-    public open fun getReadTimeout(): Int
-    public open fun getURL(): URL
-    public open fun getContentLength(): Int
-    public open fun getContentLengthLong(): Long
-    public open fun getContentType(): String
-    public open fun getContentEncoding(): String
-    public open fun getExpiration(): Long
-    public open fun getDate(): Long
-    public open fun getLastModified(): Long
-    public open fun getHeaderField(name: String): String
-    public open fun getHeaderFields(): Map<String, List<String>>
-    public open fun getHeaderFieldInt(name: String, Default: Int): Int
-    public open fun getHeaderFieldLong(name: String, Default: Long): Long
-    public open fun getHeaderFieldDate(name: String, Default: Long): Long
-    public open fun getHeaderFieldKey(n: Int): String
-    public open fun getHeaderField(n: Int): String
-    public open fun getContent(): Any?
-
-    //public open fun getContent(classes: Array<Class<?>>): Any?
-    //public open fun getPermission(): java.security.Permission
-    public open fun getInputStream(): java.io.InputStream
-    public open fun getOutputStream(): java.io.OutputStream
-    public open fun toString(): String
-    public open fun setDoInput(doinput: Boolean)
-    public open fun getDoInput(): Boolean
-    public open fun setDoOutput(dooutput: Boolean)
-    public open fun getDoOutput(): Boolean
-    public open fun setAllowUserInteraction(allowuserinteraction: Boolean)
-    public open fun getAllowUserInteraction(): Boolean
-    public open fun setUseCaches(usecaches: Boolean)
-    public open fun getUseCaches(): Boolean
-    public open fun setIfModifiedSince(ifmodifiedsince: Long)
-    public open fun getIfModifiedSince(): Long
-    public open fun getDefaultUseCaches(): Boolean
-    public open fun setDefaultUseCaches(defaultusecaches: Boolean)
-    public open fun setRequestProperty(key: String, value: String)
-    public open fun addRequestProperty(key: String, value: String)
-    public open fun getRequestProperty(key: String): String
-    public open fun getRequestProperties(): Map<String, List<String>>
-
-    //public open fun run(): ContentHandler
-    public open fun getContent(uc: URLConnection): Any?
-
-    public companion object {
-        //@JvmStatic public open fun getFileNameMap(): FileNameMap
-        //@JvmStatic public open fun setFileNameMap(map: FileNameMap)
-        @JvmStatic
-        public open fun setDefaultAllowUserInteraction(defaultallowuserinteraction: Boolean)
-
-        @JvmStatic
-        public open fun getDefaultAllowUserInteraction(): Boolean
-
-        @JvmStatic
-        public open fun setDefaultUseCaches(protocol: String, defaultVal: Boolean)
-
-        @JvmStatic
-        public open fun getDefaultUseCaches(protocol: String): Boolean
-
-        @JvmStatic
-        public open fun setDefaultRequestProperty(key: String, value: String)
-
-        @JvmStatic
-        public open fun getDefaultRequestProperty(key: String): String
-
-        //@JvmStatic public open fun setContentHandlerFactory(fac: ContentHandlerFactory)
-        @JvmStatic
-        public open fun guessContentTypeFromName(fname: String): String
-
-        @JvmStatic
-        public open fun guessContentTypeFromStream(`is`: java.io.InputStream): String
-    }
-}  

+ 0 - 532
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt

@@ -1,532 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch")
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio
-
-/**
- * A container for data of a specific primitive type.
- *
- *
- *  A buffer is a linear, finite sequence of elements of a specific
- * primitive type.  Aside from its content, the essential properties of a
- * buffer are its capacity, limit, and position:
- *
- * <blockquote>
- *
- *
- *  A buffer's *capacity* is the number of elements it contains.  The
- * capacity of a buffer is never negative and never changes.
- *
- *
- *  A buffer's *limit* is the index of the first element that should
- * not be read or written.  A buffer's limit is never negative and is never
- * greater than its capacity.
- *
- *
- *  A buffer's *position* is the index of the next element to be
- * read or written.  A buffer's position is never negative and is never
- * greater than its limit.
- *
-</blockquote> *
- *
- *
- *  There is one subclass of this class for each non-boolean primitive type.
- *
- *
- * <h2> Transferring data </h2>
- *
- *
- *  Each subclass of this class defines two categories of *get* and
- * *put* operations:
- *
- * <blockquote>
- *
- *
- *  *Relative* operations read or write one or more elements starting
- * at the current position and then increment the position by the number of
- * elements transferred.  If the requested transfer exceeds the limit then a
- * relative *get* operation throws a [BufferUnderflowException]
- * and a relative *put* operation throws a [   ]; in either case, no data is transferred.
- *
- *
- *  *Absolute* operations take an explicit element index and do not
- * affect the position.  Absolute *get* and *put* operations throw
- * an [IndexOutOfBoundsException] if the index argument exceeds the
- * limit.
- *
-</blockquote> *
- *
- *
- *  Data may also, of course, be transferred in to or out of a buffer by the
- * I/O operations of an appropriate channel, which are always relative to the
- * current position.
- *
- *
- * <h2> Marking and resetting </h2>
- *
- *
- *  A buffer's *mark* is the index to which its position will be reset
- * when the [reset][.reset] method is invoked.  The mark is not always
- * defined, but when it is defined it is never negative and is never greater
- * than the position.  If the mark is defined then it is discarded when the
- * position or the limit is adjusted to a value smaller than the mark.  If the
- * mark is not defined then invoking the [reset][.reset] method causes an
- * [InvalidMarkException] to be thrown.
- *
- *
- * <h2> Invariants </h2>
- *
- *
- *  The following invariant holds for the mark, position, limit, and
- * capacity values:
- *
- * <blockquote>
- * `0` `<=`
- * *mark* `<=`
- * *position* `<=`
- * *limit* `<=`
- * *capacity*
-</blockquote> *
- *
- *
- *  A newly-created buffer always has a position of zero and a mark that is
- * undefined.  The initial limit may be zero, or it may be some other value
- * that depends upon the type of the buffer and the manner in which it is
- * constructed.  Each element of a newly-allocated buffer is initialized
- * to zero.
- *
- *
- * <h2> Additional operations </h2>
- *
- *
- *  In addition to methods for accessing the position, limit, and capacity
- * values and for marking and resetting, this class also defines the following
- * operations upon buffers:
- *
- *
- *
- *  *
- *
- * [.clear] makes a buffer ready for a new sequence of
- * channel-read or relative *put* operations: It sets the limit to the
- * capacity and the position to zero.
- *
- *  *
- *
- * [.flip] makes a buffer ready for a new sequence of
- * channel-write or relative *get* operations: It sets the limit to the
- * current position and then sets the position to zero.
- *
- *  *
- *
- * [.rewind] makes a buffer ready for re-reading the data that
- * it already contains: It leaves the limit unchanged and sets the position
- * to zero.
- *
- *  *
- *
- * The [.slice] and [slice(index,length)][.slice]
- * methods create a subsequence of a buffer: They leave the limit and the
- * position unchanged.
- *
- *  *
- *
- * [.duplicate] creates a shallow copy of a buffer: It leaves
- * the limit and the position unchanged.
- *
- *
- *
- *
- * <h2> Read-only buffers </h2>
- *
- *
- *  Every buffer is readable, but not every buffer is writable.  The
- * mutation methods of each buffer class are specified as *optional
- * operations* that will throw a [ReadOnlyBufferException] when
- * invoked upon a read-only buffer.  A read-only buffer does not allow its
- * content to be changed, but its mark, position, and limit values are mutable.
- * Whether or not a buffer is read-only may be determined by invoking its
- * [isReadOnly][.isReadOnly] method.
- *
- *
- * <h2> Thread safety </h2>
- *
- *
- *  Buffers are not safe for use by multiple concurrent threads.  If a
- * buffer is to be used by more than one thread then access to the buffer
- * should be controlled by appropriate synchronization.
- *
- *
- * <h2> Invocation chaining </h2>
- *
- *
- *  Methods in this class that do not otherwise have a value to return are
- * specified to return the buffer upon which they are invoked.  This allows
- * method invocations to be chained; for example, the sequence of statements
- *
- * <blockquote><pre>
- * b.flip();
- * b.position(23);
- * b.limit(42);</pre></blockquote>
- *
- * can be replaced by the single, more compact statement
- *
- * <blockquote><pre>
- * b.flip().position(23).limit(42);</pre></blockquote>
- *
- *
- * @author Mark Reinhold
- * @author JSR-51 Expert Group
- * @since 1.4
- */
-public expect abstract class Buffer internal constructor(mark: Int, pos: Int, lim: Int, cap: Int) {
-    public var address: Long
-
-    /**
-     * Returns this buffer's capacity.
-     *
-     * @return  The capacity of this buffer
-     */
-    public fun capacity(): Int
-
-    /**
-     * Returns this buffer's position.
-     *
-     * @return  The position of this buffer
-     */
-    public fun position(): Int
-
-    /**
-     * Sets this buffer's position.  If the mark is defined and larger than the
-     * new position then it is discarded.
-     *
-     * @param  newPosition
-     * The new position value; must be non-negative
-     * and no larger than the current limit
-     *
-     * @return  This buffer
-     *
-     * @throws  IllegalArgumentException
-     * If the preconditions on `newPosition` do not hold
-     */
-    public fun position(newPosition: Int): Buffer
-
-    /**
-     * Returns this buffer's limit.
-     *
-     * @return  The limit of this buffer
-     */
-    public fun limit(): Int
-
-    /**
-     * Sets this buffer's limit.  If the position is larger than the new limit
-     * then it is set to the new limit.  If the mark is defined and larger than
-     * the new limit then it is discarded.
-     *
-     * @param  newLimit
-     * The new limit value; must be non-negative
-     * and no larger than this buffer's capacity
-     *
-     * @return  This buffer
-     *
-     * @throws  IllegalArgumentException
-     * If the preconditions on `newLimit` do not hold
-     */
-    public fun limit(newLimit: Int): Buffer
-
-    /**
-     * Verify that `0 < newLimit <= capacity`
-     *
-     * @param newLimit
-     * The new limit value
-     *
-     * @throws IllegalArgumentException
-     * If the specified limit is out of bounds.
-     */
-    public fun createLimitException(newLimit: Int): IllegalArgumentException
-
-    /**
-     * Sets this buffer's mark at its position.
-     *
-     * @return  This buffer
-     */
-    public fun mark(): Buffer
-
-    /**
-     * Resets this buffer's position to the previously-marked position.
-     *
-     *
-     *  Invoking this method neither changes nor discards the mark's
-     * value.
-     *
-     * @return  This buffer
-     *
-     * @throws  InvalidMarkException
-     * If the mark has not been set
-     */
-    public fun reset(): Buffer
-
-    /**
-     * Clears this buffer.  The position is set to zero, the limit is set to
-     * the capacity, and the mark is discarded.
-     *
-     *
-     *  Invoke this method before using a sequence of channel-read or
-     * *put* operations to fill this buffer.  For example:
-     *
-     * <blockquote><pre>
-     * buf.clear();     // Prepare buffer for reading
-     * in.read(buf);    // Read data</pre></blockquote>
-     *
-     *
-     *  This method does not actually erase the data in the buffer, but it
-     * is named as if it did because it will most often be used in situations
-     * in which that might as well be the case.
-     *
-     * @return  This buffer
-     */
-    public fun clear(): Buffer
-
-    /**
-     * Flips this buffer.  The limit is set to the current position and then
-     * the position is set to zero.  If the mark is defined then it is
-     * discarded.
-     *
-     *
-     *  After a sequence of channel-read or *put* operations, invoke
-     * this method to prepare for a sequence of channel-write or relative
-     * *get* operations.  For example:
-     *
-     * <blockquote><pre>
-     * buf.put(magic);    // Prepend header
-     * in.read(buf);      // Read data into rest of buffer
-     * buf.flip();        // Flip buffer
-     * out.write(buf);    // Write header + data to channel</pre></blockquote>
-     *
-     *
-     *  This method is often used in conjunction with the [ ][java.nio.ByteBuffer.compact] method when transferring data from
-     * one place to another.
-     *
-     * @return  This buffer
-     */
-    public fun flip(): Buffer
-
-    /**
-     * Rewinds this buffer.  The position is set to zero and the mark is
-     * discarded.
-     *
-     *
-     *  Invoke this method before a sequence of channel-write or *get*
-     * operations, assuming that the limit has already been set
-     * appropriately.  For example:
-     *
-     * <blockquote><pre>
-     * out.write(buf);    // Write remaining data
-     * buf.rewind();      // Rewind buffer
-     * buf.get(array);    // Copy data into array</pre></blockquote>
-     *
-     * @return  This buffer
-     */
-    public fun rewind(): Buffer
-
-    /**
-     * Returns the number of elements between the current position and the
-     * limit.
-     *
-     * @return  The number of elements remaining in this buffer
-     */
-    public fun remaining(): Int
-
-    /**
-     * Tells whether there are any elements between the current position and
-     * the limit.
-     *
-     * @return  `true` if, and only if, there is at least one element
-     * remaining in this buffer
-     */
-    public fun hasRemaining(): Boolean
-
-    /**
-     * Tells whether or not this buffer is read-only.
-     *
-     * @return  `true` if, and only if, this buffer is read-only
-     */
-    public abstract val isReadOnly: Boolean
-
-    /**
-     * Tells whether or not this buffer is backed by an accessible
-     * array.
-     *
-     *
-     *  If this method returns `true` then the [array][.array]
-     * and [arrayOffset][.arrayOffset] methods may safely be invoked.
-     *
-     *
-     * @return  `true` if, and only if, this buffer
-     * is backed by an array and is not read-only
-     *
-     * @since 1.6
-     */
-    public abstract fun hasArray(): Boolean
-
-    /**
-     * Returns the array that backs this
-     * buffer&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  This method is intended to allow array-backed buffers to be
-     * passed to native code more efficiently. Concrete subclasses
-     * provide more strongly-typed return values for this method.
-     *
-     *
-     *  Modifications to this buffer's content will cause the returned
-     * array's content to be modified, and vice versa.
-     *
-     *
-     *  Invoke the [hasArray][.hasArray] method before invoking this
-     * method in order to ensure that this buffer has an accessible backing
-     * array.
-     *
-     * @return  The array that backs this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is backed by an array but is read-only
-     *
-     * @throws  UnsupportedOperationException
-     * If this buffer is not backed by an accessible array
-     *
-     * @since 1.6
-     */
-    public abstract fun array(): ByteArray
-
-    /**
-     * Returns the offset within this buffer's backing array of the first
-     * element of the buffer&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  If this buffer is backed by an array then buffer position *p*
-     * corresponds to array index *p*&nbsp;+&nbsp;`arrayOffset()`.
-     *
-     *
-     *  Invoke the [hasArray][.hasArray] method before invoking this
-     * method in order to ensure that this buffer has an accessible backing
-     * array.
-     *
-     * @return  The offset within this buffer's array
-     * of the first element of the buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is backed by an array but is read-only
-     *
-     * @throws  UnsupportedOperationException
-     * If this buffer is not backed by an accessible array
-     *
-     * @since 1.6
-     */
-    public abstract fun arrayOffset(): Int
-
-    /**
-     * Tells whether or not this buffer is
-     * [*direct*](ByteBuffer.html#direct).
-     *
-     * @return  `true` if, and only if, this buffer is direct
-     *
-     * @since 1.6
-     */
-    public abstract val isDirect: Boolean
-
-    /*
-    /**
-     * Creates a new buffer whose content is a shared subsequence of
-     * this buffer's content.
-     *
-     *
-     *  The content of the new buffer will start at this buffer's current
-     * position.  Changes to this buffer's content will be visible in the new
-     * buffer, and vice versa; the two buffers' position, limit, and mark
-     * values will be independent.
-     *
-     *
-     *  The new buffer's position will be zero, its capacity and its limit
-     * will be the number of elements remaining in this buffer, its mark will be
-     * undefined. The new buffer will be direct if, and only if, this buffer is
-     * direct, and it will be read-only if, and only if, this buffer is
-     * read-only.
-     *
-     * @return  The new buffer
-     *
-     * @since 9
-     */
-    public abstract fun slice(): Buffer?
-
-    /**
-     * Creates a new buffer whose content is a shared subsequence of
-     * this buffer's content.
-     *
-     *
-     *  The content of the new buffer will start at position `index`
-     * in this buffer, and will contain `length` elements. Changes to
-     * this buffer's content will be visible in the new buffer, and vice versa;
-     * the two buffers' position, limit, and mark values will be independent.
-     *
-     *
-     *  The new buffer's position will be zero, its capacity and its limit
-     * will be `length`, its mark will be undefined. The new buffer will
-     * be direct if, and only if, this buffer is direct, and it will be
-     * read-only if, and only if, this buffer is read-only.
-     *
-     * @param   index
-     * The position in this buffer at which the content of the new
-     * buffer will start; must be non-negative and no larger than
-     * [limit()][.limit]
-     *
-     * @param   length
-     * The number of elements the new buffer will contain; must be
-     * non-negative and no larger than `limit() - index`
-     *
-     * @return  The new buffer
-     *
-     * @throws  IndexOutOfBoundsException
-     * If `index` is negative or greater than `limit()`,
-     * `length` is negative, or `length > limit() - index`
-     *
-     * @since 13
-     */
-    public abstract fun slice(index: Int, length: Int): Buffer?
-
-    /**
-     * Creates a new buffer that shares this buffer's content.
-     *
-     *
-     *  The content of the new buffer will be that of this buffer.  Changes
-     * to this buffer's content will be visible in the new buffer, and vice
-     * versa; the two buffers' position, limit, and mark values will be
-     * independent.
-     *
-     *
-     *  The new buffer's capacity, limit, position and mark values will be
-     * identical to those of this buffer. The new buffer will be direct if, and
-     * only if, this buffer is direct, and it will be read-only if, and only if,
-     * this buffer is read-only.
-     *
-     * @return  The new buffer
-     *
-     * @since 9
-     */
-    public abstract fun duplicate(): Buffer?
-
-     */
-}

+ 0 - 725
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt

@@ -1,725 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch")
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio
-
-import kotlin.jvm.JvmOverloads
-import kotlin.jvm.JvmStatic
-
-
-/**
- * A byte buffer.
- *
- *
- *  This class defines six categories of operations upon
- * byte buffers:
- *
- *
- *
- *  *
- *
- * Absolute and relative [&lt;i&gt;get&lt;/i&gt;][.get] and
- * [&lt;i&gt;put&lt;/i&gt;][.put] methods that read and write
- * single bytes;
- *
- *  *
- *
- * Absolute and relative [&lt;i&gt;bulk get&lt;/i&gt;][.get]
- * methods that transfer contiguous sequences of bytes from this buffer
- * into an array;
- *
- *  *
- *
- * Absolute and relative [&lt;i&gt;bulk put&lt;/i&gt;][.put]
- * methods that transfer contiguous sequences of bytes from a
- * byte array or some other byte
- * buffer into this buffer;
- *
- *
- *
- *  *
- *
- * Absolute and relative [&lt;i&gt;get&lt;/i&gt;][.getChar]
- * and [&lt;i&gt;put&lt;/i&gt;][.putChar] methods that read and
- * write values of other primitive types, translating them to and from
- * sequences of bytes in a particular byte order;
- *
- *  *
- *
- * Methods for creating *[view buffers](#views)*,
- * which allow a byte buffer to be viewed as a buffer containing values of
- * some other primitive type; and
- *
- *
- *
- *  *
- *
- * A method for [compacting][.compact]
- * a byte buffer.
- *
- *
- *
- *
- *  Byte buffers can be created either by [ &lt;i&gt;allocation&lt;/i&gt;][.allocate], which allocates space for the buffer's
- *
- *
- *
- * content, or by [&lt;i&gt;wrapping&lt;/i&gt;][.wrap] an
- * existing byte array  into a buffer.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * <a id="direct"></a>
- * <h2> Direct *vs.* non-direct buffers </h2>
- *
- *
- *  A byte buffer is either *direct* or *non-direct*.  Given a
- * direct byte buffer, the Java virtual machine will make a best effort to
- * perform native I/O operations directly upon it.  That is, it will attempt to
- * avoid copying the buffer's content to (or from) an intermediate buffer
- * before (or after) each invocation of one of the underlying operating
- * system's native I/O operations.
- *
- *
- *  A direct byte buffer may be created by invoking the [ ][.allocateDirect] factory method of this class.  The
- * buffers returned by this method typically have somewhat higher allocation
- * and deallocation costs than non-direct buffers.  The contents of direct
- * buffers may reside outside of the normal garbage-collected heap, and so
- * their impact upon the memory footprint of an application might not be
- * obvious.  It is therefore recommended that direct buffers be allocated
- * primarily for large, long-lived buffers that are subject to the underlying
- * system's native I/O operations.  In general it is best to allocate direct
- * buffers only when they yield a measureable gain in program performance.
- *
- *
- *  A direct byte buffer may also be created by [ ][java.nio.channels.FileChannel.map] a region of a file
- * directly into memory.  An implementation of the Java platform may optionally
- * support the creation of direct byte buffers from native code via JNI.  If an
- * instance of one of these kinds of buffers refers to an inaccessible region
- * of memory then an attempt to access that region will not change the buffer's
- * content and will cause an unspecified exception to be thrown either at the
- * time of the access or at some later time.
- *
- *
- *  Whether a byte buffer is direct or non-direct may be determined by
- * invoking its [isDirect][.isDirect] method.  This method is provided so
- * that explicit buffer management can be done in performance-critical code.
- *
- *
- * <a id="bin"></a>
- * <h2> Access to binary data </h2>
- *
- *
- *  This class defines methods for reading and writing values of all other
- * primitive types, except `boolean`.  Primitive values are translated
- * to (or from) sequences of bytes according to the buffer's current byte
- * order, which may be retrieved and modified via the [order][.order]
- * methods.  Specific byte orders are represented by instances of the [ ] class.  The initial order of a byte buffer is always [ ][ByteOrder.BIG_ENDIAN].
- *
- *
- *  For access to heterogeneous binary data, that is, sequences of values of
- * different types, this class defines a family of absolute and relative
- * *get* and *put* methods for each type.  For 32-bit floating-point
- * values, for example, this class defines:
- *
- * <blockquote><pre>
- * float  [.getFloat]
- * float  [getFloat(int index)][.getFloat]
- * void  [putFloat(float f)][.putFloat]
- * void  [putFloat(int index, float f)][.putFloat]</pre></blockquote>
- *
- *
- *  Corresponding methods are defined for the types `char,
- * short, int, long`, and `double`.  The index
- * parameters of the absolute *get* and *put* methods are in terms of
- * bytes rather than of the type being read or written.
- *
- * <a id="views"></a>
- *
- *
- *  For access to homogeneous binary data, that is, sequences of values of
- * the same type, this class defines methods that can create *views* of a
- * given byte buffer.  A *view buffer* is simply another buffer whose
- * content is backed by the byte buffer.  Changes to the byte buffer's content
- * will be visible in the view buffer, and vice versa; the two buffers'
- * position, limit, and mark values are independent.  The [ ][.asFloatBuffer] method, for example, creates an instance of
- * the [FloatBuffer] class that is backed by the byte buffer upon which
- * the method is invoked.  Corresponding view-creation methods are defined for
- * the types `char, short, int, long`, and `double`.
- *
- *
- *  View buffers have three important advantages over the families of
- * type-specific *get* and *put* methods described above:
- *
- *
- *
- *  *
- *
- * A view buffer is indexed not in terms of bytes but rather in terms
- * of the type-specific size of its values;
- *
- *  *
- *
- * A view buffer provides relative bulk *get* and *put*
- * methods that can transfer contiguous sequences of values between a buffer
- * and an array or some other buffer of the same type; and
- *
- *  *
- *
- * A view buffer is potentially much more efficient because it will
- * be direct if, and only if, its backing byte buffer is direct.
- *
- *
- *
- *
- *  The byte order of a view buffer is fixed to be that of its byte buffer
- * at the time that the view is created.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * <h2> Invocation chaining </h2>
- *
- *
- *
- *  Methods in this class that do not otherwise have a value to return are
- * specified to return the buffer upon which they are invoked.  This allows
- * method invocations to be chained.
- *
- *
- *
- * The sequence of statements
- *
- * <blockquote><pre>
- * bb.putInt(0xCAFEBABE);
- * bb.putShort(3);
- * bb.putShort(45);</pre></blockquote>
- *
- * can, for example, be replaced by the single statement
- *
- * <blockquote><pre>
- * bb.putInt(0xCAFEBABE).putShort(3).putShort(45);</pre></blockquote>
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * @author Mark Reinhold
- * @author JSR-51 Expert Group
- * @since 1.4
- */
-public expect abstract class ByteBuffer @JvmOverloads internal constructor(
-    mark: Int, pos: Int, lim: Int, cap: Int,  // package-private
-    hb: ByteArray? = null, offset: Int = 0
-) : Buffer, Comparable<ByteBuffer?> {
-    /**
-     * Creates a new, read-only byte buffer that shares this buffer's
-     * content.
-     *
-     *
-     *  The content of the new buffer will be that of this buffer.  Changes
-     * to this buffer's content will be visible in the new buffer; the new
-     * buffer itself, however, will be read-only and will not allow the shared
-     * content to be modified.  The two buffers' position, limit, and mark
-     * values will be independent.
-     *
-     *
-     *  The new buffer's capacity, limit, position,
-     *
-     * and mark values will be identical to those of this buffer, and its byte
-     * order will be [BIG_ENDIAN][ByteOrder.BIG_ENDIAN].
-     *
-     *
-     *
-     *
-     *
-     *  If this buffer is itself read-only then this method behaves in
-     * exactly the same way as the [duplicate][.duplicate] method.
-     *
-     * @return  The new, read-only byte buffer
-     */
-    public abstract fun asReadOnlyBuffer(): ByteBuffer?
-    // -- Singleton get/put methods --
-    /**
-     * Relative *get* method.  Reads the byte at this buffer's
-     * current position, and then increments the position.
-     *
-     * @return  The byte at the buffer's current position
-     *
-     * @throws  BufferUnderflowException
-     * If the buffer's current position is not smaller than its limit
-     */
-    public abstract fun get(): Byte
-
-    /**
-     * Relative *put* method&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  Writes the given byte into this buffer at the current
-     * position, and then increments the position.
-     *
-     * @param  b
-     * The byte to be written
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If this buffer's current position is not smaller than its limit
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public abstract fun put(b: Byte): ByteBuffer
-
-    /**
-     * Modifies this buffer's byte order.
-     *
-     * @param  bo
-     * The new byte order,
-     * either [BIG_ENDIAN][ByteOrder.BIG_ENDIAN]
-     * or [LITTLE_ENDIAN][ByteOrder.LITTLE_ENDIAN]
-     *
-     * @return  This buffer
-     */
-    public fun order(bo: java.nio.ByteOrder): ByteBuffer
-
-    /**
-     * Absolute *get* method.  Reads the byte at the given
-     * index.
-     *
-     * @param  index
-     * The index from which the byte will be read
-     *
-     * @return  The byte at the given index
-     *
-     * @throws  IndexOutOfBoundsException
-     * If `index` is negative
-     * or not smaller than the buffer's limit
-     */
-    public abstract operator fun get(index: Int): Byte
-
-    /**
-     * Absolute *put* method&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  Writes the given byte into this buffer at the given
-     * index.
-     *
-     * @param  index
-     * The index at which the byte will be written
-     *
-     * @param  b
-     * The byte value to be written
-     *
-     * @return  This buffer
-     *
-     * @throws  IndexOutOfBoundsException
-     * If `index` is negative
-     * or not smaller than the buffer's limit
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public abstract fun put(index: Int, b: Byte): ByteBuffer?
-    // -- Bulk get operations --
-    /**
-     * Relative bulk *get* method.
-     *
-     *
-     *  This method transfers bytes from this buffer into the given
-     * destination array.  If there are fewer bytes remaining in the
-     * buffer than are required to satisfy the request, that is, if
-     * `length`&nbsp;`>`&nbsp;`remaining()`, then no
-     * bytes are transferred and a [BufferUnderflowException] is
-     * thrown.
-     *
-     *
-     *  Otherwise, this method copies `length` bytes from this
-     * buffer into the given array, starting at the current position of this
-     * buffer and at the given offset in the array.  The position of this
-     * buffer is then incremented by `length`.
-     *
-     *
-     *  In other words, an invocation of this method of the form
-     * `src.get(dst,&nbsp;off,&nbsp;len)` has exactly the same effect as
-     * the loop
-     *
-     * <pre>`for (int i = off; i < off + len; i++)
-     * dst[i] = src.get();
-    `</pre> *
-     *
-     * except that it first checks that there are sufficient bytes in
-     * this buffer and it is potentially much more efficient.
-     *
-     * @param  dst
-     * The array into which bytes are to be written
-     *
-     * @param  offset
-     * The offset within the array of the first byte to be
-     * written; must be non-negative and no larger than
-     * `dst.length`
-     *
-     * @param  length
-     * The maximum number of bytes to be written to the given
-     * array; must be non-negative and no larger than
-     * `dst.length - offset`
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferUnderflowException
-     * If there are fewer than `length` bytes
-     * remaining in this buffer
-     *
-     * @throws  IndexOutOfBoundsException
-     * If the preconditions on the `offset` and `length`
-     * parameters do not hold
-     */
-    public open operator fun get(dst: ByteArray, offset: Int, length: Int): ByteBuffer
-
-    /**
-     * Relative bulk *get* method.
-     *
-     *
-     *  This method transfers bytes from this buffer into the given
-     * destination array.  An invocation of this method of the form
-     * `src.get(a)` behaves in exactly the same way as the invocation
-     *
-     * <pre>
-     * src.get(a, 0, a.length) </pre>
-     *
-     * @param   dst
-     * The destination array
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferUnderflowException
-     * If there are fewer than `length` bytes
-     * remaining in this buffer
-     */
-    public operator fun get(dst: ByteArray): ByteBuffer
-
-    // -- Bulk put operations --
-    /**
-     * Relative bulk *put* method&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  This method transfers the bytes remaining in the given source
-     * buffer into this buffer.  If there are more bytes remaining in the
-     * source buffer than in this buffer, that is, if
-     * `src.remaining()`&nbsp;`>`&nbsp;`remaining()`,
-     * then no bytes are transferred and a [ ] is thrown.
-     *
-     *
-     *  Otherwise, this method copies
-     * *n*&nbsp;=&nbsp;`src.remaining()` bytes from the given
-     * buffer into this buffer, starting at each buffer's current position.
-     * The positions of both buffers are then incremented by *n*.
-     *
-     *
-     *  In other words, an invocation of this method of the form
-     * `dst.put(src)` has exactly the same effect as the loop
-     *
-     * <pre>
-     * while (src.hasRemaining())
-     * dst.put(src.get()); </pre>
-     *
-     * except that it first checks that there is sufficient space in this
-     * buffer and it is potentially much more efficient.
-     *
-     * @param  src
-     * The source buffer from which bytes are to be read;
-     * must not be this buffer
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there is insufficient space in this buffer
-     * for the remaining bytes in the source buffer
-     *
-     * @throws  IllegalArgumentException
-     * If the source buffer is this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public fun put(src: ByteBuffer): ByteBuffer
-
-    /**
-     * Relative bulk *put* method&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  This method transfers bytes into this buffer from the given
-     * source array.  If there are more bytes to be copied from the array
-     * than remain in this buffer, that is, if
-     * `length`&nbsp;`>`&nbsp;`remaining()`, then no
-     * bytes are transferred and a [BufferOverflowException] is
-     * thrown.
-     *
-     *
-     *  Otherwise, this method copies `length` bytes from the
-     * given array into this buffer, starting at the given offset in the array
-     * and at the current position of this buffer.  The position of this buffer
-     * is then incremented by `length`.
-     *
-     *
-     *  In other words, an invocation of this method of the form
-     * `dst.put(src,&nbsp;off,&nbsp;len)` has exactly the same effect as
-     * the loop
-     *
-     * <pre>`for (int i = off; i < off + len; i++)
-     * dst.put(src[i]);
-    `</pre> *
-     *
-     * except that it first checks that there is sufficient space in this
-     * buffer and it is potentially much more efficient.
-     *
-     * @param  src
-     * The array from which bytes are to be read
-     *
-     * @param  offset
-     * The offset within the array of the first byte to be read;
-     * must be non-negative and no larger than `src.length`
-     *
-     * @param  length
-     * The number of bytes to be read from the given array;
-     * must be non-negative and no larger than
-     * `src.length - offset`
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there is insufficient space in this buffer
-     *
-     * @throws  IndexOutOfBoundsException
-     * If the preconditions on the `offset` and `length`
-     * parameters do not hold
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public open fun put(src: ByteArray, offset: Int, length: Int): ByteBuffer
-
-    /**
-     * Relative bulk *put* method&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  This method transfers the entire content of the given source
-     * byte array into this buffer.  An invocation of this method of the
-     * form `dst.put(a)` behaves in exactly the same way as the
-     * invocation
-     *
-     * <pre>
-     * dst.put(a, 0, a.length) </pre>
-     *
-     * @param   src
-     * The source array
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there is insufficient space in this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public fun put(src: ByteArray): ByteBuffer
-
-    /**
-     * Relative *put* method for writing an int
-     * value&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  Writes four bytes containing the given int value, in the
-     * current byte order, into this buffer at the current position, and then
-     * increments the position by four.
-     *
-     * @param  value
-     * The int value to be written
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there are fewer than four bytes
-     * remaining in this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public abstract fun putInt(value: Int): ByteBuffer
-
-    /**
-     * Relative *put* method for writing a long
-     * value&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  Writes eight bytes containing the given long value, in the
-     * current byte order, into this buffer at the current position, and then
-     * increments the position by eight.
-     *
-     * @param  value
-     * The long value to be written
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there are fewer than eight bytes
-     * remaining in this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public abstract fun putLong(value: Long): ByteBuffer
-
-    /**
-     * Absolute *get* method for reading a long value.
-     *
-     *
-     *  Reads eight bytes at the given index, composing them into a
-     * long value according to the current byte order.
-     *
-     * @param  index
-     * The index from which the bytes will be read
-     *
-     * @return  The long value at the given index
-     *
-     * @throws  IndexOutOfBoundsException
-     * If `index` is negative
-     * or not smaller than the buffer's limit,
-     * minus seven
-     */
-    public abstract fun getLong(index: Int): Long
-
-    /**
-     * Relative *put* method for writing a float
-     * value&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  Writes four bytes containing the given float value, in the
-     * current byte order, into this buffer at the current position, and then
-     * increments the position by four.
-     *
-     * @param  value
-     * The float value to be written
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there are fewer than four bytes
-     * remaining in this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public abstract fun putFloat(value: Float): ByteBuffer
-
-    /**
-     * Relative *put* method for writing a double
-     * value&nbsp;&nbsp;*(optional operation)*.
-     *
-     *
-     *  Writes eight bytes containing the given double value, in the
-     * current byte order, into this buffer at the current position, and then
-     * increments the position by eight.
-     *
-     * @param  value
-     * The double value to be written
-     *
-     * @return  This buffer
-     *
-     * @throws  BufferOverflowException
-     * If there are fewer than eight bytes
-     * remaining in this buffer
-     *
-     * @throws  ReadOnlyBufferException
-     * If this buffer is read-only
-     */
-    public abstract fun putDouble(value: Double): ByteBuffer
-
-    public companion object {
-        /**
-         * Allocates a new byte buffer.
-         *
-         *
-         *  The new buffer's position will be zero, its limit will be its
-         * capacity, its mark will be undefined, each of its elements will be
-         * initialized to zero, and its byte order will be
-         *
-         * [BIG_ENDIAN][ByteOrder.BIG_ENDIAN].
-         *
-         *
-         *
-         *
-         * It will have a [backing array][.array], and its
-         * [array offset][.arrayOffset] will be zero.
-         *
-         * @param  capacity
-         * The new buffer's capacity, in bytes
-         *
-         * @return  The new byte buffer
-         *
-         * @throws  IllegalArgumentException
-         * If the `capacity` is a negative integer
-         */
-        @JvmStatic
-        public fun allocate(capacity: Int): ByteBuffer
-    }
-}

+ 0 - 60
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt

@@ -1,60 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch")
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio
-
-import kotlin.jvm.JvmStatic
-
-/**
- * A typesafe enumeration for byte orders.
- *
- * @author Mark Reinhold
- * @author JSR-51 Expert Group
- * @since 1.4
- */
-public expect class ByteOrder {
-    public companion object {
-        /**
-         * Constant denoting big-endian byte order.  In this order, the bytes of a
-         * multibyte value are ordered from most significant to least significant.
-         */
-        @JvmStatic
-        public val BIG_ENDIAN: ByteOrder
-
-        /**
-         * Constant denoting little-endian byte order.  In this order, the bytes of
-         * a multibyte value are ordered from least significant to most
-         * significant.
-         */
-        @JvmStatic
-        public val LITTLE_ENDIAN: ByteOrder
-
-        /**
-         * Retrieves the native byte order of the underlying platform.
-         *
-         *
-         *  This method is defined so that performance-sensitive Java code can
-         * allocate direct buffers with the same byte order as the hardware.
-         * Native code libraries are often more efficient when such buffers are
-         * used.
-         *
-         * @return  The native byte order of the hardware upon which this Java
-         * virtual machine is running
-         */
-        @JvmStatic
-        public fun nativeOrder(): ByteOrder
-    }
-}

+ 0 - 45
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt

@@ -1,45 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio.file
-
-import java.io.Closeable
-
-public expect abstract class FileSystem : Closeable {
-    //public abstract fun provider(): java.nio.file.spi.FileSystemProvider
-    public abstract fun close()
-    public abstract fun isOpen(): Boolean
-    public abstract fun isReadOnly(): Boolean
-    public abstract fun getSeparator(): String
-    public abstract fun getRootDirectories(): Iterable<Path>
-
-    //public abstract fun getFileStores(): Iterable<FileStore>
-    public abstract fun supportedFileAttributeViews(): Set<String>
-    public abstract fun getPath(first: String, vararg more: String): Path
-    //public abstract fun getPathMatcher(syntaxAndPattern: String): PathMatcher
-    //public abstract fun getUserPrincipalLookupService(): UserPrincipalLookupService
-    // public abstract fun newWatchService(): WatchService
-}  

+ 0 - 70
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt

@@ -1,70 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE",
-    "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio.file
-
-public expect open interface Path : Comparable<Path>, Iterable<Path>, Watchable {
-    public open fun getFileSystem(): FileSystem
-    public open fun isAbsolute(): Boolean
-    public open fun getRoot(): Path
-    public open fun getFileName(): Path
-    public open fun getParent(): Path
-    public open fun getNameCount(): Int
-    public open fun getName(index: Int): Path
-    public open fun subpath(beginIndex: Int, endIndex: Int): Path
-    public open fun startsWith(other: Path): Boolean
-    public open fun startsWith(other: String): Boolean
-    public open fun endsWith(other: Path): Boolean
-    public open fun endsWith(other: String): Boolean
-    public open fun normalize(): Path
-    public open fun resolve(other: Path): Path
-    public open fun resolve(other: String): Path
-    public open fun resolveSibling(other: Path): Path
-    public open fun resolveSibling(other: String): Path
-    public open fun relativize(other: Path): Path
-    public open fun toUri(): java.net.URI
-    public open fun toAbsolutePath(): Path
-
-    //public open fun toRealPath(vararg options: LinkOption): Path
-    public open fun toFile(): java.io.File
-
-    //public open fun register(watcher: watcher, events: events, WatchEvent.Modifier[0]: new): return
-    public open fun iterator(): Iterator<Path>
-    public open fun hasNext(): Boolean
-    public open fun next(): Path
-    public open fun compareTo(other: Path): Int
-    public open fun equals(other: Any?): Boolean
-    public open fun hashCode(): Int
-    public open fun toString(): String
-
-    public companion object {
-        //@JvmStatic
-        public open fun of(first: String, vararg more: String): Path
-
-        //@JvmStatic
-        public open fun of(uri: java.net.URI): Path
-    }
-}  

+ 0 - 40
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt

@@ -1,40 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE", "NON_FINAL_MEMBER_IN_OBJECT"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio.file
-
-import kotlin.jvm.JvmStatic
-
-public expect final class Paths {
-
-    public companion object {
-        @JvmStatic
-        public open fun get(first: String, vararg more: String): Path
-
-        @JvmStatic
-        public open fun get(uri: java.net.URI): Path
-    }
-}  

+ 0 - 31
mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt

@@ -1,31 +0,0 @@
-/*
- * Copyright 2019-2020 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/master/LICENSE
- */
-
-@file:Suppress(
-    "unused",
-    "NO_ACTUAL_FOR_EXPECT",
-    "PackageDirectoryMismatch",
-    "NON_FINAL_MEMBER_IN_FINAL_CLASS",
-    "VIRTUAL_MEMBER_HIDDEN",
-    "RedundantModalityModifier",
-    "REDUNDANT_MODIFIER_FOR_TARGET",
-    "REDUNDANT_OPEN_IN_INTERFACE"
-)
-
-/**
- * Bindings for JDK.
- *
- * All the sources are copied from OpenJDK. Copyright OpenJDK authors.
- */
-
-package java.nio.file
-
-public expect open interface Watchable {
-    //public open fun register(watcher: WatchService, vararg events: WatchEvent.Kind<?>): WatchKey
-}  

+ 9 - 2
mirai-core-api/src/jvmMain/kotlin/BotFactory.kt

@@ -71,7 +71,8 @@ public actual interface BotFactory {
 
     @SinceMirai("1.3.0")
     public actual companion object INSTANCE : BotFactory {
-        override fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration): Bot {
+        @Suppress("ACTUAL_WITHOUT_EXPECT")
+        actual override fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration): Bot {
             return factory.Bot(context, qq, password, configuration)
         }
 
@@ -79,7 +80,13 @@ public actual interface BotFactory {
             return factory.Bot(qq, password, configuration)
         }
 
-        override fun Bot(context: Context, qq: Long, passwordMd5: ByteArray, configuration: BotConfiguration): Bot {
+        @Suppress("ACTUAL_WITHOUT_EXPECT")
+        actual override fun Bot(
+            context: Context,
+            qq: Long,
+            passwordMd5: ByteArray,
+            configuration: BotConfiguration
+        ): Bot {
             return factory.Bot(context, qq, passwordMd5, configuration)
         }
 

+ 16 - 1
mirai-core/build.gradle.kts

@@ -25,6 +25,11 @@ description = "Mirai Protocol implementation for QQ Android"
 
 val isAndroidSDKAvailable: Boolean by project
 
+afterEvaluate {
+    tasks.getByName("compileKotlinCommon").enabled = false
+    tasks.getByName("compileTestKotlinCommon").enabled = false
+}
+
 kotlin {
     if (isAndroidSDKAvailable) {
         apply(from = rootProject.file("gradle/android.gradle"))
@@ -46,10 +51,19 @@ kotlin {
         )
     }
 
+    jvm("common") {
+        attributes.attribute(ATTRIBUTE_MIRAI_TARGET_PLATFORM, "common")
+    }
+
     jvm("jvm") {
-        withJava()
+        attributes.attribute(ATTRIBUTE_MIRAI_TARGET_PLATFORM, "jvm")
     }
 
+    /*
+    jvm("android") {
+        attributes.attribute(ATTRIBUTE_MIRAI_TARGET_PLATFORM, "android")
+    }*/
+
     sourceSets.apply {
         all {
             dependencies {
@@ -60,6 +74,7 @@ kotlin {
         commonMain {
             dependencies {
                 api1(`kotlinx-serialization-core`)
+                api1(`kotlinx-serialization-json`)
                 implementation1(`kotlinx-serialization-protobuf`)
 
                 api1(`kotlinx-atomicfu`)

+ 0 - 1
mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt

@@ -61,7 +61,6 @@ internal class ProtoBufWithNullableSupport(override val serializersModule: Seria
         @Suppress("OverridingDeprecatedMember")
         override fun beginStructure(
             descriptor: SerialDescriptor,
-            vararg typeSerializers: KSerializer<*>
         ): CompositeEncoder = when (descriptor.kind) {
             StructureKind.LIST -> RepeatedWriter(encoder, currentTag)
             StructureKind.CLASS, StructureKind.OBJECT, is PolymorphicKind -> ObjectWriter(currentTagOrNull, encoder)

+ 9 - 0
mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt

@@ -47,6 +47,9 @@ internal class TarsDecoder(
     private val SimpleByteArrayReader: SimpleByteArrayReaderImpl = SimpleByteArrayReaderImpl()
 
     private inner class SimpleByteArrayReaderImpl : AbstractDecoder() {
+        override val serializersModule: SerializersModule
+            get() = this@TarsDecoder.serializersModule
+
         override fun decodeSequentially(): Boolean = true
 
         override fun endStructure(descriptor: SerialDescriptor) {
@@ -82,6 +85,9 @@ internal class TarsDecoder(
     private val ListReader: ListReaderImpl = ListReaderImpl()
 
     private inner class ListReaderImpl : AbstractDecoder() {
+        override val serializersModule: SerializersModule
+            get() = this@TarsDecoder.serializersModule
+
         override fun decodeSequentially(): Boolean = true
         override fun decodeElementIndex(descriptor: SerialDescriptor): Int = error("should not be reached")
         override fun endStructure(descriptor: SerialDescriptor) {
@@ -116,6 +122,9 @@ internal class TarsDecoder(
     private val MapReader: MapReaderImpl = MapReaderImpl()
 
     private inner class MapReaderImpl : AbstractDecoder() {
+        override val serializersModule: SerializersModule
+            get() = this@TarsDecoder.serializersModule
+
         override fun decodeSequentially(): Boolean = true
         override fun decodeElementIndex(descriptor: SerialDescriptor): Int = error("stub")
 

+ 1 - 1
settings.gradle.kts

@@ -23,4 +23,4 @@ rootProject.name = "mirai"
 
 include(":mirai-core-api")
 include(":mirai-core")
-include(":mirai-core-all")
+// include(":mirai-core-all")