Skip to content

refactor(filter): 优化DiffFilter中类路径处理逻#28

Closed
kangjie0603 wants to merge 2 commits intoyangziwen:masterfrom
kangjie0603:master
Closed

refactor(filter): 优化DiffFilter中类路径处理逻#28
kangjie0603 wants to merge 2 commits intoyangziwen:masterfrom
kangjie0603:master

Conversation

@kangjie0603
Copy link
Copy Markdown

  • 简化模块路径处理方式,支持多级子模块,直接查找/src/main/java/位置来获取类相对路径

kangjie.zhang added 2 commits December 4, 2025 17:31
- 简化模块路径处理方式,支持多级子模块,直接查找/src/main/java/位置来获取类相对路径
- 简化模块路径处理方式,支持多级子模块,直接查找/src/main/java/位置来获取类相对路径
@kangjie0603 kangjie0603 closed this Dec 4, 2025
@kangjie0603 kangjie0603 reopened this Dec 4, 2025

// 直接查找 /src/main/java/ 的位置,支持任意深度的嵌套模块
// 这种方式比逐级去除路径段更高效,且逻辑更清晰
int srcIndex = name.indexOf(SOURCE_PATH_PREFIX);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在文件路径中寻找/src/main/java/片段,和按pom文件中的标签中声明的内容寻找子模块是有本质区别的。此处应该严格按pom中声明的模块处理相关逻辑。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有个问题:插件配置到 root pom 时, 各子模块不会再执行添加的filtler (标记已经执行过了), 如果子模块下还有子模块,当前fitler 获取的模块不包含子模块的子模块,最后map key的路径是包含 模块路径的,与getClassPath 路径不一致导致无效。 PersonFilte 同理

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢指正,已修复

@yangziwen yangziwen closed this Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants