Skip to content

Commit

Permalink
feat: check in load plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Jun 21, 2023
1 parent 545e5bb commit cbb7f18
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal class BuiltInJvmPluginLoaderImpl(
return filePlugins.toSet().map { it.value }
}

private val loadedPlugins = ConcurrentHashMap<JvmPlugin, Unit>()
private val loadedPlugins = ConcurrentHashMap<String, JvmPlugin>()

private fun Path.moveNameFolder(plugin: JvmPlugin) {
val nameFolder = this.resolve(plugin.description.name).toFile()
Expand Down Expand Up @@ -258,8 +258,8 @@ internal class BuiltInJvmPluginLoaderImpl(
override fun load(plugin: JvmPlugin) {
ensureActive()

if (loadedPlugins.put(plugin, Unit) != null) {
error("Plugin '${plugin.name}' is already loaded and cannot be reloaded.")
if (loadedPlugins.put(plugin.id, plugin) != null) {
error("Plugin '${plugin.id}' is already loaded and cannot be reloaded.")
}
logger.verbose { "Loading plugin ${plugin.description.smartToString()}" }
runCatching {
Expand Down

0 comments on commit cbb7f18

Please sign in to comment.