Java 関数が決して返らない (つまり、常にスローする) ことをコンパイラ (注釈またはその他) に認識させる方法はありますか?
単純化/構成された例を次に示します。
int add( int x, int y ) {
throwNotImplemented(); // compiler error here: no return value.
}
// How can I annotate (or change) this function, so compiling add will not yield
// an error since this function always throws?
void throwNotImplemented() {
... some stuff here (generally logging, sometimes recovery, etc)
throw new NotImplementedException();
}
ありがとうございました。