aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/MissingImport.java
blob: f5d8bd9cb94d1ab9c04e995b4ea95218551c6a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import org.aspectj.lang.*;
import org.aspectj.lang.reflect.*;
import java.lang.reflect.Method;
//import java.lang.reflect.InvocationTargetException; <- crash with this line commented out

public aspect MissingImport {
	Object around() : 
			call(* *(..)) &&  !within(ImposterProcessing+) {
		MethodSignature sig = (MethodSignature)thisJoinPoint.getSignature();
		try {
			Method meth = ImposterProcessing.class.getMethod("dynamicThrow",  new Class[] { Throwable.class });
				 meth.invoke(this, new Object[] { null });
			} catch (InvocationTargetException e) {  // expect CE
				 throw new RuntimeException("framework error in throwing test exception ", e);
			} catch (IllegalAccessException e) {
				 throw new RuntimeException("framework error in throwing test exception (IllegalAccess)");
			}
		return null;
	}
}

class ImposterProcessing { }