From 2ca6b211b93ab35c8277aa69d13c9e370aa79a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MC=7E=E8=9B=9F=E9=BE=99?= <1610105206@qq.com> Date: Tue, 22 Aug 2023 14:01:08 +0800 Subject: [PATCH] [A.0.0.2.7] Update --- buildSrc/src/main/kotlin/Configuration.kt | 2 +- .../utilities/core/element/api/ElementRegister.kt | 14 ++++++-------- .../cn/fd/utilities/core/memory/HashMapMemory.kt | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/buildSrc/src/main/kotlin/Configuration.kt b/buildSrc/src/main/kotlin/Configuration.kt index 9966db7b..d57a513b 100644 --- a/buildSrc/src/main/kotlin/Configuration.kt +++ b/buildSrc/src/main/kotlin/Configuration.kt @@ -2,7 +2,7 @@ import java.text.SimpleDateFormat const val rootName = "FDUtilities" const val rootGroup = "cn.fd.utilities" -const val rootVersion = "A.0.0.2.6" +const val rootVersion = "A.0.0.2.7" const val kotlinVersion = "1.8.20" const val shadowJarVersion = "8.1.1" diff --git a/project/module-core/src/main/kotlin/cn/fd/utilities/core/element/api/ElementRegister.kt b/project/module-core/src/main/kotlin/cn/fd/utilities/core/element/api/ElementRegister.kt index 3318a598..99932cf6 100644 --- a/project/module-core/src/main/kotlin/cn/fd/utilities/core/element/api/ElementRegister.kt +++ b/project/module-core/src/main/kotlin/cn/fd/utilities/core/element/api/ElementRegister.kt @@ -21,13 +21,6 @@ class ElementRegister : ClassVisitor(0) { if (clazz.isAnnotationPresent(NewElement::class.java) && ElementHandler::class.java.isAssignableFrom(clazz)) { val anno = clazz.getAnnotation(NewElement::class.java) try { - /** - * 处理器 - */ - val handler = - if (instance == null) - clazz.asSubclass(ElementHandler::class.java).getInstance(true)!!.get() - else instance.get() as ElementHandler /** * 注册 */ @@ -35,7 +28,12 @@ class ElementRegister : ClassVisitor(0) { space = anno.space, name = anno.name, alias = anno.alias.toSet(), - handler = handler + /** + * 处理器 + */ + handler = if (instance == null) + clazz.asSubclass(ElementHandler::class.java).getInstance(true)!!.get() + else instance.get() as ElementHandler ) } catch (e: Exception) { e.printStackTrace() diff --git a/project/module-core/src/main/kotlin/cn/fd/utilities/core/memory/HashMapMemory.kt b/project/module-core/src/main/kotlin/cn/fd/utilities/core/memory/HashMapMemory.kt index d53846ac..3407bd38 100644 --- a/project/module-core/src/main/kotlin/cn/fd/utilities/core/memory/HashMapMemory.kt +++ b/project/module-core/src/main/kotlin/cn/fd/utilities/core/memory/HashMapMemory.kt @@ -16,21 +16,21 @@ open class HashMapMemory : Memory { /** * 加入到容器 */ - protected fun addToMemory(key: K, value: V) { + fun addToMemory(key: K, value: V) { memory[key] = value } /** * 从容器中删除 */ - protected fun removeFromMemory(key: K) { + fun removeFromMemory(key: K) { memory.remove(key) } /** * 清空容器 */ - protected fun clearMemory() { + fun clearMemory() { memory.clear() }