Bug 108962 - Join Points not detected inside If PCD
Summary: Join Points not detected inside If PCD
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-07 13:41 EDT by Ron Bodkin CLA
Modified: 2007-10-23 09:13 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2005-09-07 13:41:22 EDT
AspectJ Development and 1.2.1 both do not advise join points that occur in an 
if pointcut descriptor. I believe that they should. E.g., compiling the 
following program should produce a warning but it produces no output.

public aspect Trivial {
    before() : if(foo()) {
    }
    public static boolean foo() {
        return true;
    }
    declare warning: call(* foo()): "calling foo";
}

The use case that motivated this is allowing dynamic enabling of aspects:
public abstract aspect Base {
  protected static final boolean isEnabled() {
      return false;
  }
    
  protected static aspect AspectControl
    pertypewithin(Base+) {
      public boolean enabled = true;
      boolean around() : 
        call(boolean Base.isEnabled()) {
          return enabled;            
      }
  }

  public static void main(String args[]) {
  } 
}

aspect Derived extends Base {
   before() : execution(* main(..)) && if(isEnabled()) {
	System.out.println("if true");
   }    
}
Comment 1 Adrian Colyer CLA 2005-09-08 04:20:52 EDT
tagging with M4...
Comment 2 Adrian Colyer CLA 2005-10-28 08:21:59 EDT
needs more thought about possible side-effects - not high enough priority to hold 1.5.0 RC1 for.
Comment 3 Andrew Clement CLA 2006-06-27 10:35:39 EDT
schedule some time in 1.5.3 timeframe to at least put some though into this...
Comment 4 Andrew Clement CLA 2006-10-17 04:42:53 EDT
bumped out.