Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Array access


Christian,

You can advise array constructions (https://bugs.eclipse.org/bugs/show_bug.cgi?id=77166) and access. Unfortunately you cannot (yet) determine the index used when access and array or the identity of the element. In the example below the object traced is the array itself:

public class Test {

        private static int[] ints;
       
        public static void main(String[] args) {
                ints = new int[1];
                ints[0] = 999;
                System.out.println("Test.main() ints[0]=" + ints);
        }

}

public aspect Aspect {

        after() returning(Object ret): call(int[].new(..)) {
                System.out.println("Aspect.afterReturning() " + thisJoinPoint + ", ret=" + ret);
        }
       
        before (Object arg) : set(int[] *) && args(arg){
                System.out.println("Aspect.before() " + thisJoinPoint + ", arg=" + arg);
        }

        after () returning(Object ret) : get(int[] *) {
                System.out.println("Aspect.after() " + thisJoinPoint + ", ret=" + ret);
        }
}

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



"Wes" <wes@xxxxxxxxxxxxxx>
Sent by: aspectj-dev-bounces@xxxxxxxxxxx

11/09/2006 21:12

Please respond to
wes@xxxxxxxxxxxxxx; Please respond to
AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>

To
"AspectJ developer discussions" <aspectj-dev@xxxxxxxxxxx>
cc
Subject
Re: [aspectj-dev] Array access





This sounds like it should be an AspectJ enhancement request (if it isn't already):

 http://dev.eclipse.org/bugs/enter_bug.cgi?product=AspectJ

(Though I'm not sure where you're going with static/dynamic)

Wes

> ------------Original Message------------
> From: Christian Hammer <chammer@xxxxxxxxxx>
> To: aspectj-dev@xxxxxxxxxxx
> Date: Mon, Sep-11-2006 12:07 PM
> Subject: [aspectj-dev] Array access
>
>
> There has been some discussion on the semantics of the get/set
> pointcuts
> for access to an array cell. Currently, there is no differnence in the
> static/dynamic part of thisJoinPoint between a read and a write to an
> array
> cell as described in
> http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg02975.html
>
> I'm currently implementing a tracer with AspectJ, but it requires to be
> able to distinguish these two cases. It doesn't matter if they are both
> treated as get joinpoints, as long as the information is present. Would
> it
> be possible to enrich the JoinPoint information?
>
> -Chris
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top