diff options
author | acolyer <acolyer> | 2005-11-29 20:45:38 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-11-29 20:45:38 +0000 |
commit | bf97cc20ba2315b0e72b239f66c20bc474984789 (patch) | |
tree | 1ca09eeea1deda7ac871a85aeb65ee5157624aac /tests/java5/reflection/AdviceWithArgs.aj | |
parent | 7cf0d6499ce9894015f192adb68cac3e5501148f (diff) | |
download | aspectj-bf97cc20ba2315b0e72b239f66c20bc474984789.tar.gz aspectj-bf97cc20ba2315b0e72b239f66c20bc474984789.zip |
tests for parameter name generation in advice annotations
Diffstat (limited to 'tests/java5/reflection/AdviceWithArgs.aj')
-rw-r--r-- | tests/java5/reflection/AdviceWithArgs.aj | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/java5/reflection/AdviceWithArgs.aj b/tests/java5/reflection/AdviceWithArgs.aj new file mode 100644 index 000000000..533b38012 --- /dev/null +++ b/tests/java5/reflection/AdviceWithArgs.aj @@ -0,0 +1,27 @@ +import org.aspectj.lang.annotation.*; +import java.lang.reflect.*; + +public aspect AdviceWithArgs { + + @SuppressAjWarnings + before(String s) : execution(* *(..)) && args(s) { + System.out.println(s); + } + + public static void main(String[] args) throws Exception { + Method[] meths = AdviceWithArgs.class.getMethods(); + boolean found = false; + for (Method meth : meths) { + if (meth.isAnnotationPresent(Before.class)) { + found = true; + Before bAnn = meth.getAnnotation(Before.class); + String argNames = bAnn.argNames(); + if (!argNames.equals("s")) { + throw new RuntimeException("Expected 's' but got '" + argNames + "'"); + } + break; + } + } + if (!found) throw new RuntimeException("Did not find expected advice annotation"); + } +}
\ No newline at end of file |