[abc-users] Allowing ArrayRef as left-hand side operands for around-weaving

From: Bruno Harbulot <bruno.harbulot@cs.man.ac.uk>
Date: Thu Nov 18 2004 - 14:45:50 GMT

Hello,

I have implemented a small abc extension that provides a pointcut for
catching setting elements of an array.
It works more or less as if an assignment to an array were a call to a
"set(int index, Object newValue)" method.
It is then possible to write code like this :

before(int i, Object s, Object[] a): arrayset() && args(i, s) && target(a) {
    System.out.println (" Arrayset: ["+i+"/"+(a.length-1)+"] = "+s) ;
}

It works fine, but I was unable to write around aspects without changing
some of the original abc code.
I had to add a condition in findReturnedLocal() in
AdviceApplicationInfo, which is a sub-sub-class of
abc.weaving.weaver.AroundWeaver (in the part that deals with "set" and
AssignStmt):

else if ((leftOp instanceof FieldRef && rightOp instanceof Local) ||
          (leftOp instanceof ArrayRef) || // Added this test.
          (leftOp instanceof FieldRef && rightOp instanceof Constant)) {

Was there a particular reason for this case to be excluded in the first
place, or is it just because it is not one of the standard AspectJ
possible cases ? Should I submit a bug report with a patch ?

I must also say that abc is great for implementing this kind of extension.

Best regards,

Bruno.
Received on Thu Nov 18 14:44:44 2004

This archive was generated by hypermail 2.1.8 : Fri Nov 19 2004 - 13:00:03 GMT