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.
For more information see this exploration of exceptions and lambdas … https://webcache. googleusercontent.com/search? q=cache:Rr87XOyyA9wJ:https:// javadevguy.wordpress.com/2016/ 02/22/a-story-of-checked- exceptions-and-java-8-lambda- expressions/+&cd=8&hl=en&ct= clnk&gl=uk
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