From 61b5c2abceedcd24c5140d5f8b2a6f4c25c901e4 Mon Sep 17 00:00:00 2001 From: godotg Date: Tue, 16 Jan 2024 17:20:59 +0800 Subject: [PATCH] perf[module]: If the path of the package contains a classpath, the moduleId of the classpath is preferred, which means that the priority of the classpath will be higher. --- .../zfoo/protocol/registration/ProtocolAnalysis.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/protocol/src/main/java/com/zfoo/protocol/registration/ProtocolAnalysis.java b/protocol/src/main/java/com/zfoo/protocol/registration/ProtocolAnalysis.java index 665ccd82..cbb64e46 100644 --- a/protocol/src/main/java/com/zfoo/protocol/registration/ProtocolAnalysis.java +++ b/protocol/src/main/java/com/zfoo/protocol/registration/ProtocolAnalysis.java @@ -185,6 +185,10 @@ public class ProtocolAnalysis { enhance(generateOperation, enhanceList); } + /** + * EN: If the path of the package contains a classpath, the moduleId of the classpath is preferred, which means that the priority of the classpath will be higher. + * CN: 可以同时在一个protocol.xml文件中使用包路径和类路径。如果包的路径包含了类路径,则优先使用类路径的moduleId,也就是说类路径的优先级会更加的高。 + */ public static synchronized void analyze(XmlProtocols xmlProtocols, GenerateOperation generateOperation) { AssertionUtils.notNull(subProtocolIdMap, "[{}] initialization has already been completed, please do not repeat the initialization", ProtocolManager.class.getSimpleName()); @@ -281,12 +285,8 @@ public class ProtocolAnalysis { } for (Class protocolClass : packetClazzList) { - // 如果location已经指定过了,则检测格式 + // 如果location已经指定过了,则优先使用class的绝对路径定义的moduleId if (classModuleDefinitionMap.containsKey(protocolClass)) { - var xmlProtocolModuleId = classModuleDefinitionMap.get(protocolClass); - if (xmlProtocolModuleId != moduleId) { - throw new RunException("[class:{}] defined two different [module:[{}][{}]]", protocolClass.getName(), xmlProtocolModuleId, module.getId()); - } continue; } var protocolId = getProtocolIdAndCheckClass(protocolClass);