Bug 65319 - ajc crashes when compiling the following program (binding this() and target())
Summary: ajc crashes when compiling the following program (binding this() and target())
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-02 10:29 EDT by c03sk CLA
Modified: 2004-10-21 04:31 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description c03sk CLA 2004-06-02 10:29:50 EDT
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))
	{
	}
}
Comment 1 Andrew Clement CLA 2004-08-09 12:35:19 EDT
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.
Comment 2 Andrew Clement CLA 2004-08-10 12:25:30 EDT
Proposed fix checked in.  Message isn't great but its better than a crash at
weave time.
Comment 3 Andrew Clement CLA 2004-08-11 03:25:47 EDT
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
Comment 4 Adrian Colyer CLA 2004-10-21 04:31:59 EDT
Fix released as part of AspectJ 1.2.1