Hi,
I
want to advise certain methods with an arbitrary number of formal parameters which
have arbitrary types.
My
advice calls a method foo(…) that runs in another JVM, so I cannot use proceed(…);
therefore I use reflection to invoke the method originally called. I am trying
to use AspectJ's varargs support to pass the arguments (all of them!) on
to foo(…), like this:
void around(Object[] varargs) :
call(* IPersistenceServices+.*(Object+...)) && args(varargs) {
System.out.println("Advice got woven!");
myServer.foo(varargs);
}
Note
the underlined part. This syntax (Object+…) seems to be in accordance
with the grammar described in the AspectJ/ADK 1.5 Notebook:
http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-pointcuts-and-advice.html#signaturePatterns
(MethodPattern
=> FormalsPattern => TypePattern '…' =>
SimpleTypePattern)
However,
the Eclipse IDE complains about a syntax error, and my aspect isn't woven.
I am using the 1.6.1 runtime with Equinox Aspects.
Of
course I could only match on (Object...),
i.e. without the plus, but that would mean constraining all methods that I want
to advise to declare an (Object...)
formal parameter, instead of e.g. (String...) or (MyType...)
However this would really be subpar, so it'd be great to have something
like the pointcut above.
Is
the "TypeName+…" syntax and behavior simply not supported, or
am I just doing it wrong?
Thanks
for any clarification or suggestions,
Yang