mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-17 08:24:47 +08:00
Fix class resolving when package duplicated in dependent plugins. Fix #1920
This commit is contained in:
parent
9bdbe30522
commit
894b8a9c2e
@ -13,7 +13,6 @@ import net.mamoe.console.integrationtest.ep.mcitselftest.MCITSelfTestPlugin
|
||||
import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription
|
||||
import net.mamoe.mirai.console.plugin.jvm.KotlinPlugin
|
||||
import net.mamoe.mirai.utils.info
|
||||
import kotlin.test.assertFails
|
||||
import kotlin.test.assertFailsWith
|
||||
import kotlin.test.assertNotEquals
|
||||
import kotlin.test.assertSame
|
||||
@ -52,5 +51,10 @@ public object PluginDependOnOther : KotlinPlugin(
|
||||
Class.forName("net.mamoe.assertion.something.not.existing")
|
||||
}
|
||||
}
|
||||
|
||||
// region https://github.com/mamoe/mirai/issues/1920
|
||||
Class.forName("net.mamoe.console.integrationtest.ep.pddd.p2.PDOO_OtherClass")
|
||||
Class.forName("net.mamoe.console.integrationtest.ep.pddd.PDOO_OtherClass")
|
||||
// endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("unused", "PackageDirectoryMismatch", "ClassName")
|
||||
|
||||
package net.mamoe.console.integrationtest.ep.pddd
|
||||
|
||||
// https://github.com/mamoe/mirai/issues/1920
|
||||
@PublishedApi
|
||||
internal class PDOO_OtherClass {
|
||||
companion object {
|
||||
init {
|
||||
Thread.dumpStack()
|
||||
println("OC Loaded")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("unused", "PackageDirectoryMismatch", "ClassName")
|
||||
|
||||
package net.mamoe.console.integrationtest.ep.pddd.p2
|
||||
|
||||
// https://github.com/mamoe/mirai/issues/1920
|
||||
@PublishedApi
|
||||
internal class PDOO_OtherClass {
|
||||
companion object {
|
||||
init {
|
||||
Thread.dumpStack()
|
||||
println("OC Loaded")
|
||||
}
|
||||
}
|
||||
}
|
@ -206,7 +206,9 @@ internal class JvmPluginClassLoaderN : URLClassLoader {
|
||||
if (declaredFilter?.isExported(name) == false) return null
|
||||
synchronized(getClassLoadingLock(name)) {
|
||||
findLoadedClass(name)?.let { return it }
|
||||
return super.findClass(name)
|
||||
try {
|
||||
return super.findClass(name)
|
||||
} catch (ignored: ClassNotFoundException) {}
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
Loading…
Reference in New Issue
Block a user