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.

DeclaredExceptions.java 691B

12345678910111213141516171819202122232425262728
  1. import java.lang.reflect.Method;
  2. import java.io.*;
  3. import org.aspectj.testing.Tester;
  4. public class DeclaredExceptions {
  5. public static void main(String[] args) throws Exception {
  6. Class c = C.class;
  7. Method m = c.getDeclaredMethod("m", new Class[0]);
  8. Tester.checkEqual(m.getExceptionTypes().length, 1);
  9. Tester.checkEqual(m.getExceptionTypes()[0], IOException.class);
  10. c = I.class;
  11. m = c.getDeclaredMethod("m", new Class[0]);
  12. Tester.checkEqual(m.getExceptionTypes().length, 1);
  13. Tester.checkEqual(m.getExceptionTypes()[0], IOException.class);
  14. }
  15. }
  16. interface I {}
  17. class C {}
  18. aspect A {
  19. public void C.m() throws IOException {
  20. }
  21. public void I.m() throws IOException { }
  22. }