groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Dawson <>
Subject Re: "Not handled exceptions" inspection?
Date Thu, 24 Mar 2016 14:10:09 GMT
To take a different point of view. The debate was had, checked exceptions

Every language designed since Java was released and this was seen as a
problem has explicitly removed checked exceptions. Go event went to the
point of removing exceptions altogether.

Checked exceptions mixed the problems of *documenting failure conditions* and
*recovery.  *These aren't the same thing, and what happened in java is that
unrecoverable problems (network failures, io problems) are thrown as
exceptions, alongside the recoverable ones. This debased the potential
value of checked exceptions.

Java got it wrong, and is stuck with the legacy of that decision. Witness
the ugliness of lambda streams and IO. Yuck.

I loved it when spring allowed my to generically handle exceptions through
it's runtime exception based wrappers. They still put them on the method
sigs, so you get documentation.  Groovy took that to the next level,
implementing that across the entire runtime.   This was a *good decision*

To the original point. I think it might be informative to understand what
the use case is. A redesign of the components will probably mean you can
get the benefit you want without bringing checked exceptions back into

On 24 March 2016 at 14:01, Schalk Cronjé <> wrote:

> Checked exceptions remain a debatable point. Some people like them, some
> don't. A lot of viewpoints depends on the background of the specific
> people. There is no correct answer, however.
> On 24/03/2016 13:32, Jochen Theodorou wrote:
>> On 23.03.2016 22:37, Libor Jelinek wrote:
>>> Hello Groovy community!
>>> Is there some tool like groovyc warning / IDEA inspections / CodeNarc
>>> that will report situation when some method declares exception but you
>>> (a method user) don't re-declare nor catch it.
>>> I find it extremely useful. Because if for Groovy are exceptions are
>>> unchecked, it effectively negates all benefits of have exceptions. To be
>>> honest exceptions are the only part of Java that I really miss in Groovy.
>> The benefit of exceptions is not, that you are then reminded of having to
>> catch them, but that they allow you to jump out of faulty code to error
>> handling places. But anyway.. no, the compiler does not check that. I guess
>> you could write a transform or an extension to the type checker to add such
>> a check. But there are no plans for anything like that atm
>> bye Jochen
> --
> Schalk W. Cronjé
> Twitter / Ello / Toeter : @ysb33r


David Dawson | CEO | Simplicity Itself

Tel +44 7866 011 256
Skype: davidadawson

View raw message