diff --git a/lib/polyglot b/lib/polyglot index 2cf3bb81..2ff56c1a 160000 --- a/lib/polyglot +++ b/lib/polyglot @@ -1 +1 @@ -Subproject commit 2cf3bb81c4e35685a79429f7f1e7867e14947f80 +Subproject commit 2ff56c1aaa040a0ff5e751c63db6fc74d1ecc411 diff --git a/tests/isolated/FieldReflection.java b/tests/isolated/FieldReflection.java index 93662a57..1632f0a2 100644 --- a/tests/isolated/FieldReflection.java +++ b/tests/isolated/FieldReflection.java @@ -1,5 +1,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Comparator; public class FieldReflection { public int a; @@ -27,6 +29,7 @@ public static void main(String[] args) throws Exception { FieldReflection aaa = new FieldReflection(1534,2); Class cls = aaa.getClass(); Field[] f = cls.getDeclaredFields(); + Arrays.sort(f, new FieldComparator()); System.out.println(f.length); for (Field fld : f) { System.out.println(fld.getName()); @@ -70,4 +73,11 @@ public static void main(String[] args) throws Exception { static class FieldReflectionGen { T[] arr; } + + public static class FieldComparator implements Comparator { + public int compare(Field f1, Field f2) { + return f1.getName().compareTo(f2.getName()); + } + + } } diff --git a/tests/isolated/MethodReflection.java b/tests/isolated/MethodReflection.java index 6509bf41..a79bdac9 100644 --- a/tests/isolated/MethodReflection.java +++ b/tests/isolated/MethodReflection.java @@ -1,12 +1,16 @@ import java.lang.reflect.Method; import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.Comparator; class MethodReflection { public static void main(String[] args) throws Exception { MethodReflection mr = new MethodReflection(); Class cls = mr.getClass(); + MethodComparator mc = new MethodComparator(); Method[] m = cls.getDeclaredMethods(); + Arrays.sort(m, mc); for (Method mtd : m) { if (mtd.getName().equals("")) continue; System.out.println(mtd.getName()); @@ -26,4 +30,12 @@ public String ll(String s) { return "Called LL with "+s; } -} \ No newline at end of file + public static class MethodComparator implements Comparator { + + public int compare(Method m1, Method m2) { + return m1.getName().compareTo(m2.getName()); + } + + } + +}