Re: [abc-users] capturing aspects

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Tue, 22 Jul 2008 15:19:35 -0600

here are the two aspects

public aspect World {
   /**** int id: returns the id of the basic block ****/
 
   before(int id) : block() && !within(World) && args(id)
      {
          System.err.println("Entering Block --> "+id + " at "
          +thisJoinPoint.getSourceLocation() );
        
   }
  after(int id) : block() && !within(World) && args(id)
         {
             System.err.println("Exiting Block --> "+id + " at "
             +thisJoinPoint.getSourceLocation() );
   }
  
   before() : execution(* *.*(..)) && !within(World)
         {
             System.err.println("Execution " +thisJoinPoint);
   }
}

and

public aspect aPrime
{
    void around(): adviceexecution() && within(World)
    {
        // do nothing for now
    }
}

The block pointcut is my own creation that represents a basic block.
I tested the program using just the execution pointcut, and everything
went well.

Amjad

Eric Bodden wrote:
> That's a bug. Would it be possible for you to send your aspect(s) to this list?
>
> Eric
>
> 2008/7/22 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>
>> Hi again
>> I was happy to see the reply I got below, I'm only seeing stuff from my
>> perspective and forgot that there may be an easier way for warping as
>> aspect!!! I tried the adviseexecution pointcut on my aspect but the program
>> did not compile and gave me the following.
>>
>> Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
>> exception during weaving/optimisation
>> at abc.main.CompileSequence.runSequence(CompileSequence.java:142)
>> at abc.main.Main.run(Main.java:406)
>> at abc.main.Main.main(Main.java:144)
>> Caused by: java.lang.ClassCastException: soot.jimple.internal.JNopStmt at
>> abc.soot.util.Restructure.addParameterToMethod(Restructure.java:1086)
>>
>> at
>> abc.weaving.weaver.around.AdviceLocalClass.addParameters(AdviceLocalClass.java:119)
>> at
>> abc.weaving.weaver.around.AdviceLocalClass.addDefaultParameters(AdviceLocalClass.java:69)
>> at
>> abc.weaving.weaver.around.AdviceMethod.<init>(AdviceMethod.java:175)
>> at
>> abc.weaving.weaver.around.AroundWeaver.doWeave(AroundWeaver.java:138)
>>
>> at abc.weaving.aspectinfo.AroundAdvice.weave(AroundAdvice.java:162)
>> at
>> abc.weaving.weaver.PointcutCodeGen.weave_one(PointcutCodeGen.java:359)
>> at
>> abc.weaving.weaver.PointcutCodeGen.weaveInAspectsPass(PointcutCodeGen.java:109)
>> at abc.weaving.weaver.Weaver.weaveAdvice(Weaver.java:413)
>> at abc.weaving.weaver.Weaver.weave(Weaver.java:277)
>> at abc.main.CompileSequence.weave(CompileSequence.java:496)
>> at abc.main.CompileSequence.runSequence(CompileSequence.java:115)
>> ... 2 more
>>
>> does anyone have any idea what is wrong?
>>
>> Thanks
>> Amjad
>>
>> Julian Tibble wrote:
>>
>>>> I mislead you in referring to an already-woven aspect, what I really want
>>>> to do is to wrap an aspect as it is getting woven, with my own code. In
>>>> other words, for an aspect A that is getting woven, I want to weave in A',
>>>> where A' is [mycode]A[mycode].
>>>>
>>>>
>>> Would the following AspectJ do the trick without the need
>>> for compiler-hacking?
>>>
>>> aspect A'
>>> {
>>> void around(): adviceexecution() && within(A)
>>> {
>>> // mycode
>>> proceed();
>>> // mycode
>>> }
>>> }
>>>
>>> Julian
>>>
>>>
>>>
>>
>>
>
>
>
>
Received on Tue Jul 22 2008 - 22:19:42 BST

This archive was generated by hypermail 2.2.0 : Wed Jul 23 2008 - 02:10:12 BST