Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Array initialization

There is a non-default compiler extension you can use:

---8<--- file A.java ---8<---
public class A {
  public static void main(String []argv) {
    Integer[][] Is = new Integer[5][2];
  }
}

aspect X {
  before(int a,int b): call(Integer[][].new(int,int)) && args(a,b) {
    System.err.println("Array dimensions = "+a+","+b);
  }
}
---8<---

$ ajc A.java -Xjoinpoints:arrayconstruction

$ java A
Array dimensions = 5,2


On 23/09/2007, Rui Carlos Gonçalves <rui.c.a.g@xxxxxxxxx> wrote:
> How can I capture an array initialization and the length specified in
> that initialization?
>
> For example, in
>
> Double[][] x = new Double[y][z];
>
> I want to know the value of y and z.
>
>
> Regards,
> Rui Carlos A. Gonçalves
>
> PS: sorry by bad english...
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top