Bug 259427 - Allow aspect instance members to be used in if() poincuts
Summary: Allow aspect instance members to be used in if() poincuts
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-19 20:35 EST by Ramnivas Laddad CLA
Modified: 2008-12-19 20:35 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 Ramnivas Laddad CLA 2008-12-19 20:35:54 EST
Currently, aspect instance variable can't be used directly inside an if() pointcut. For example, it is currently an error ("Cannot make a static reference to the non-static field") to do something like:

public aspect InstanceVariableIfCheck {
    private boolean enabled;

    before() : execution(* *(..)) && if(enabled) {
       ...
    }
}

That forces developers to do either:
before() : execution(* *(..)) && if(InstanceVariableIfCheck.aspectOf().enabled) {
   ...
}

or

before() : execution(* *(..)) {
   if(enabled) {
      ...
   }
}

The second style can be problematic for a newbie who may forget to call proceed() even when bypassing the advice logic.