Merge remote-tracking branch 'origin/master'

This commit is contained in:
Him188 2020-12-30 16:51:15 +08:00
commit 1160ff2ad2
4 changed files with 14 additions and 25 deletions

View File

@ -14,8 +14,8 @@ import java.time.Instant
internal object MiraiConsoleBuildConstants { // auto-filled on build (task :mirai-console:fillBuildConstants) internal object MiraiConsoleBuildConstants { // auto-filled on build (task :mirai-console:fillBuildConstants)
@JvmStatic @JvmStatic
val buildDate: Instant = Instant.ofEpochSecond(1609151969) val buildDate: Instant = Instant.ofEpochSecond(1609213499)
const val versionConst: String = "2.0-M2" const val versionConst: String = "2.0-M2-1-dev-1"
@JvmStatic @JvmStatic
val version: SemVersion = SemVersion(versionConst) val version: SemVersion = SemVersion(versionConst)

View File

@ -97,28 +97,17 @@ internal class JvmPluginClassLoader(
} else throw LoadingDeniedException("$name was not exported by $otherClassloader") } else throw LoadingDeniedException("$name was not exported by $otherClassloader")
} }
} }
// If no cache...
return kotlin.runCatching {
// Try load this class direct....
super.findClass(name).also { cache[name] = it }
}.getOrElse { exception ->
if (exception is ClassNotFoundException) {
// Cannot load the class from this, try others.
classLoaders.forEach { otherClassloader -> classLoaders.forEach { otherClassloader ->
if (otherClassloader === this) return@forEach
val other = kotlin.runCatching { val other = kotlin.runCatching {
otherClassloader.findClass(name, true) if (otherClassloader === this) super.findClass(name).also { cache[name] = it }
else otherClassloader.findClass(name, true)
}.onFailure { err -> }.onFailure { err ->
if (err is LoadingDeniedException || err !is ClassNotFoundException) if (err is LoadingDeniedException || err !is ClassNotFoundException)
throw err throw err
}.getOrNull() }.getOrNull()
if (other != null) return other if (other != null) return other
} }
} throw ClassNotFoundException(name)
// Great, nobody known what is the class.
throw exception
}
} }
} }

View File

@ -13,7 +13,7 @@ import org.gradle.api.attributes.Attribute
object Versions { object Versions {
const val core = "2.0-M2" const val core = "2.0-M2"
const val console = "2.0-M2" const val console = "2.0-M2-1-dev-1"
const val consoleGraphical = "0.0.7" const val consoleGraphical = "0.0.7"
const val consoleTerminal = console const val consoleTerminal = console

View File

@ -10,6 +10,6 @@
package net.mamoe.mirai.console.gradle package net.mamoe.mirai.console.gradle
internal object VersionConstants { internal object VersionConstants {
const val CONSOLE_VERSION = "2.0-M2" // value is written here automatically during build const val CONSOLE_VERSION = "2.0-M2-1-dev-1" // value is written here automatically during build
const val CORE_VERSION = "2.0-M2" // value is written here automatically during build const val CORE_VERSION = "2.0-M2" // value is written here automatically during build
} }