関数を変更せずに無名関数を使用しない場合に例外をスローする必要がある以下のコードがあるとします。
FOO.doSomething(new Transactable(){
public void run(FOO foo) {
// How to proxy a exception throw
// from here, without modifying the class
}
});
好き:
@Override
public void run() throws MyCustomException{
FOO.doSomething(new Transactable(){
public void run(FOO foo) {
// How to proxy a exception throw
// from here, without modifying the class
}
});
}