diff options
-rw-r--r-- | test/031-class-attributes/expected.txt | 4 | ||||
-rw-r--r-- | test/031-class-attributes/src/ClassAttrs.java | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/test/031-class-attributes/expected.txt b/test/031-class-attributes/expected.txt index 4ae1eeda96..de99872b52 100644 --- a/test/031-class-attributes/expected.txt +++ b/test/031-class-attributes/expected.txt @@ -33,8 +33,8 @@ abstract final [LClassAttrs$PackagePrivateInnerInterface; enclosingMeth: null modifiers: 1 package: null - declaredClasses: [10] class ClassAttrs$PublicMemberClass, class ClassAttrs$MemberClass, interface ClassAttrs$PackagePrivateInnerInterface, interface ClassAttrs$PrivateInnerInterface, interface ClassAttrs$ProtectedInnerInterface, interface ClassAttrs$PublicInnerInterface, class ClassAttrs$PackagePrivateInnerClass, class ClassAttrs$PrivateInnerClass, class ClassAttrs$ProtectedInnerClass, class ClassAttrs$PublicInnerClass - member classes: [3] class ClassAttrs$PublicMemberClass, interface ClassAttrs$PublicInnerInterface, class ClassAttrs$PublicInnerClass + declaredClasses: [10] class ClassAttrs$MemberClass, class ClassAttrs$PackagePrivateInnerClass, class ClassAttrs$PrivateInnerClass, class ClassAttrs$ProtectedInnerClass, class ClassAttrs$PublicInnerClass, class ClassAttrs$PublicMemberClass, interface ClassAttrs$PackagePrivateInnerInterface, interface ClassAttrs$PrivateInnerInterface, interface ClassAttrs$ProtectedInnerInterface, interface ClassAttrs$PublicInnerInterface + member classes: [3] class ClassAttrs$PublicInnerClass, class ClassAttrs$PublicMemberClass, interface ClassAttrs$PublicInnerInterface isAnnotation: false isAnonymous: false isArray: false diff --git a/test/031-class-attributes/src/ClassAttrs.java b/test/031-class-attributes/src/ClassAttrs.java index ae8b2f56da..977a05f1a6 100644 --- a/test/031-class-attributes/src/ClassAttrs.java +++ b/test/031-class-attributes/src/ClassAttrs.java @@ -9,6 +9,9 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; public class ClassAttrs { ClassAttrs() { @@ -323,19 +326,27 @@ public class ClassAttrs { * Convert an array of Type into a string. Start with an array count. */ private static String stringifyTypeArray(Type[] types) { + List<String> typeStringList = new ArrayList<String>(); + for (Type t : types) { + typeStringList.add(t.toString()); + } + // Sort types alphabetically so they're always printed in the same order, whichever + // tool generated the DEX file of the test. + Collections.sort(typeStringList); + StringBuilder stb = new StringBuilder(); boolean first = true; stb.append("[" + types.length + "]"); - for (Type t: types) { + for (String typeString : typeStringList) { if (first) { stb.append(" "); first = false; } else { stb.append(", "); } - stb.append(t.toString()); + stb.append(typeString); } return stb.toString(); |