You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InterFieldArrays.java 633B

123456789101112131415161718192021222324252627
  1. import org.aspectj.testing.Tester;
  2. public class InterFieldArrays {
  3. public static void main(String[] args) {
  4. Foo foo = new Foo();
  5. Tester.checkEqual(foo.bar.length, 3);
  6. Tester.checkEqual(foo.bar1.length, 3);
  7. foo.bar2 = new int[] { 21, 22, 23};
  8. Tester.checkEqual(foo.bar2.length, 3);
  9. Tester.checkEqual(foo.bar[2], 3);
  10. Tester.checkEqual(foo.bar1[2], 13);
  11. Tester.checkEqual(foo.bar2[2], 23);
  12. int[] a = foo.getInts();
  13. }
  14. }
  15. class Foo { }
  16. aspect Bar {
  17. int[] Foo.bar = { 1, 2, 3 };
  18. int[] Foo.bar1 = new int[] { 11, 12, 13};
  19. int[] Foo.bar2 = null;
  20. int[] Foo.getInts() { return new int[] { 1, 2, 3}; }
  21. }