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.

DeclareError.java 404B

12345678910111213141516171819202122232425262728
  1. import org.aspectj.testing.Tester;
  2. public class DeclareError {
  3. public static void main(String[] args) {
  4. new C().bad();
  5. }
  6. }
  7. class C {
  8. public void m() {
  9. new C().bad();
  10. }
  11. public void bad() { }
  12. }
  13. class D {
  14. public void m() {
  15. new C().bad();
  16. }
  17. }
  18. aspect A {
  19. declare error: call(void C.bad()) && !within(C):
  20. "can only call bad from C";
  21. }