aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/reflection
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-12-15 14:27:21 +0000
committeracolyer <acolyer>2005-12-15 14:27:21 +0000
commitf5104819f3199b747ce9a67951457dea1aee3e01 (patch)
tree3495e4d595b2e8391b513eb04c62c9ff743a5f7d /tests/java5/reflection
parent305786094b456b3d17b0d82abe4ab6fbd4f870bc (diff)
downloadaspectj-f5104819f3199b747ce9a67951457dea1aee3e01.tar.gz
aspectj-f5104819f3199b747ce9a67951457dea1aee3e01.zip
making the tests more resilient to legitimate cross-vm differences
Diffstat (limited to 'tests/java5/reflection')
-rw-r--r--tests/java5/reflection/ReflectBilling.java52
1 files changed, 45 insertions, 7 deletions
diff --git a/tests/java5/reflection/ReflectBilling.java b/tests/java5/reflection/ReflectBilling.java
index c93292cb1..1079417fb 100644
--- a/tests/java5/reflection/ReflectBilling.java
+++ b/tests/java5/reflection/ReflectBilling.java
@@ -1,3 +1,7 @@
+import java.util.Comparator;
+import java.util.Set;
+import java.util.TreeSet;
+
import org.aspectj.lang.reflect.*;
public class ReflectBilling {
@@ -5,14 +9,48 @@ public class ReflectBilling {
public static void main(String[] args) {
AjType<Billing> billingType = AjTypeSystem.getAjType(Billing.class);
InterTypeMethodDeclaration[] itdms = billingType.getDeclaredITDMethods();
- for(InterTypeMethodDeclaration itdm : itdms) {
- System.out.println(itdm);
- }
+
+ Set s = new TreeSet(new Comparator<InterTypeMethodDeclaration>() {
+ public int compare(InterTypeMethodDeclaration m1, InterTypeMethodDeclaration m2) {
+ if (m1 == m2) return 0;
+ int vis = (m1.getModifiers() - m2.getModifiers());
+ if (vis != 0) return vis;
+ int name = (m1.getName().compareTo(m2.getName()));
+ if (name != 0) return name;
+ try {
+ return (
+ m1.getTargetType().getJavaClass().getName().compareTo(
+ m2.getTargetType().getJavaClass().getName())
+ );
+ } catch (ClassNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ });
+ for (InterTypeMethodDeclaration itdm : itdms) { s.add(itdm); }
+ for (Object o : s) { System.out.println(o); }
+
InterTypeFieldDeclaration[] itdfs = billingType.getDeclaredITDFields();
- for(InterTypeFieldDeclaration itdf : itdfs) {
- System.out.println(itdf);
- }
- }
+
+ Set s2 = new TreeSet(new Comparator<InterTypeFieldDeclaration>() {
+ public int compare(InterTypeFieldDeclaration m1, InterTypeFieldDeclaration m2) {
+ if (m1 == m2) return 0;
+ int vis = (m1.getModifiers() - m2.getModifiers());
+ if (vis != 0) return vis;
+ int name = (m1.getName().compareTo(m2.getName()));
+ if (name != 0) return name;
+ try {
+ return (
+ m1.getTargetType().getJavaClass().getName().compareTo(
+ m2.getTargetType().getJavaClass().getName())
+ );
+ } catch (ClassNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ });
+ for (InterTypeFieldDeclaration itdf : itdfs) { s2.add(itdf); }
+ for (Object o : s2) { System.out.println(o); } }
} \ No newline at end of file