Bug 269850 - New instantiation model: perjoinpointperinstance
Summary: New instantiation model: perjoinpointperinstance
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows NT
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-24 13:18 EDT by Andrew Clement CLA
Modified: 2009-03-25 08:03 EDT (History)
1 user (show)

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-03-24 13:18:52 EDT
Name is poor, needs work.  The intention would be that for static join points there is a shared aspect instance whilst for non-static join points there is an aspect instance per object instance.

This is another spin off from bug 89009.  This needs some use cases before serious thought is put into the design.  Some proposed code generation approaches are shown in 89009 (comment 22).

The shared instance per static parts is possibly already workable through something like this:

aspect Foo pertypewithin(*) {

  int[] counter = new int[1000];

  before(): execution(* *(..)) && !this(Object) {
    // Access the counter per joinpoint shadow in advised types
    int i = counter[thisJoinPointStaticPart.getId()];
  }
}

The instance per non-static part is possibly already workable through something like this:

aspect Foo perthis(!within(Foo)) {

  int[] counter = new int[1000];

  before(): execution(* *(..)) {
    // access the unique counter for this aspect instance and this joinpoint
    // - a different 'this' will mean a different aspect instance
    // - a different joinpoint will mean a different id
    int i = counter[thisJoinPoint.getId()];
  }
}