Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -557,6 +558,12 @@ public static StructField getStandardStructFieldRef(String fieldName,
*/
public static Field[] getDeclaredNonStaticFields(Class<?> c) {
Field[] f = c.getDeclaredFields();
Arrays.sort(f, new Comparator<Field>() {
@Override
public int compare(Field a, Field b) {
return a.getName().compareTo(b.getName());
}
});
Comment on lines +561 to +566
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This almost seems like a test requirement rather than doing it in production code. Can't we pass the fields in sorted order within the test?

ArrayList<Field> af = new ArrayList<Field>();
for (int i = 0; i < f.length; ++i) {
if (!Modifier.isStatic(f[i].getModifiers())) {
Expand Down
Loading