Bug 131932 - structure model bug: generic method ITD
Summary: structure model bug: generic method ITD
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.1   Edit
Assignee: Helen Beeken CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-15 09:45 EST by Andrew Clement CLA
Modified: 2012-04-03 16:01 EDT (History)
0 users

See Also:


Attachments
patch containing failing testcase (4.08 KB, patch)
2006-03-16 06:38 EST, Helen Beeken CLA
no flags Details | Diff
patch containing fix (734 bytes, patch)
2006-03-16 06:38 EST, Helen Beeken CLA
no flags Details | Diff
failing testcase patch (7.56 KB, patch)
2006-03-16 08:27 EST, Helen Beeken CLA
aclement: iplog+
Details | Diff
patch containing fix (2.56 KB, patch)
2006-03-16 08:28 EST, Helen Beeken CLA
aclement: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2006-03-15 09:45:01 EST
import java.util.List;

public aspect Slide74 {

	public X Bar<X>.getFirst() {
		return lts.get(0);
	}
	
	static class Bar<T> {
		List<T> lts;
	}
}

in AJDT, this program incorrectly shows the relationship from the TYPE to the Bar class rather than from the ITD to the Bar class.
Comment 1 Helen Beeken CLA 2006-03-16 06:36:49 EST
The problem is occuring because the ResolvedTypeMunger used when adding the ITD relationships doesn't have a sourcelocation. The sourcelocation of the originating aspect is then used which is why the arrows appear against the type rather than the itd.

The reason this is happening is the call to ResolvedType.fillInAnyTypeParameters(munger) during the weaving process. Within this method we replace munger with the value of munger.parameterizedFor(actualTarget). At this point, munger is a BcelTypeMunger whose parameterizedFor(..) method returns a new BcelTypeMunger whose own munger is calculated via the NewMethodTypeMunger.parameterizeFor(..) method. This creates a new NewMethodTypeMunger with the correct signature, however, doesn't set the sourcelocation. The constructor for the BcelTypeMunger doesn't do anything with sourcelocations (unlike the EclipseTypeMunger which we are the first time we do all this) and so the sourcelocation remains null. The fix is to set the sourcelocation before returning from NewMethodTypeMunger.parameterizeFor(..).
Comment 2 Helen Beeken CLA 2006-03-16 06:38:10 EST
Created attachment 36400 [details]
patch containing failing testcase

Apply this patch to the tests project.
Comment 3 Helen Beeken CLA 2006-03-16 06:38:55 EST
Created attachment 36401 [details]
patch containing fix

Apply this patch to the weaver project.

Contains the fix described in previous comment.
Comment 4 Helen Beeken CLA 2006-03-16 06:47:17 EST
Note that this is probably also going to happen for the other types of itds....this too needs fixing in the same way.
Comment 5 Helen Beeken CLA 2006-03-16 08:27:25 EST
Created attachment 36404 [details]
failing testcase patch

Apply this patch to the tests project.

This testcase tests method, constructor and field itds...it's a little large :-(
Comment 6 Helen Beeken CLA 2006-03-16 08:28:15 EST
Created attachment 36405 [details]
patch containing fix

apply this patch to the weaver project.

This patch fixes the method,constructor and field itd cases.
Comment 7 Andrew Clement CLA 2006-03-16 10:32:17 EST
fixes checked in.
Comment 8 Helen Beeken CLA 2006-03-20 11:10:44 EST
Closing as fixed - fixes available in latest aspectj build. Will soon be in AJDT.