mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-26 17:58:43 +02:00
29 lines
404 B
Java
29 lines
404 B
Java
![]() |
import org.aspectj.testing.Tester;
|
||
|
|
||
|
public class DeclareError {
|
||
|
public static void main(String[] args) {
|
||
|
new C().bad();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class C {
|
||
|
public void m() {
|
||
|
new C().bad();
|
||
|
}
|
||
|
|
||
|
public void bad() { }
|
||
|
}
|
||
|
|
||
|
class D {
|
||
|
public void m() {
|
||
|
new C().bad();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
aspect A {
|
||
|
declare error: call(void C.bad()) && !within(C):
|
||
|
"can only call bad from C";
|
||
|
}
|
||
|
|