Thursday, October 19, 2006

MANIFEST.MF: Runtime/Exported Packages matters!

when writing an Eclipse plugin, be sure to put the packages used by other plugin into Runtime/Exported Packages, otherwise you will get an error like:

An error occurred while automatically activating bundle pointcoach.core (482).

Tuesday, October 17, 2006

outline of weaving process of AspectJ compiler

1. BcelWeaver.prepareForWeave()
-> collect all shadowMungers into shadowMungerList, where shadowMungers
are advices and checkers.
2. BcelWeaver.weave(..)
-> apply fastMatch, delete obvious mismatching mungers
-> if the set of mungers is not empty, call BcelClassWeaver.weave(..)
3. BcelClassWeaver.weave() -> iterate through each shadow, try matching for each munger.
...


Creating ShadowMungers,
===================
[BcelWeaver]
xcutSet.addOrReplaceAspect(type);
[CrosscuttingMembersSet]
aspectType.collectCrosscuttingMembers(inWeavingPhase);
[ResolvedType]
crosscuttingMembers.addShadowMungers(collectShadowMungers());
...
acc.addAll(ty.getDeclaredShadowMungers());
** Here, only advices are added as ShadowMunger **

shadowMungerList = xcutSet.getShadowMungers();

Fast match before full match, deleting unmatched ShadowMungers
===============================================
[BcelWeaver]
fastMatch(shadowMungerList, classType.getResolvedTypeX())
but interestingly: FastMatchInfo info = new FastMatchInfo(type, null);
don't know the effect of applying fastmatch here...

in BcelWeaver.weave(UnwovenClassFile classFile, BcelObjectType classType, boolean dump),
if shadowMungers is empty, that is, there are no advices and checkers, shadows will not even be created.