Friday 11 November 2016

Sad state of Java Lambdas and Checked Exceptions

Was looking into Java 8's functional programming features.

I instantly came across a problem that functional programming in Java 8 is incompatible with checked exceptions. Given Java’s obsession with checked exceptions this seems bizarre.

Evidence of this is found in the Java 8 UncheckedIOException class – if you look where/how this is used in the JDK it’s clear Oracle have hacked this into place to allow them to add functional stuff to their IO libraries.


It would seem that if Java programmers are going functional then they are also saying checked exceptions are effectively deprecated.

I'm no fan of checked exceptions but it would seem that Brian Goetz was aware of this in 2010 and despite that we're still in this situation. Perhaps it's the end of the road for checked exceptions?


No comments:

Post a Comment

Hardware Hacking

Since the last post here I've taken to a bit of further hardware hacking and most of this is recorded on Hackaday  https://hackaday.io/j...