aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/ataspectj
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-04-29 20:27:44 +0000
committeracolyer <acolyer>2005-04-29 20:27:44 +0000
commit0b7744f560fb4ff70b70884a4932c8ebeb603fd2 (patch)
tree97058fd9e5fe994deae165334c32edc75982bacb /tests/java5/ataspectj
parent9cc00566ff2209410037b752b47ca941fe6bf3dd (diff)
downloadaspectj-0b7744f560fb4ff70b70884a4932c8ebeb603fd2.tar.gz
aspectj-0b7744f560fb4ff70b70884a4932c8ebeb603fd2.zip
it's a whole new compiler in there...
Diffstat (limited to 'tests/java5/ataspectj')
-rw-r--r--tests/java5/ataspectj/annotationGen/BasicAdvice.aj10
-rw-r--r--tests/java5/ataspectj/annotationGen/Deow.aj19
2 files changed, 24 insertions, 5 deletions
diff --git a/tests/java5/ataspectj/annotationGen/BasicAdvice.aj b/tests/java5/ataspectj/annotationGen/BasicAdvice.aj
index 04fb00be7..1f485f382 100644
--- a/tests/java5/ataspectj/annotationGen/BasicAdvice.aj
+++ b/tests/java5/ataspectj/annotationGen/BasicAdvice.aj
@@ -67,19 +67,19 @@ public aspect BasicAdvice {
}
private static void checkBefore(Method method) {
- assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
+ assertTrue("expecting 2 annotations on before",method.getAnnotations().length == 2);
Before beforeAnnotation = method.getAnnotation(Before.class);
assertTrue("expecting execution(* *.*(..))",beforeAnnotation.value().equals("execution(* *.*(..))"));
}
private static void checkAfter(Method method) {
- assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
+ assertTrue("expecting 2 annotations on after",method.getAnnotations().length == 2);
After afterAnnotation = method.getAnnotation(After.class);
assertTrue("expecting call(* Integer.*(..))",afterAnnotation.value().equals("call(* Integer.*(..))"));
}
private static void checkAfterReturning(Method method) {
- assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
+ assertTrue("expecting 2 annotations on after returning",method.getAnnotations().length == 2);
AfterReturning afterAnnotation = method.getAnnotation(AfterReturning.class);
if (method.getParameterTypes().length == 1) {
// form with returning arg
@@ -95,7 +95,7 @@ public aspect BasicAdvice {
}
private static void checkAfterThrowing(Method method) {
- assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
+ assertTrue("expecting 2 annotations on after throwing",method.getAnnotations().length == 2);
AfterThrowing afterAnnotation = method.getAnnotation(AfterThrowing.class);
if (method.getParameterTypes().length == 1) {
// form with returning arg
@@ -111,7 +111,7 @@ public aspect BasicAdvice {
}
private static void checkAround(Method method) {
- assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
+ assertTrue("expecting 2 annotations on around",method.getAnnotations().length == 2);
Around aroundAnnotation = method.getAnnotation(Around.class);
assertTrue("expecting set(* foo)",aroundAnnotation.value().equals("set(* foo)"));
}
diff --git a/tests/java5/ataspectj/annotationGen/Deow.aj b/tests/java5/ataspectj/annotationGen/Deow.aj
new file mode 100644
index 000000000..8a50e33e3
--- /dev/null
+++ b/tests/java5/ataspectj/annotationGen/Deow.aj
@@ -0,0 +1,19 @@
+import org.aspectj.lang.reflect.*;
+
+public aspect Deow {
+
+ declare warning : call(* System.*(..)) : "dont call system methods";
+ declare error : call(* System.*(..)) : "dont call system methods";
+
+ public static void main(String[] args) {
+ AjType myType = AjTypeSystem.getAjType(Deow.class);
+ DeclareErrorOrWarning[] deows = myType.getDeclareErrorOrWarnings();
+ if (deows.length != 2) throw new RuntimeException("Excepting 2 deows, got: " + deows.length);
+ if (deows[0].isError()) throw new RuntimeException("Expecting a warning");
+ if (!deows[1].isError()) throw new RuntimeException("Expecting an error");
+ if (!deows[0].getMessage().equals("dont call system methods")) throw new RuntimeException("Bad message");
+ if (!deows[1].getMessage().equals("dont call system methods")) throw new RuntimeException("Bad message");
+ if (!deows[0].getPointcutExpression().equals("call(* java.lang.System.*(..))")) throw new RuntimeException("Bad pc: " + deows[0].getPointcutExpression());
+ if (!deows[1].getPointcutExpression().equals("call(* java.lang.System.*(..))")) throw new RuntimeException("Bad pc: " + deows[0].getPointcutExpression());
+ }
+} \ No newline at end of file