[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Q: interposing on calls to superclass constructors
|
Hi,
does AspectJ allow me to interpose on calls to superclass constructors?
For example, consider the following anonymous class:
File f = new File("name") { }
which, in bytecode, contains the following constructor:
Method name:"<init>" Signature: (java.lang.String)void
0: aload_0
1: aload_1
2: invokespecial <Method java.io.File.<init> (java.lang.String)void>
5: return
I would like to capture the superclass invocation in an 'around'
advice so I can manipulate the second argument (here:
java.lang.String, the 'name' passed to the java.io.File(String))
constructor.)
I tried the following, but this pointcut only captures direct
constructor calls, not those occurring in subclass constructors.
pointcut FileCreation(String fname):
call(java.io.File.new (String)) && args(fname);
java.io.File around(String name) : FileCreation(name) {
return proceed(toGlobalName(name));
}
What is the correct pointcut to express this?
Thanks!
- Godmar