refactor(bean): 重构 FastBeanCopier 复制后端并补齐兼容性验证#352
Draft
zhou-hao wants to merge 6 commits into
Draft
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
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作为 facade,引入FastBeanCopierSupport承载缓存、converter、backend 管理。FastBeanCopierBackend,拆分javassist、reflect、reflection-accessor、asm-accessor四类实现。PropertyAccessor、PropertyTransfer、ConverterPropertyTransfer抽象。ReflectionBeanAccessor、AsmBeanAccessor支持属性级 direct transfer / converting transfer。Converter,去掉TypeConverter + ResolvableType运行期适配层。AsmBeanAccessor在类型不可见或跨 classloader 冲突场景自动降级到ReflectionBeanAccessor。EnumDict -> numberbean copy 场景下的不一致行为。FastBeanCopierSupportTest,覆盖后端兼容性、null-skip 语义、跨 classloader 场景与性能对比。FastBeanCopierJmhBenchmark/FastBeanCopierJmhRunner,补充 backend JMH 对比入口。测试结果
命令:
mvn -pl hsweb-core -am -DskipTests test-compile结果:BUILD SUCCESS
命令:
mvn -pl hsweb-core -am -Dtest=FastBeanCopierSupportTest -Dsurefire.failIfNoSpecifiedTests=false test结果:8 passed, 0 failed, 0 skipped
命令:
mvn -pl hsweb-core -am -Dtest=FastBeanCopierTest,FastBeanCopierSupportTest -Dsurefire.failIfNoSpecifiedTests=false test结果:20 passed, 0 failed, 0 skipped
命令:
mvn -pl hsweb-core -am -Dtest=CompareUtilsTest,DiffTest,FastBeanCopierTest,FastBeanCopierSupportTest,AsmBeanAccessorTest,ReflectionBeanAccessorTest,SmartTypeConverterTest -Dsurefire.failIfNoSpecifiedTests=false test结果:29 passed, 0 failed, 0 skipped
CompareUtilsTest、DiffTest、FastBeanCopierTest、FastBeanCopierSupportTest;accessor 目录下 JUnit5 测试类未被当前测试配置选中。覆盖率:
hsweb-core/target/site/jacoco/jacoco.csv风险与说明
hsweb-corebean copy 主路径、converter 路径、Javassist/反射/accessor backend。FastBeanCopierSupportTest间接覆盖。asm-accessor的跨 classloader 场景依赖自动降级到 reflection accessor,而不是在目标 loader 中继续动态定义 ASM 类。