[PRL] aspects to eliminate aspects

Therapon Skotiniotis skotthe at ccs.neu.edu
Wed May 18 12:36:56 EDT 2005


On Wed, May 18, 2005 at 11:40:09AM -0400, Jeffrey Palm wrote:
> Matthias Felleisen wrote:
> >Question 1: Is it possible to write an aspect that monitors a class to 
> >discover the intervention of _other_ aspects?
> 

  ( I agree with Jeff's points below .. this is merely a solution within 
  AspectJ. I think Jeff's solution is not but I might be reading it wrong)
 
  As a quick a dirty solution, you can use the adviceexecution() poinctut 
  that captures the execution of any advice in your program. In conjuction 
  with a cflow on each method of the class you want to monitor. 
  
  Then use the interface to thisJoinPoint to get information about the 
  aspect that has an advice attached to a method. 
 
> Sure.  For example, in AspectJ, walk the bytecode at class loading time 
> or right after class initialization.
> 
> This is ugly: You could also place two pieces advice on every method not 
> in that aspect (the intervention discoverer).  One before advice that 
> walks the stack the see if the method one up is an aspect and two up is 
> the class in question.  If so throw an exception.  That exception is 
> caught by the second piece of advice, which is around advice.
> 
> >Question 2: If the answer is 'yes', is it possible to use the 
> >information to modify the program syntactically (via reflection, for 
> >example) so that aspects can no longer mess with the class?
> 
  You cannot make that kind of alteration using AspectJ alone. There is no 
  way to alter the chained advice on a method (as far as I know, although 
  if you can get to the closure argument between advice that could give you 
  close to a full MOP using aspects ... hmm interesting I might just try 
  that next). 
 
 -- Theo
 
> Rewrite the bytecode.
> 
> >-- Matthias
> >
> >
> >_______________________________________________
> >PRL mailing list
> >PRL at lists.ccs.neu.edu
> >https://lists.ccs.neu.edu/bin/listinfo/prl
> >
> >
> 
> 
> -- 
> Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm
> 
> _______________________________________________
> PRL mailing list
> PRL at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/prl



More information about the PRL mailing list