Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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. }