Community
Participate
Working Groups
class Test { public static void main(String args[]) { new Test().method(); } public void method() { new Test2().method2(); } } class Test2 { public void method2() {} } aspect Plain { before(Test x): call(void *.* (..)) && (this(x) || target(x)) { } }
For this bug I propose the same solution we used for args() (bug 61568) which will make this a proper compile time error. Fundamentally we are saying that you aren't allowed to bind more than once to a formal - this doesn't seem *too* unreasonable. Current proposal for the message is: C:\temp\ajcSandbox\ajcTest16749.tmp\PR65319.java:9:0 Cannot use target() to match at this location and bind a formal to type 'Test2' - the formal is already bound to type 'Test'. The secondary source location points to the problematic target(). see also: C:\temp\ajcSandbox\ajcTest16749.tmp\PR65319.java:16 If there is a compelling use case we could look at perhaps supporting this properly, but without one we'll stick to outputting an error.
Proposed fix checked in. Message isn't great but its better than a crash at weave time.
Fix available in: BUILD COMPLETE - build.334 Date of build: 08/10/2004 18:17:11 Time to build: 92 minutes 34 seconds Last changed: 08/10/2004 17:33:42 Latest good AspectJ jar available at: download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar
Fix released as part of AspectJ 1.2.1