Repository navigation
Conversation
# Conflicts: # hsweb-core/pom.xml # hsweb-core/src/main/java/org/hswebframework/web/bean/ClassDescription.java # hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java # pom.xml
zhou-hao
marked this pull request as ready for review
May 28, 2026 01:21
# Conflicts: # hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java # hsweb-core/src/test/java/org/hswebframework/web/bean/FastBeanCopierTest.java
zhou-hao
force-pushed
the
5.0.x-refactor-copy
branch
from
July 14, 2026 09:47
308e299 to
670effb
Compare
# Conflicts: # .github/workflows/pull_request_5x.yml # hsweb-core/src/main/java/org/hswebframework/web/bean/FastBeanCopier.java
恢复嵌套 Map 的自定义与动态 BeanUtils 转换器支持。 解除共享计划对局部 BeanFactory 的持有,按元素数创建默认容器, 通过类型对缓存消除热查询组合键分配,并保留并发与类加载器清理契约。 126 项测试通过,完成 184 个性能 fork;记录分配收益与旧 reflect 的耗时取舍。
This branch has not been deployed
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.
问题与结果
FastBeanCopier 重构后,嵌套 Map 转为由 BeanUtils 转换器创建的接口、抽象类或其他对象时,会绕过扩展转换器并尝试调用无参构造器,导致
ConfigMetadata.<init>()等异常。现在恢复通用转换器扩展,并收口复制后端、类型转换、record 复制和缓存生命周期。实现
asm-accessor;支持hsweb.fast-bean-copier.backend显式选择后端,native hint / disable-codegen 和动态类加载器场景回退到reflection-accessor。record 复制使用 ASM 路径。clearCache()/clearCache(ClassLoader)显式释放,同时匹配源和目标类型;正在创建的匹配项可以返回给调用方,但不能重新填入已清理缓存。保留现有公共兼容入口及CacheKey。验证
mvn -o -pl hsweb-core -am test:126 项测试通过,0 失败、0 错误、0 跳过。覆盖四种后端的 BeanUtils 动态扩展、工厂替换与引用、泛型隔离、容器复制、record、并发 / 递归创建及类加载器清理。322dbba78复用已完成的阶段验证;提交前核对 219 个源码 / 字节码指纹,未发生变化,git diff --check通过。长预热代表性结果:
补充探针:缓存热查询三轮均从 24 B/次降至 0 B/次;携带 8 MiB 负载的局部工厂在优化后可通过指定类加载器清理释放,基线仅全量清理后可释放。确定性对象图测试验证全局计划无法到达局部工厂。
缓存管理对象尺寸探针排除 Class 和共享 value:100 个源类型各对应 8 个目标时由 53072 降至 28472 B(-46.4%);各对应 1 个目标时由 6704 增至 6872 B,包含固定管理开销。
文档与边界
hsweb-core/README.md的转换器扩展、工厂与缓存生命周期说明;完整阶段基线、四后端数据和性能取舍见hsweb-core/src/test/java/org/hswebframework/web/bean/FastBeanCopierBenchmarkSummary.md。target/jmh-results/。