suppressing ThrowableNotThrown on the called method, not the callsite
已回答
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?
请先登录再写评论。
Hello Dan,
Seems currently it's not possible. Feel free to create feature request on YouTrack: http://youtrack.jetbrains.com/issues/IDEA.