summaryrefslogtreecommitdiffstats
path: root/aspectj5rt/testsrc
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-04-29 20:19:21 +0000
committeracolyer <acolyer>2005-04-29 20:19:21 +0000
commita6291f59f0bd11e85b5018bb68d9d6e61ece43ec (patch)
treeacfcaa135e42e8a7b1ab39848a61eae0c20769a3 /aspectj5rt/testsrc
parent28a5bce27afc1b25460d6fe3273ae2e0272dd53e (diff)
downloadaspectj-a6291f59f0bd11e85b5018bb68d9d6e61ece43ec.tar.gz
aspectj-a6291f59f0bd11e85b5018bb68d9d6e61ece43ec.zip
updated for DeclareError and DeclareWarning
Diffstat (limited to 'aspectj5rt/testsrc')
-rw-r--r--aspectj5rt/testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java45
1 files changed, 43 insertions, 2 deletions
diff --git a/aspectj5rt/testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java b/aspectj5rt/testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java
index 89e65be4a..1ecd34516 100644
--- a/aspectj5rt/testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java
+++ b/aspectj5rt/testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java
@@ -8,14 +8,15 @@
*
* Contributors:
* Adrian Colyer initial implementation
- * ******************************************************************/package org.aspectj.internal.lang.reflect;
-
+ * ******************************************************************/
+package org.aspectj.internal.lang.reflect;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import junit.framework.TestCase;
+import org.aspectj.internal.lang.annotation.ajcDeclareEoW;
import org.aspectj.internal.lang.annotation.ajcPrivileged;
import org.aspectj.lang.annotation.AdviceName;
import org.aspectj.lang.annotation.After;
@@ -24,10 +25,13 @@ import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.DeclareError;
+import org.aspectj.lang.annotation.DeclareWarning;
import org.aspectj.lang.reflect.Advice;
import org.aspectj.lang.reflect.AdviceType;
import org.aspectj.lang.reflect.AjType;
import org.aspectj.lang.reflect.AjTypeSystem;
+import org.aspectj.lang.reflect.DeclareErrorOrWarning;
import org.aspectj.lang.reflect.NoSuchAdviceException;
import org.aspectj.lang.reflect.NoSuchPointcutException;
import org.aspectj.lang.reflect.PerClause;
@@ -288,6 +292,28 @@ public class AjTypeTestsWithAspects extends TestCase {
assertTrue(AjTypeSystem.getAjType(SimplePrivilegedAspect.MemberAspect.class).isMemberAspect());
}
+
+ public void testGetDeclareEoWarnings() {
+ DeclareErrorOrWarning[] deows = sa.getDeclareErrorOrWarnings();
+ assertEquals(4,deows.length);
+ boolean foundCodeWarning = false;
+ boolean foundCodeError = false;
+ boolean foundAnnWarning = false;
+ boolean foundAnnError = false;
+ for (DeclareErrorOrWarning deow : deows) {
+ if (deow.isError()) {
+ if (deow.getMessage().equals("dont call this method code")) foundCodeError = true;
+ if (deow.getMessage().equals("dont call this method ann")) foundAnnError = true;
+ assertEquals("call(* DontDoIt.*(..))",deow.getPointcutExpression());
+ } else {
+ if (deow.getMessage().equals("dont call this method code")) foundCodeWarning = true;
+ if (deow.getMessage().equals("dont call this method ann")) foundAnnWarning = true;
+ assertEquals("call(* DontDoIt.*(..))",deow.getPointcutExpression());
+ }
+ }
+ assertTrue(foundCodeWarning && foundAnnWarning && foundCodeError && foundAnnError);
+ }
+
}
@@ -352,6 +378,21 @@ class SimpleAspect {
@org.aspectj.lang.annotation.Pointcut("call(* SimpleAspect.*(..))")
private void ajc$pointcut$$simpleAspectCall$123(SimpleAspect target) {};
+ // decw, ann style
+ @DeclareWarning("call(* DontDoIt.*(..))")
+ public static final String dontDoIt = "dont call this method ann";
+
+ // decw, code style
+ @ajcDeclareEoW(pointcut="call(* DontDoIt.*(..))",message="dont call this method code",isError=false)
+ private void ajc$declare_eow$123() {}
+
+ // dec., ann style
+ @DeclareError("call(* DontDoIt.*(..))")
+ public static final String dontDoItISaid = "dont call this method ann";
+
+ // decw, code style
+ @ajcDeclareEoW(pointcut="call(* DontDoIt.*(..))",message="dont call this method code",isError=true)
+ private void ajc$declare_eow$124() {}
}
@Aspect