Ben, that concept has been keeping the sneakyThrows out so far, but
with the clear direction towards more interop with other languages
that run on the JVM, virtually all of which sneakyThrow everything,
you cannot make that assumption -anyway-. You must presume any method,
anywhere, can throw any exception.

Then there's the ways you can sneakythrow inside the JVM (Using either
generics or the .newInstance() workaround), or the sneakythrows
possibilities by mixing class files from different compile runs.

I attempted to make this argument (which boils down to: The complaints
you raise are ALREADY a fact of java life, so, unless you have a plan
to make those problems go away, I don't really see the point of them).
This resulted in a proposal to enforce checked exceptions. When I
raised the issue that this made languages like e.g. Scala impossible
to compile to class files, nobody cared.


Project Coin worries me sometimes.

On Jun 6, 12:26 am, Ben Schulz <ya...@gmx.net> wrote:
> > NB: For what it's worth, I suggested an elegant workaround for these
> > issues for project coin: allow a method to declare sneakyThrows in
> > addition to throws. The *ONLY* difference between throws and
> > sneakyThrows is that sneakyThrows is *NOT* part of the method
> > signature. e.g. if you sneakyThrow UnsupportedEncodingException, then
> > if your method body throws that exception, it'll bubble up as usual
> > (will not get wrapped into a RuntimeException), but, callers do not
> > need to handle it.
>
> I find it kind of ironic that in this very thread there is a code
> snippet that would break with this change, the offending line being
> "throw (IOException) e;  // only possibility left". The other problem
> with that idea is that you can have code such as
>
> try {
>     a(); // sneakyThrows E
>     b(); // throws E} catch(E e) {
>
>     // handle b() failing with E
>
> }
>
> There is a reason you are forced to wrap the checked exception, it's
> that callers make the assumption no checked exception is thrown unless
> it is part of the method signature.
>
> Having had the same idea at one point though, I'm not all for pooping
> on it.. ;)
>
> With kind regards
> Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javaposse@googlegroups.com
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to