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.

PointcutLibraryTest.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * This test case produces a ClassFormatError under 1.1.0, but
  3. * the code is not set up to run/test correctly
  4. * after the bug is fixed.
  5. */
  6. /** @testcase PR#40876 subtype-qualified pointcut reference */
  7. public class PointcutLibraryTest {
  8. public static void main(String[] a) {
  9. new Test().run();
  10. }
  11. }
  12. class Test {
  13. public void run(){ prun(); }
  14. private void prun() {
  15. System.out.println("Test.prun()");
  16. }
  17. }
  18. /** private default implementation of library */
  19. class PrivatePointcutLibrary {
  20. pointcut adviceCflow() : !cflow(adviceexecution());
  21. pointcut publicCalls() : call(public * *(..))
  22. && !adviceCflow();
  23. }
  24. /** public interface for library */
  25. class PointcutLibrary extends PrivatePointcutLibrary {
  26. }
  27. // ---- different clients of the library
  28. /** use library by inheriting scope in class */
  29. class CPL extends PointcutLibrary {
  30. static aspect A {
  31. before() : publicCalls() {
  32. System.out.println("CPL: "
  33. + thisJoinPointStaticPart);
  34. }
  35. }
  36. }
  37. /** client by external reference to CPL */
  38. aspect ExternalClientOfCPL {
  39. before() : CPL.publicCalls() { // remove this to avoid bug?
  40. System.out.println("XDP: "
  41. + thisJoinPointStaticPart);
  42. }
  43. }