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.

MissingImport.java 848B

12345678910111213141516171819202122
  1. import org.aspectj.lang.*;
  2. import org.aspectj.lang.reflect.*;
  3. import java.lang.reflect.Method;
  4. //import java.lang.reflect.InvocationTargetException; <- crash with this line commented out
  5. public aspect MissingImport {
  6. Object around() :
  7. call(* *(..)) && !within(ImposterProcessing+) {
  8. MethodSignature sig = (MethodSignature)thisJoinPoint.getSignature();
  9. try {
  10. Method meth = ImposterProcessing.class.getMethod("dynamicThrow", new Class[] { Throwable.class });
  11. meth.invoke(this, new Object[] { null });
  12. } catch (InvocationTargetException e) { // expect CE
  13. throw new RuntimeException("framework error in throwing test exception ", e);
  14. } catch (IllegalAccessException e) {
  15. throw new RuntimeException("framework error in throwing test exception (IllegalAccess)");
  16. }
  17. return null;
  18. }
  19. }
  20. class ImposterProcessing { }