jOOQ / jOOL

jOOλ - The Missing Parts in Java 8 jOOλ improves the JDK libraries in areas where the Expert Group's focus was elsewhere. It adds tuple support, function support, and a lot of additional functionality around sequential Streams. The JDK 8's main efforts (default methods, lambdas, and the Stream API) were focused around maintaining backwards compatibility and implementing a functional API for parallelism.
http://www.jooq.org/products
Apache License 2.0
2.08k stars 167 forks source link

Add Sneaky, a mirror of Unchecked, which uses RETHROW_ALL as the default exception handler #260

Closed kfh closed 8 years ago

kfh commented 8 years ago

Now we need to explicitly use the RETHROW_ALL consumer to utilize sneaky throwing, instead we should have a wrapper class using sane defaults as with THROWABLE_TO_RUNTIME_EXCEPTION.

See also https://github.com/jOOQ/jOOL/pull/234

lukaseder commented 8 years ago

Thank you very much for your suggestion. I'm sorry, I'm not sure if I understand what you're requesting. Would you mind elaborating a bit?

kfh commented 8 years ago

Sure! Right now i'm doing it like this:

Unchecked.supplier(() -> throw new CheckedException(), Unchecked.RETHROW_ALL)

but i want to do:

Sneaky.supplier(() -> throw new CheckedException()) defaulting to RETHROW_ALL.

lukaseder commented 8 years ago

Oh, I see. Yeah, I like that approach, including the Sneaky class name, as that seems to have established itself to be the way to call it

Xaerxess commented 8 years ago

Out of curiosity: do you have some codegen for Sneaky and Unchecked, or is it handcrafted?

lukaseder commented 8 years ago

Handcrafted. Speaking about some really boring work... 😮. But to be honest, writing the code generator might've taken just as long