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.

CatchSig.java 851B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Bugzilla Bug 37739
  3. Unexpected Xlint:unresolvableMember warning with withincode
  4. */
  5. public class CatchSig {
  6. CatchSig(Class type) {}
  7. CatchSig() {
  8. this(String.class);
  9. }
  10. public static void main(String[] args) {
  11. new CatchSig();
  12. new B().test();
  13. new B().test2();
  14. B.findClass();
  15. }
  16. }
  17. class B extends CatchSig {
  18. public B() {
  19. super(findClass());
  20. }
  21. static Class findClass() {
  22. return B.class;
  23. }
  24. public void test() {
  25. }
  26. public void test2() {
  27. test();
  28. }
  29. }
  30. aspect C {
  31. void around() :
  32. (call (void B.test()) &&
  33. withincode (void B.test2())) {
  34. System.out.println("test from test2");
  35. proceed();
  36. }
  37. before(): call(Class B.findClass()) {
  38. System.out.println("from: " + thisEnclosingJoinPointStaticPart);
  39. }
  40. before(): call(Class B.findClass()) && withincode(B.new()) {
  41. System.out.println("from B.new()");
  42. }
  43. }