Bug 247319

Summary: Introduce marker interface "IsWeavable" for weavable types
Product: [Tools] AspectJ Reporter: Eric Bodden <eric>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Eric Bodden CLA 2008-09-15 13:35:04 EDT
I have a use case where I want to identify whether or not a class is weavable:

I am developing a data-race detection tool that tracks information about locks associated with objects using the lock/unlock pointcuts. If the type of the object that I lock is weavable, e.g. because I call a synchronized method of a weavable class then I can associate this information with the locked object using an ITD. If not, then I have to use *slower* hash maps. It would be great if I could have both.

My suggestion is to include a new marker interface "IsWeavable" which the AJ compiler automatically declares on all weavable types. That way I could have something like:

LockInfo IsWeavable.lockInfo; //ITD only for weavable classes

after(IsWeavable o): lock() && args(o) {
  //do stuff with o.lockInfo
}

after(Object o): lock() && args(o) && !args(IsWeavable) {
  //use a map to associate o with some lockInfo
}