void (final MethodVisitor mv) { new SwitchGenerator<String>() { @Override void generateCaseBody(String exceptionClass) { mv.visitTypeInsn(NEW, exceptionClass); mv.visitInsn(DUP_X1); mv.visitInsn(SWAP); mv.visitMethodInsn(INVOKESPECIAL, exceptionClass, CONSTRUCTOR_NAME, EXCEPTION_INIT_SIGNATURE, false); } @Override String getSwitchedValue(ReportingPlace place) { return place.exceptionClass; } }.generateSwitch(mv); }