Bug 269522 - [handles] Cross reference view and markers mix up joinpoints assigned to advice
Summary: [handles] Cross reference view and markers mix up joinpoints assigned to advice
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Build (show other bugs)
Version: 1.6.4   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.6.4   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-20 10:24 EDT by paul freeman CLA
Modified: 2009-03-26 20:30 EDT (History)
3 users (show)

See Also:


Attachments
sample project (17.00 KB, application/zip)
2009-03-20 11:54 EDT, paul freeman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description paul freeman CLA 2009-03-20 10:24:07 EDT
Build ID: M20090211-1700

Steps To Reproduce:
I have two pieces of after advice in my aspect.  

In the cross reference view I see all of the joinpoints for both after advice selecting one of the after advice statements.  When I select the other after advice statement I see no joinpoints.

When I select the marker for either piece of after advice, I see all the joinpoints for both pieces of advice.

1. open and perform a clean compile on the attached project
2. open the xref view
3. select line 22 an note that you see 5 joinpoints (should only be 3)
4. select line 68 and note that you see zero joinpoints (should be 2 here)
5. right click the marker at line 68 and choose "advises" - note you see all 5 joinpoints
6. right click the marker at line 22 and choose "advises" - note you see all 5 joinpoints


More information:
Comment 1 Andrew Eisenberg CLA 2009-03-20 11:36:07 EDT
Do you have a test case for this?  Or at least the pointcuts and advice you are using?
Comment 2 paul freeman CLA 2009-03-20 11:54:46 EDT
Created attachment 129472 [details]
sample project

sorry... I thought I had attached the project with the initial report.  I guess it didn't take.
Comment 3 Andrew Eisenberg CLA 2009-03-26 13:21:41 EDT
This is a handles problem.  Both aspect advice have the same handle:

=EnforceProcess/src<com.kronos.aspects*ProcessAspect.aj}ProcessAspect&after&QMyProcessor;

However, the second advice should have the handle:
=EnforceProcess/src<com.kronos.aspects*ProcessAspect.aj}ProcessAspect&after&QMyProcessor;!2

However, interesting thing is that when I trim the aspect down to this the problem goes away and all handles are generated correctly:

public aspect ProcessAspect perthis(initMyProcessor(MyProcessor)) {

	HashMap<String, Field> fieldList = new HashMap<String, Field>();
	
	pointcut initMyProcessor(MyProcessor myProcessor) : initialization(MyProcessor+.new(..)) && this(myProcessor);
	
	pointcut executesProcess(MyProcessor myProcessor) : execution(* MyProcessor+.process()) && this(myProcessor);
	
	// find all of the public fields or fields with public accessors
	after(MyProcessor myProcessor): initMyProcessor(myProcessor) {  
	}
	
	
	after(MyProcessor myProcessor): executesProcess(myProcessor) && !cflowbelow(executesProcess(MyProcessor)){
	}

}
Comment 4 Andrew Eisenberg CLA 2009-03-26 13:23:07 EDT
Moving this over to AspectJ because it is a handles problem.
Comment 5 Andrew Clement CLA 2009-03-26 14:07:44 EDT
the problem here is that the after method signatures are in fact different.  One advice uses thisJoinPointStaticPart and the other does not - this introduces an extra parameter to the advice signature and thus they are considered different.  I have to build in tolerance for this extra parameter and disregard it in advice signature counter calculations. 

In fact I have to build in tolerance for up to 3 parameters - thisJoinPoint, thisJoinPointStaticPart, thisEnclosingJoinPointStaticPart.  The advice knows how many extra params were added, but in creation of the program element that information is lost so for now we will just strip them based on well known names (a better future fix would be to pass that data across to the programelement).  The current fix could break if someone actively wrote an advice signature that specified a join point type... but who on earth would do that.

I wonder how many users have been hitting this problem?  Seems relatively serious so important to get this fix out fast.
Comment 6 Andrew Clement CLA 2009-03-26 15:05:15 EDT
proposed fix is committed into AspectJ and AJDT - should be in an AJDT build later today
Comment 7 Andrew Clement CLA 2009-03-26 20:30:27 EDT
tested the scenario described at the top of the bug report and this works fine on the latest AJDT dev build.