--- /dev/null
+public aspect LocalVarTableGen {
+
+ int x = 5;
+
+ public String foo(String s) {
+ String myLocal = "" + x + s;
+ return myLocal;
+ }
+
+ public String bar(String s) {
+ String myLocal = "" + x + s;
+ return myLocal;
+ }
+
+ before() : execution(* foo(..)) {
+ System.out.println("before foo");
+ }
+
+ after(String in) returning(String out) :
+ execution(* bar(..)) && args(in)
+ {
+ System.out.println("after bar");
+ }
+
+
+}
\ No newline at end of file
--- /dev/null
+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
runTest("double parameter generic abstract type");
}
+
+ public void testArgNamesInAdviceAnnotations() {
+ runTest("arg names in advice annotations");
+ }
+
/*
* Load-time weaving bugs
*/
assertNotNull("Should have some relationships but does not",l);
}
+
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
<run class="Simple" classpath="../lib/aspectj/lib/aspectjrt121.jar"/>
</ajc-test>
+ <ajc-test dir="java5/reflection" title="arg names in advice annotations">
+ <compile files="AdviceWithArgs.aj" options="-1.5"></compile>
+ <run class="AdviceWithArgs"/>
+ </ajc-test>
+
+
<ajc-test dir="java5/reflection" pr="114322" title="reflection on abstract ITDs (Billing example)">
<compile files="ReflectBilling.java,Billing.aj" options="-1.5"/>
<run class="ReflectBilling">