summaryrefslogtreecommitdiffstats
path: root/tests/bugs151/pr130869.aj
blob: c46e216403c673849994958d2237db2c5f85634f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
abstract aspect AbstractSystemArchitecture {

	public abstract pointcut inMyApplication();
	
	// more pointcuts below...
	
}

aspect MySystemArchitecture extends AbstractSystemArchitecture {
	
	public pointcut inMyApplication() : within(SomeClass);
	
}

abstract aspect NoDirectlyRunnableClasses<A extends AbstractSystemArchitecture> {
	
	declare warning : execution(public static void main(String[])) &&
	                  A.inMyApplication()
	                : "no directly runnable classes";

}

aspect NoRunnablesInMyApp extends NoDirectlyRunnableClasses<MySystemArchitecture> {
	
}


class SomeClass {

	public static void main(String[] args) {  // CW L30
		System.out.println("hello");
	}

}

class SomeOtherClass {

	public static void main(String[] args) {  // no warning
		System.out.println("hello");
	}

}