Bug 131932

Summary: structure model bug: generic method ITD
Product: [Tools] AspectJ Reporter: Andrew Clement <aclement>
Component: CompilerAssignee: Helen Beeken <hlhawkins>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: DEVELOPMENT   
Target Milestone: 1.5.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch containing failing testcase
none
patch containing fix
none
failing testcase patch
aclement: iplog+
patch containing fix aclement: iplog+

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.