title: AutoCloseable and throws exception
body: <p>The AutoCloseable has a method 'void close throws Exception'.
  Some suggest to extend this interface and override the close method and remove the Exception. See for instance the below link.</p>
  
  <p>But when i forget to put the statement in a try-with-resources statement is the close method than not called?</p>
  
  <ul>
  <li>In the try-with-resources the close is called</li>
  <li>In the stream api the close is called</li>
  <li>Automatically by java when for instance leaving the method in which the resource is created???</li>
  </ul>
  
  <p><strong>Additional information</strong>
  I've searched on the internet and looked at the documentation. Both suggested to remove the throws Exception statement. But my reaction to this suggestion is that when in the future someone in our project implements the new interface (without exception) and forgets to put them in the try-with-resource that we have a resource leak. For our project it's not a huge issue because we're using SonarQube which will mention the resource leak </p>
  
  <p>Example location:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/25959779/why-close-method-of-java-lang-autocloseable-throws-exception-but-close-method-o">Why close method of java.lang.AutoCloseable throws Exception, but close method of java.io.Closeable throws IOException?</a></li>
  </ul>