Community
Participate
Working Groups
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.
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(..).
Created attachment 36400 [details] patch containing failing testcase Apply this patch to the tests project.
Created attachment 36401 [details] patch containing fix Apply this patch to the weaver project. Contains the fix described in previous comment.
Note that this is probably also going to happen for the other types of itds....this too needs fixing in the same way.
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 :-(
Created attachment 36405 [details] patch containing fix apply this patch to the weaver project. This patch fixes the method,constructor and field itd cases.
fixes checked in.
Closing as fixed - fixes available in latest aspectj build. Will soon be in AJDT.