Details
Description
In the following code, the exception potentially thrown by the close() method need to be caught, or rethrown by the encapsulating method. Moreover, we can not remove the thrown exception without causing a compilation failure.
The implementation of rule RSPEC-1130 should cover cases where the close() method signature have been changed to throw another exception than IOException, and not raise issue.
import java.text.ParseException; public class A { public void parseExceptionCloseable() throws ParseException { // FP squid:RedundantThrowsDeclarationCheck try (ParseExceptionCloseable closeable = new ParseExceptionCloseable()) { // some code } } static class ParseExceptionCloseable implements AutoCloseable { @Override public void close() throws ParseException { throw new ParseException("", 0); } } }
Attachments
Issue Links
- relates to
-
RSPEC-1130 "throws" declarations should not be superfluous
- Active
- links to