aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-01-30 17:24:37 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-01-30 17:24:37 +0100
commit28f0c4c4b042a47fc2ee3323d3b8d90329991426 (patch)
treed6e417b49664a7d7a1a9a25bfd1e8bb0888af410
parent025dd0e76e692ad68bc206a14fd1895d90ea2686 (diff)
downloadlombok-28f0c4c4b042a47fc2ee3323d3b8d90329991426.tar.gz
lombok-28f0c4c4b042a47fc2ee3323d3b8d90329991426.tar.bz2
lombok-28f0c4c4b042a47fc2ee3323d3b8d90329991426.zip
[website] added a line about how sneakythrows doesn't really help you much with lambdas; a common question.
-rw-r--r--website/templates/features/SneakyThrows.html2
1 files changed, 2 insertions, 0 deletions
diff --git a/website/templates/features/SneakyThrows.html b/website/templates/features/SneakyThrows.html
index 5a2d5bbd..5f5c06df 100644
--- a/website/templates/features/SneakyThrows.html
+++ b/website/templates/features/SneakyThrows.html
@@ -14,6 +14,8 @@
</li>
</ul>
</p><p>
+ Being constrained by needlessly strict interfaces is particularly common when using lambda syntax (<code>arg -> action</code>); however, lambdas cannot be annotated, which means it is not so easy to use <code>@SneakyThrows</code> in combination with lambdas.
+ </p><p>
Be aware that it is <em>impossible</em> to catch sneakily thrown checked types directly, as javac will not let you write a catch block for an exception type that no method call in the try body declares as thrown. This problem is not relevant in either of the use cases listed above, so let this serve as a warning that you should not use the <code>@SneakyThrows</code> mechanism without some deliberation!
</p><p>
You can pass any number of exceptions to the <code>@SneakyThrows</code> annotation. If you pass no exceptions, you may throw any exception sneakily.