[abc-dev] Custom context exposure

From: Rodolfo Toledo <rtoledo_at_dcc.uchile.cl>
Date: Wed, 16 Apr 2008 01:52:47 -0400

Hi,

I'm working on a new kind of pointcut for AspectJ that introduces a
dynamic restriction (like a simplified if) and also exposes a custom
parameter to the advice. This is an example of this pointcut:

aspect XYZ{
   double around(double x) : customPointcut(x){
     ...
   }
}

The code above should generate something like:

double d;
if(someCondition){
    XYZ.aspectOf();
    d = XYZ.inline$0$around$0(customParameter);
}
else{
    ...
}

Right now, I've implemented the conditional part of the pointcut. But I
can't get the customParameter generation to work (customParameter can be
a method invocation, so it is not already available as a local var). I
have the following classes:

CustomPC_c (extends Pointcut_c)
   --> CustomPCCondition (this works OK, including its residue)
   --> CustomPCArgs

Instances of CustomPCCondition and CustomPCArgs are returned as a
conjunction using AndPointcut.construct by CustomPC_c.makeAIPointcut.

At this moment, I'm having problems trying to implement the matchesAt
method in CustomPCArgs as I don't really know how to implement the
Residue class I have to return.

The approach I'm using is trying to generate a local variable in the
Residue.codeGen method. Then, using this local variable I try to bind
the advice parameter name to the actual value of the variable using the
Residue.getAdviceFormalBindings.

The problem is that I get an InternalAroundError in this line:

abc.weaving.weaver.around.AdviceLocalMethod.modifyInterfaceInvocations(AdviceLocalMethod.java:141)

This makes me think that the local variable I'm trying to use in the
code generation is not accessible or something like that.

I tried changing the compilation output using "-around-force-closures"
to get another version of the error and I got:

Caused by: java.lang.NullPointerException
        at soot.AbstractValueBox.setValue(AbstractValueBox.java:42)

Which is caused by a null "local2" variable in ProceedMethod.java:317.
This is what makes me think about the variable not being accessible.

I realize that it might be difficult to discover the problem from my
description, but maybe I'm doing something obviously wrong. So, any
help is really appreciated.

Thanks in advance.
Rodolfo Toledo.
Received on Wed Apr 16 2008 - 06:52:15 BST

This archive was generated by hypermail 2.2.0 : Thu Apr 17 2008 - 03:40:17 BST