Bug 88862 - Declare annotation on ITDs
Summary: Declare annotation on ITDs
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 1.5.0 M2   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-23 09:47 EST by Andrew Clement CLA
Modified: 2005-03-24 11:43 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 Andrew Clement CLA 2005-03-23 09:47:03 EST
I'll use this bug to capture info on the implementation...
Comment 1 Andrew Clement CLA 2005-03-23 16:34:20 EST
What a pig of a feature - now checked in...

First change is in ResolvedMember.  
- I've added the ability for it to manage annotations.  
- Also, I've added a flag that can be specified on resolvedmembers which
indicates its' annotations can be found elsewhere. 

Why did I need the latter option?  This is because for ITDs we create fake
resolvedmembers that look like the original declaration (e.g. "int A.m()") but
have no annotations.  Managing the annotations on these fake resolvedmembers as
well as on the real members in the original aspect would be expensive, so
setting this flag can indicate that for a particular member you should look
elsewhere for the annotations - the caller has to do the hunting.  This is used
to support field ITDs.
The flag is not serialized (so the binary format isn't affected), it is set
correctly when the NewFieldTypeMunger is constructed from the attributes in the
class file.

Info that will help you understand the rest of the changes:
ITDs are represented by 'bunches' of methods, some put in the target type, some
put in the aspect.  Annotations are stored against just *one* of these methods,
and that being one of those placed in the aspect - if any of the other methods
are encountered we have to go back to the aspect to ask this special method what
the annotations are.

BcelClassWeaver has had the following changes.
- Cache introduced from resolvedmembers (from effective signature attributes) to
arrays of annotation types.  The cache shouldn't get very large as it is only
populated for ITD constructs, not all resolvedmembers.
- weaving of dec@ into methods and fields has been extended for ITDs, I've put
in quite a few guards and optimizations where I can.
- I got rid of field-execution join points
- I modified the match logic to discover the annotations for ITD'd methods -
this uses the cache I introduced.

BcelShadow
- initializeKindedAnnotationVars improved to take account of ITD'd members.

LazyMethodGen
- removed one layer of annotation indirection! (we were caching the set at too
many layers - now there is one less)

AnnotationPointcut
- For field ITDs this goes back to the aspect to discover the annotation set

SignaturePattern
- For field ITDs this goes back to the aspect to discover the annotation set
Comment 2 Andrew Clement CLA 2005-03-24 11:43:27 EST
Feature available, see download page:

aspectj-DEVELOPMENT-20050324155000.jar

fully supported in forthcoming AJDT build...