Repository navigation
fix(树结构): 按对象身份遍历全部节点 - #374
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TreeSupportEntity.forEach原先把System.identityHashCode的数值当作唯一身份。不同对象发生碰撞时,后一个节点及其子树被跳过;消费者用该遍历提取请求树的权限目标时,会遗漏实际将被持久化的节点。改为
IdentityHashMap支撑的对象身份集合,只跳过同一对象的重复引用。保留广度优先顺序、循环引用去重、实体 ID 和树结构,不增加接口或配置。验证
TreeUtilsTest、TreeSupportEntityTraversalTest共 3 项通过,编译和 API 本地安装通过。-XX:hashCode=2的 JVM 下通过,并断言测试对象的身份哈希确实相同;覆盖不同对象共享业务 ID、重复引用、循环引用及遍历顺序。未执行框架全量套件。消费者需使用包含此修复的
hsweb-commons-api:5.0.3-SNAPSHOT构建。配套:components #1678、authentication-manager #391。