Bug 266165 - Minimal analysis of if pcds to see if a reference is simply to a constant boolean
Summary: Minimal analysis of if pcds to see if a reference is simply to a constant boo...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 1.6.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 12:04 EST by Andrew Clement CLA
Modified: 2009-02-25 15:11 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2009-02-25 12:04:03 EST
if the constant is:

private static final boolean enabled = false;

and the pointcut is

public foo(): execution(* *(..)) && if(enabled);

then we should do enough analysis of the reference to enabled to know not to weave, particularly as this is the recommended way to turn off aspects.
Comment 1 Andrew Clement CLA 2009-02-25 15:11:42 EST
Not entirely trivial due to the body of the if being processed as a real method (given the name if_XXX).  However, I've implemented this now - for both FALSE (so we never weave) and TRUE (so we always weave and don't even call the if).

I had to add some information to the serialized form of an if pointcut, but luckily the bit flag had 2 spare bits I could use to represent this.