1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-25 21:12:40 +08:00

Use Kotlin 1.7.0-RC

This commit is contained in:
Him188 2022-05-26 17:06:43 +01:00
parent 5714d31cd3
commit e02e41dbad
No known key found for this signature in database
GPG Key ID: BA439CDDCF652375
9 changed files with 56 additions and 56 deletions

View File

@ -22,7 +22,7 @@ object Versions {
val consoleIntellij = "221-$project-162-1" // idea-mirai-kotlin-patch
val consoleTerminal = project
const val kotlinCompiler = "1.6.21"
const val kotlinCompiler = "1.7.0-RC"
const val kotlinStdlib = kotlinCompiler
const val dokka = "1.6.20"

View File

@ -9,10 +9,10 @@
package net.mamoe.mirai.utils
public actual fun String.decodeBase64(): ByteArray {
actual fun String.decodeBase64(): ByteArray {
TODO("Not yet implemented")
}
public actual fun ByteArray.encodeBase64(): String {
actual fun ByteArray.encodeBase64(): String {
TODO("Not yet implemented")
}

View File

@ -9,7 +9,7 @@
package net.mamoe.mirai.utils
public actual inline fun measureTimeMillis(block: () -> Unit): Long {
actual inline fun measureTimeMillis(block: () -> Unit): Long {
val start = currentTimeMillis()
block()
return currentTimeMillis() - start

View File

@ -12,35 +12,35 @@ package net.mamoe.mirai.utils
import kotlin.reflect.KClass
@Suppress("FunctionName")
public actual fun <K : Any, V> ConcurrentHashMap(): MutableMap<K, V> {
actual fun <K : Any, V> ConcurrentHashMap(): MutableMap<K, V> {
TODO("Not yet implemented")
}
@Suppress("FunctionName")
public actual fun <E> ConcurrentLinkedDeque(): MutableDeque<E> {
actual fun <E> ConcurrentLinkedDeque(): MutableDeque<E> {
TODO("Not yet implemented")
}
@Suppress("FunctionName")
public actual fun <E : Comparable<*>> PriorityQueue(): MutableQueue<E> {
actual fun <E : Comparable<*>> PriorityQueue(): MutableQueue<E> {
TODO("Not yet implemented")
}
@Suppress("FunctionName")
public actual fun <E : Any> PriorityQueue(comparator: Comparator<E>): MutableCollection<E> {
actual fun <E : Any> PriorityQueue(comparator: Comparator<E>): MutableCollection<E> {
TODO("Not yet implemented")
}
@Suppress("FunctionName")
public actual fun <K : Enum<K>, V> EnumMap(clazz: KClass<K>): MutableMap<K, V> = mutableMapOf()
actual fun <K : Enum<K>, V> EnumMap(clazz: KClass<K>): MutableMap<K, V> = mutableMapOf()
@Suppress("FunctionName")
public actual fun <E> ConcurrentSet(): MutableSet<E> {
actual fun <E> ConcurrentSet(): MutableSet<E> {
TODO("Not yet implemented")
}
public actual class LinkedList<E> : MutableList<E>, AbstractMutableList<E>() {
public actual fun addLast(element: E) {
actual class LinkedList<E> : MutableList<E>, AbstractMutableList<E>() {
actual fun addLast(element: E) {
TODO("Not yet implemented")
}
@ -64,11 +64,11 @@ public actual class LinkedList<E> : MutableList<E>, AbstractMutableList<E>() {
}
}
public actual interface MutableDeque<E> : MutableQueue<E> {
public actual fun addFirst(element: E)
actual interface MutableDeque<E> : MutableQueue<E> {
actual fun addFirst(element: E)
}
public actual interface MutableQueue<E> : MutableCollection<E> {
actual interface MutableQueue<E> : MutableCollection<E> {
/**
* Adds the specified element to the collection.
*
@ -76,18 +76,18 @@ public actual interface MutableQueue<E> : MutableCollection<E> {
* and the element is already contained in the collection.
* @throws IllegalStateException if the queue is full.
*/
public actual override fun add(element: E): Boolean
actual override fun add(element: E): Boolean
/**
* Removes and returns the head of the queue, `null` otherwise.
*/
public actual fun poll(): E?
actual fun poll(): E?
/**
* Adds an element into the queue.
* @return `true` if the element has been added, `false` if queue is full.
*/
public actual fun offer(element: E): Boolean
actual fun offer(element: E): Boolean
}
@ -95,9 +95,9 @@ public actual interface MutableQueue<E> : MutableCollection<E> {
/**
* Returns a [List] that cannot be cast to [MutableList] to modify it.
*/
public actual fun <T> List<T>.asImmutable(): List<T> = ImmutableList(this)
public actual fun <T> Collection<T>.asImmutable(): Collection<T> = ImmutableCollection(this)
public actual fun <T> Set<T>.asImmutable(): Set<T> = ImmutableSet(this)
actual fun <T> List<T>.asImmutable(): List<T> = ImmutableList(this)
actual fun <T> Collection<T>.asImmutable(): Collection<T> = ImmutableCollection(this)
actual fun <T> Set<T>.asImmutable(): Set<T> = ImmutableSet(this)
internal class ImmutableList<T>(
private val delegate: List<T>

View File

@ -9,11 +9,11 @@
package net.mamoe.mirai.utils
public actual suspend inline fun <R> runBIO(noinline block: () -> R): R {
actual suspend inline fun <R> runBIO(noinline block: () -> R): R {
return block()
}
public actual suspend inline fun <T, R> T.runBIO(crossinline block: T.() -> R): R {
actual suspend inline fun <T, R> T.runBIO(crossinline block: T.() -> R): R {
TODO("Not yet implemented")
}
@ -62,7 +62,7 @@ public actual suspend inline fun <T, R> T.runBIO(crossinline block: T.() -> R):
* ```
*/
@Suppress("unused")
public actual inline fun <reified E> Throwable.unwrap(): Throwable {
actual inline fun <reified E> Throwable.unwrap(): Throwable {
if (this !is E) return this
return this.findCause { it !is E }
?.also { it.addSuppressed(this) }

View File

@ -10,35 +10,35 @@
package net.mamoe.mirai.utils
public actual fun ByteArray.unzip(offset: Int, length: Int): ByteArray {
actual fun ByteArray.unzip(offset: Int, length: Int): ByteArray {
TODO("Not yet implemented")
}
public actual fun localIpAddress(): String = "192.168.1.123"
actual fun localIpAddress(): String = "192.168.1.123"
public actual fun ByteArray.md5(offset: Int, length: Int): ByteArray {
actual fun ByteArray.md5(offset: Int, length: Int): ByteArray {
TODO("Not yet implemented")
}
public actual val DEFAULT_BUFFER_SIZE: Int get() = 8192
actual val DEFAULT_BUFFER_SIZE: Int get() = 8192
public actual fun ByteArray.sha1(offset: Int, length: Int): ByteArray {
actual fun ByteArray.sha1(offset: Int, length: Int): ByteArray {
TODO("Not yet implemented")
}
public actual fun ByteArray.ungzip(offset: Int, length: Int): ByteArray {
actual fun ByteArray.ungzip(offset: Int, length: Int): ByteArray {
TODO("Not yet implemented")
}
public actual fun ByteArray.gzip(offset: Int, length: Int): ByteArray {
actual fun ByteArray.gzip(offset: Int, length: Int): ByteArray {
TODO("Not yet implemented")
}
public actual fun ByteArray.zip(offset: Int, length: Int): ByteArray {
actual fun ByteArray.zip(offset: Int, length: Int): ByteArray {
TODO("Not yet implemented")
}
public actual fun availableProcessors(): Int {
actual fun availableProcessors(): Int {
TODO("Not yet implemented")
}

View File

@ -14,25 +14,25 @@ import io.ktor.utils.io.core.*
/**
* Multiplatform implementation of file operations.
*/
public actual interface MiraiFile {
public actual val name: String
public actual val parent: MiraiFile?
public actual val absolutePath: String
public actual val length: Long
public actual val isFile: Boolean
public actual val isDirectory: Boolean
public actual fun exists(): Boolean
public actual fun resolve(path: String): MiraiFile
public actual fun resolve(file: MiraiFile): MiraiFile
public actual fun createNewFile(): Boolean
public actual fun delete(): Boolean
public actual fun mkdir(): Boolean
public actual fun mkdirs(): Boolean
public actual fun input(): Input
public actual fun output(): Output
actual interface MiraiFile {
actual val name: String
actual val parent: MiraiFile?
actual val absolutePath: String
actual val length: Long
actual val isFile: Boolean
actual val isDirectory: Boolean
actual fun exists(): Boolean
actual fun resolve(path: String): MiraiFile
actual fun resolve(file: MiraiFile): MiraiFile
actual fun createNewFile(): Boolean
actual fun delete(): Boolean
actual fun mkdir(): Boolean
actual fun mkdirs(): Boolean
actual fun input(): Input
actual fun output(): Output
public actual companion object {
public actual fun create(absolutePath: String): MiraiFile {
actual companion object {
actual fun create(absolutePath: String): MiraiFile {
TODO("Not yet implemented")
}
}

View File

@ -14,10 +14,10 @@ package net.mamoe.mirai.utils
*
* @see System.currentTimeMillis
*/
public actual fun currentTimeMillis(): Long {
actual fun currentTimeMillis(): Long {
TODO("Not yet implemented")
}
public actual fun currentTimeFormatted(format: String?): String {
actual fun currentTimeFormatted(format: String?): String {
TODO("Not yet implemented")
}

View File

@ -11,20 +11,20 @@ package net.mamoe.mirai.utils
import kotlin.reflect.KClass
public actual fun <T : Any> loadServiceOrNull(
actual fun <T : Any> loadServiceOrNull(
clazz: KClass<out T>,
fallbackImplementation: String?
): T? {
TODO("Not yet implemented")
}
public actual fun <T : Any> loadService(
actual fun <T : Any> loadService(
clazz: KClass<out T>,
fallbackImplementation: String?
): T {
TODO("Not yet implemented")
}
public actual fun <T : Any> loadServices(clazz: KClass<out T>): Sequence<T> {
actual fun <T : Any> loadServices(clazz: KClass<out T>): Sequence<T> {
TODO("Not yet implemented")
}