コンパイルエラーになるケースと実行時エラーになるケースの分類。
コンパイルエラーになるケース
ラムダ式の型の不一致
BiFunction<Integer, Double, Integer> function = (x, y) -> x + y;
function.apply(1, 2.5);
(int)(x + y)
もしくは、 BiFunction<Integer, Double, Double>
に修正する必要がある。
実行時になるケース
FileInputStreamでreset()を呼び出し
FileInputStreamはreset()を呼び出せるがサポートはしていない。子クラスのBufferedInputStreamでサポートされる。
new FileInputStream("src/a/a.txt").reset();
//=> java.io.IOException: mark/reset not supported
親クラスのInputStreamのreset()
public synchronized void reset() throws IOException {
throw new IOException("mark/reset not supported");
}
子クラスのBufferedInputStreamのreset()
public synchronized void reset() throws IOException {
getBufIfOpen(); // Cause exception if closed
if (markpos < 0)
throw new IOException("Resetting to invalid mark");
pos = markpos;
}