suppressing ThrowableNotThrown on the called method, not the callsite
Answered
I've got a Java method that logs (etc.) information related to an issue and returns a checked exception encapsulating the problem. 90% of the time, I don't actually need to throw this exception. So 90% of the time, IntelliJ's "Result of foo() not thrown" inspection fires.
When I try to add @SuppressWarnings("ThrowableNotThrown") to foo(), it does nothing for all the callsites of foo. Is there a way to make this work, short of disabling the ThrowableNotThrown inspection globally, disabling it for that particular checked exception globally, or disabling it at each and every callsite?
Please sign in to leave a comment.
Hello Dan,
Seems currently it's not possible. Feel free to create feature request on YouTrack: http://youtrack.jetbrains.com/issues/IDEA.