[PRL] aspects to eliminate aspects

Jeffrey Palm jpalm at ccs.neu.edu
Wed May 18 14:01:22 EDT 2005


Matthias Felleisen wrote:
> 
> On May 18, 2005, at 12:12 PM, Pengcheng Wu wrote:
> 
>>
>> I bet you wanted the answers to both of the questions to be 'no'.
> 
> 
> I want them to be yes. Because then I can write classes that protect 
> themselves from advice using advice. And the title of the paper/note 
> would be
> 
>  Advice on how to use Advice to avoid Advice
> 
> -- Matthias
> 
> 
> _______________________________________________
> PRL mailing list
> PRL at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/prl
> 
> 

Well, looking again, you can do it by inspecting the stack.  You only 
need one advice, though, the before advice.  And just throw an exception 
if there is an aspect right above the class your protecting.

Here's some code:

   http://www.ccs.neu.edu/home/jpalm/Beans.java

The InterventionDiscoverer aspect throws an exception when an aspect is 
making a call, getting a field, or setting a field, in some advice on 
the class NO.  Of course, this is a complete hack and just catches cases 
where an aspect is doing something in an advise to class NO.  So, this 
misses the horrible situation when an aspect has placed around advice on 
a class and does nothing -- i.e. doesn't call proceed.

Jeff
-- 
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm



More information about the PRL mailing list