title: Break doesn't work in try with resources, but work in try without resources
body: <p>Break doesn't work in try with resources, but work in try <strong><em>without</em></strong> resources!<br>
  This is a simple example for this situation. I caught this "bug" in work project.
  When I use try without resources</p>
  
  <pre><code>try {
  Resources resources = getResources()
  // some code here, look below
  }
  </code></pre>
  
  <p>I have only one iteration of my cycle, and it's right because I have the condition "if true then break", but when I changed try without recourse on try WITH resources.</p>
  
  <pre><code>try (Resources resources = getResources()) {
      // some code here, look below
  }
  </code></pre>
  
  <p>I was shocked! The cycle became endless! Why?</p>
  
  <p>Full code:</p>
  
  <pre><code>public class Test {
              public static void testTryWithResAndBreak() {
                  while (true) {
                      System.out.println("we are in (while(true))");
                      try (Resources resources = getResources()) {
                          System.out.println("We are in try block");
                          if (true) {
                              System.out.println("We are in the if(true) now! Next step is break");
                              break;
                          }
                          System.out.println("OOOOO___OOOO WE ARE HERE!!!");
                          resources.writeSomething();
                      } catch (Exception e) {
                          System.out.println("Catched exception");
                      }
                  }
              }
              private static class Resources implements AutoCloseable {
                  @Override
                  public void close() throws Exception {
                      System.out.println("Resources closed");
                      throw new Exception("Exception after closed resources!");
                  }
  
                  public void writeSomething() {
                      System.out.println("i wrote something");
                  }
              }
  
              private static Resources getResources() {
                  return new Resources();
              }
  
              public static void main(String[] args) {
                  testTryWithResAndBreak();
              }
          }
  </code></pre>