S1181 (catch Throwable) is too broad?

Hi, I feel that S1181 Java rule regarding catching Throwable should be reconsidered. The statement itself seems correct; however, in some cases it’s per method contract that it “throws Throwable”. However bad design that is, it’s given, it’s not part of our code and we cannot make it any better - if we want to catch any checked exception, then any possible custom direct descendants of Object+Throwable are also by definition “checked”, and we have no choice than to write “catch Throwable”.

Hence, it’s not bad practice to write “catch Throwable” if the try statement body can potentially throw any Throwable. Rather, it may be considered bad practice to “throws Throwable” (unless the method actually throws custom Throwables); but that’s another rule, and it will only be triggered if such declaration exists in analyzed code, not some external library.

If I understand correctly your suggestion :
S1181 should not be triggered if any method in the try block is explicitely throwing a java.lang.Throwable ?

It should already be the case if the invoked method is properly resolved.
So can you please share an example of the false positive you think the rule is raising ?