2002-12-16 19:51:06 +01:00
|
|
|
import org.aspectj.testing.Tester;
|
|
|
|
|
2003-03-10 23:47:43 +01:00
|
|
|
public class WarningTest {
|
2002-12-16 19:51:06 +01:00
|
|
|
public static void main (String[] args) {
|
|
|
|
boolean passed = true;
|
|
|
|
try { ok(); }
|
|
|
|
catch (Error e) { passed = false; }
|
|
|
|
Tester.check(passed, "did not catch error");
|
2003-03-10 23:47:43 +01:00
|
|
|
}
|
2002-12-16 19:51:06 +01:00
|
|
|
|
|
|
|
public static void ok() {
|
|
|
|
try {
|
2003-03-10 23:47:43 +01:00
|
|
|
throw new Error();
|
2002-12-16 19:51:06 +01:00
|
|
|
} catch(Error e) { } // CW 14 per aspect
|
|
|
|
}
|
|
|
|
static aspect A {
|
2003-03-10 23:47:43 +01:00
|
|
|
declare warning : withincode(void WarningTest.ok())
|
2002-12-16 19:51:06 +01:00
|
|
|
&& (handler(Error)) : "warning";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|