summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-12 07:44:14 +0000
committeracolyer <acolyer>2005-08-12 07:44:14 +0000
commita5da69fd4e851e2937b71a83ae20561bfce172ba (patch)
treea758210d5223aa9f5fcbb86f0f49ad37353241a2 /tests/java5/annotations
parentcd43895e3e7b7f68721247d5d1761933c640fce8 (diff)
downloadaspectj-a5da69fd4e851e2937b71a83ae20561bfce172ba.tar.gz
aspectj-a5da69fd4e851e2937b71a83ae20561bfce172ba.zip
patch from David Knibb (IBM) to make test more resilient to JVM differences in toString() implementation on annotations
Diffstat (limited to 'tests/java5/annotations')
-rw-r--r--tests/java5/annotations/itds/AtItd4.aj32
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/java5/annotations/itds/AtItd4.aj b/tests/java5/annotations/itds/AtItd4.aj
index 5484406e0..33788a829 100644
--- a/tests/java5/annotations/itds/AtItd4.aj
+++ b/tests/java5/annotations/itds/AtItd4.aj
@@ -25,15 +25,17 @@ public class AtItd4 {
Annotation[] as = m.getDeclaredAnnotations();
System.err.println("Number of annotations "+
(as==null?"0":new Integer(as.length).toString()));
- Annotation aa = m.getAnnotation(Ann.class);
+ Ann aa = m.getAnnotation(Ann.class);
System.err.println("Ann.class retrieved is: "+aa);
String exp =
- "@Ann(strings=[a, b], enumval=A, aLong=6, id=goodbye, anInt=4)";
+// "@Ann(strings=[a, b], enumval=A, aLong=6, id=goodbye, anInt=4)";
+ "@Ann(id=goodbye, anInt=4, aLong=6, strings=[a,b], enumval=A)";
- if (!aa.toString().equals(exp))
+ if(!matches(aa)) {
throw new RuntimeException("Incorrect output, expected:"+exp+
" but got "+aa.toString());
+ }
if (as.length==0)
throw new RuntimeException("Couldn't find annotation on member!");
@@ -43,4 +45,28 @@ public class AtItd4 {
}
}
+ private static boolean matches(Ann anotayshun){
+ if(!anotayshun.id().equals("goodbye")){
+ return false;
+ }
+ if(anotayshun.anInt() != 4){
+ return false;
+ }
+ if(anotayshun.aLong() != 6){
+ return false;
+ }
+ if(anotayshun.strings().length != 2){
+ return false;
+ }
+ if(!anotayshun.strings()[0].equals("a") || !anotayshun.strings()[1].equals("b")) {
+ return false;
+ }
+ if(anotayshun.enumval() != SimpleEnum.A){
+ return false;
+ }
+ //they all match
+ return true;
+ }
+
+
}