修复了Class.getDeclaredFields()
返回的元素的不确定顺序引起的问题
#896
Merged
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.
FieldHelper
使用Java反射Class.getDeclaredFields()
来获取特定类的字段信息Mapper/core/src/main/java/tk/mybatis/mapper/mapperhelper/FieldHelper.java
Line 183 in 5e31029
然而,官方的Javadoc提到,随着时间的推移,元素的顺序不会保持
修复程序已于2022年10月15日在[此提交](https://github.com/abel533/Mapper/pull/666/commits/70232e7c5edd63bee897873bde25efbb2d076a1a)中被合并,但在[此提交](https://github.com/abel533/Mapper/commit/79d313a7ca6cba6c5d5323746fb83ed5744180a1)中删除
我怀疑这是因为2022年10月16日测试“ComplexEntityTest.test()”中的[此更改](2fcefe65e77db1e57edb33290cd0e347ecaec8),该测试会因订购问题而失败。
由于字段已经排序,这个测试的预期值应该从
去
Class.getDeclaredFields()
,我们在运行[NonDex](https://github.com/TestingResearchIllinois/NonDex)时可能会观察到以下错误Class.getDeclaredFields()
返回的元素顺序不确定可能会导致测试失败 #895