package test.basic; import javax.swing.*; import java.io.*; import javassist.*; import java.lang.reflect.*; class Around { hook AroundThrowingHook { AroundThrowingHook(method(..args)) { execution(method); } around throwing(IOException ex) { System.out.println("CATCHED EXCEPTION: "+ex.getMessage()); return null; } after throwing(IOException ex) { System.out.println("SHOULD NOT OCCUR!!!!!!!!!!!!! EXCEPTION: "+ex.getMessage()); } } hook AroundThrowingHook2 { AroundThrowingHook2(int method(int arg)) { execution(method); } around throwing(Exception ex) { System.out.println("CATCHED EXCEPTION: "+ex.getMessage()); return new Integer(arg+10); } } hook AroundReturningHook { AroundReturningHook(method(..args)) { execution(method); } around returning(Integer i) { System.out.println("around returning!"); int returnvalue = new Integer((int)(i.intValue()*0.9)).intValue(); return returnvalue; } } }