aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/DeclaredExceptions.java
blob: 9baec0c157eee615918941a58ec7cf84b5731802 (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
import java.lang.reflect.Method;
import java.io.*;
import org.aspectj.testing.Tester;

public class DeclaredExceptions {
	public static void main(String[] args) throws Exception {
		Class c = C.class;
		Method m = c.getDeclaredMethod("m", new Class[0]);
		Tester.checkEqual(m.getExceptionTypes().length, 1);
		Tester.checkEqual(m.getExceptionTypes()[0], IOException.class);
		
		c = I.class;
		m = c.getDeclaredMethod("m", new Class[0]);
		Tester.checkEqual(m.getExceptionTypes().length, 1);
		Tester.checkEqual(m.getExceptionTypes()[0], IOException.class);
	}
}

interface I {}

class C {}

aspect A {
	public void C.m() throws IOException {
	}
	
	public void I.m() throws IOException { }
}