Bug 307147 - method-call joinpoints in ITDs for private methods - missing!
Summary: method-call joinpoints in ITDs for private methods - missing!
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: 1.8.7   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-25 17:59 EDT by Andrew Clement CLA
Modified: 2015-09-03 17:22 EDT (History)
1 user (show)

See Also:


Attachments
simple testcase (1.42 KB, application/zip)
2015-09-02 05:22 EDT, Jany Belluz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2010-03-25 17:59:46 EDT
If you write a privileged aspect that contains an ITD on some type and that ITD calls a private method in that type *and* you are trying to advise calls to that private method, the joinpoint in the ITD will not be found.  This is vaguely similar to the problem in bug 307120 but there the issues was pipelining interfering (so that was a breakage introduced when pipelining was added), but here the problem is more serious and it has never worked in AspectJ.  A similar change to that made for 307120 can cause the lookup for a synthetic method to succeed in BcelClassWeaver.matchInvokeInstruction() but the call further down to declaredSig.getEffectiveSignature() will not find a declared signature attribute.

getEffectiveSignature is not implemented for the ResolvedMemberImpl that is discovered on jpSig.resolve(), it seems to only be supported for Bcel subtypes of Member.  The solution is probably to ensure the effective signature is set correctly for the resolved member that gets created.
Comment 1 Andrew Clement CLA 2010-04-30 13:56:03 EDT
only going to look at this when someone hits it...
Comment 2 Jany Belluz CLA 2015-09-02 05:22:50 EDT
Created attachment 256311 [details]
simple testcase

I hit this problem this week and having a fix or a workaround would be nice. Would the fix be hard to implement? Or, even if I can't match the private call with a standard pointcut, could I rewrite it to match anyway? I would not mind a messy pointcut as long as it advises the private call.

Thanks in advance for your feedback.
Comment 3 Andrew Clement CLA 2015-09-03 17:22:16 EDT
I pushed some changes to enable this. Unfortunately not the changes I originally thought I could do. I hoped to leverage the effective signature attribute but at the time we are weaving the ITD the target class may not have been through the weaver, so it will not have the accessor methods in it onto which the effective signature attribute can be attached.  The simpler/dirtier thing is to recognize this specific situation in the BcelClassWeaver.matchInvokeInstruction and handle it as a special case. All the other tests we have are fine with this change so committed it. I added one more testcase beyond the one attached here (thanks for that) - it could really do with more testing though. Perhaps in your real scenario things are more complicated than in the testcase - any problems then let me know.