Bug 29201 - 'new' pointcut processing with presence of interfaces skips instance initializers
Summary: 'new' pointcut processing with presence of interfaces skips instance initiali...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-09 08:22 EST by Maxim Mossienko CLA
Modified: 2003-01-14 13:26 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 Maxim Mossienko CLA 2003-01-09 08:22:33 EST
for given interface/class/aspect ajc v. 1.0.6 produces code that skips instance
initialization by inserting 'return' after calling 'after' implementation for
interface initialization as shown below:
----------
/*   Generated by AspectJ version 1.0.6 */
class A implements IA {
  Integer a;
  A() {
    super();
    {
      aj$label1: if (true) Logging.aspectInstance.before0$ajc();
      Logging.aspectInstance.afterReturning0$ajc(((Object)(null)));
      return; // skipping instance initialization!
      this.a = new Integer(1);
    } 
    aj$label0: if (true) Logging.aspectInstance.before0$ajc();
    Logging.aspectInstance.afterReturning0$ajc(((Object)(null)));
    return;
  } 
  public void doIt() {
    System.out.println("in do it!");
  } 

}
----------

aspect Logging {
  pointcut LogIn(): 
    execution(new(..)) && 
    !within(Logging);

  before (): LogIn() {
    System.out.println("before");
  }

  after() returning (Object i): LogIn() {
    System.out.println("after");
  }

}

interface IA {
  void doIt();
}

class A implements IA {
  Integer a = new Integer(1);

  A() {
  }

  public void doIt() {
    System.out.println("in do it!");
  }
}
Comment 1 Jim Hugunin CLA 2003-01-14 13:26:19 EST
This bug has been fixed in the 1.1beta releases.  Even though this is a very 
serious bug, it is unlikely that it will be fixed in the 1.0.x branch of the 
compiler due to lack of time.  The source code is available for that branch if 
you wish to attempt a fix yourself.  We expect to have a 1.1 release candidate 
available in the next couple of weeks and would recommend switching to that 
version then -- or you could help us test even more by trying the beta3 
release that should be out today.