should_generate_member_index in this test is flaky since the method java.lang.Class.getDeclaredFields is non-deterministic, and GetDeclaredFilelds is ultimately used in the com.alibaba.testable.core.util.TypeUtil.getAllFields
I converted the result to a HashSet to avoid ordering issues, so the specific ordering of the fields would not affect the result. I think this change can prevent test failure due to future changes in the JVM.
should_generate_member_index
in this test is flaky since the methodjava.lang.Class.getDeclaredFields
is non-deterministic, andGetDeclaredFilelds
is ultimately used in thecom.alibaba.testable.core.util.TypeUtil.getAllFields
I converted the result to aHashSet
to avoid ordering issues, so the specific ordering of the fields would not affect the result. I think this change can prevent test failure due to future changes in the JVM.这个测试里的
should_generate_member_index
是不稳定的。原因是在com.alibaba.testable.core.util.TypeUtil.getAllFields
使用了java.lang.Class.getDeclaredFields
。而GetDeclaredFilelds
的结果是非确定的。未来JVM的改变可能这会影响这个测试的结果(返回的顺序可能会改变。)用HashSet
去比较结果可以避免相关的问题。