[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[aspectj-users] Q: interposing on calls to superclass constructors
|
- From: Godmar Back <godmar@xxxxxxxxx>
- Date: Wed, 2 Sep 2009 20:20:59 -0400
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=fwQcCjcVrAw5dmd0FStmCUZfeFyL2d2m/Ct7Nw0du58=; b=m4Km1tnLwzoMHiQIZro8oNTvqsKFFXXRITXkKdXM5OXEqCj8CQdy1RcXFQdHLubuLL cBJnhCtIAtw6A4Oil856slmgCxD0dP4T99oRTyHm6o8rqCxBlHezRvQNalILC+g20ZGx IqXt/A+tn6gRdGeRnnVbgD6BZVx8oGmbWZ+vU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=MMwFmylrDSpsqi4JB0VOMStxI4oIoInka9sX4YkGv0Q5OfPlbufZIcWvyFzkAuFBwC uICrfhjUwvX/Ev+/uUcXA9GhZ6V+tbzGmSTPt3tP4G78vhdkOfv8K8n/riujgqysmyM7 qbuxNt79Giq3b8KmUO8LrdE7SE5LvTTCdqM6U=
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