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.

pr130869.aj 816B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. abstract aspect AbstractSystemArchitecture {
  2. public abstract pointcut inMyApplication();
  3. // more pointcuts below...
  4. }
  5. aspect MySystemArchitecture extends AbstractSystemArchitecture {
  6. public pointcut inMyApplication() : within(SomeClass);
  7. }
  8. abstract aspect NoDirectlyRunnableClasses<A extends AbstractSystemArchitecture> {
  9. declare warning : execution(public static void main(String[])) &&
  10. A.inMyApplication()
  11. : "no directly runnable classes";
  12. }
  13. aspect NoRunnablesInMyApp extends NoDirectlyRunnableClasses<MySystemArchitecture> {
  14. }
  15. class SomeClass {
  16. public static void main(String[] args) { // CW L30
  17. System.out.println("hello");
  18. }
  19. }
  20. class SomeOtherClass {
  21. public static void main(String[] args) { // no warning
  22. System.out.println("hello");
  23. }
  24. }