Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import lombok.Lombok;
  2.  
  3. public class SneakyThrowsExample implements Runnable {
  4. public String utf8ToString(byte[] bytes) {
  5. try {
  6. return new String(bytes, "UTF-8");
  7. } catch (UnsupportedEncodingException e) {
  8. throw Lombok.sneakyThrow(e);
  9. }
  10. }
  11.  
  12. public void run() {
  13. try {
  14. throw new Throwable();
  15. } catch (Throwable t) {
  16. throw Lombok.sneakyThrow(t);
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement