K& B 7 chapter on Exceptions says that Language designers added AutoCloseable because Closeable Interface throw only IOException and they wanted to have something more generic. If this was their motive , they might have as well modified the Closeable Interface and changed IOException to Exception.
Would it caused any problem in terms of backword compatibility ? I think it should not because Closeable interface has close with IOException, so any class using Closeable will have IOException or subclass and even if they chagne Closeable's close to Exception, the code will still compile and run. Am i missing
something here ?
OCPJP 6, OCEWCD 6, OCEEJB 6, OCPJP 7 (in progress)
It would have broken backward compatibility. If Closeable#close would have been changed to throw Exception, then every caller that calls #close on a Closeable reference and only catches IOException would no longer compile.