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.

AroundAccess.java 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import org.aspectj.testing.Tester;
  2. /** @testcase Bugzilla Bug 29662
  3. VerifyError on accessing objects not accessible to the weaver: Incompatible object argument for invokespecial
  4. */
  5. public class AroundAccess {
  6. public static void main(String args[]) throws Throwable {
  7. AroundAccess ve = new AroundAccess();
  8. ve.foo();
  9. Tester.checkEqual(FinalizeContract.fromAround, "s3:2,ME");
  10. }
  11. protected void foo() throws Throwable {}
  12. }
  13. class Foo {
  14. private static int x;
  15. }
  16. aspect FinalizeContract {
  17. public static String fromAround;
  18. pointcut finalizeCall(Object o):
  19. this(Object+) &&
  20. this(o) &&
  21. execution(void foo());
  22. void around(Object o) throws Throwable: finalizeCall(o) {
  23. String p = getS(3.14, 2); // + Foo.x;
  24. fromAround = p + "," + toString();
  25. Tester.checkNotEqual(super.toString(), toString());
  26. proceed(o);
  27. counter++;
  28. }
  29. private String getS(double d, int i) { return "s" + ((int)d) + ":" + i; }
  30. public String toString() { return "ME"; }
  31. private long counter = 0;
  32. }