1 /*
   2  * @test  /nodynamiccopyright/
   3  * @bug 6911256 6964740 6965277
   4  * @author Maurizio Cimadamore
   5  * @summary Resource of an intersection type crashes Flow
   6  * @compile ArmIntersection.java
   7  */
   8 
   9 interface MyCloseable extends AutoCloseable {
  10    void close() throws java.io.IOException;
  11 }
  12 
  13 class ResourceTypeVar {
  14 
  15     public void test() {
  16         try(getX()) {
  17             //do something
  18         } catch (java.io.IOException e) { // Not reachable
  19             throw new AssertionError("Shouldn't reach here", e);
  20         }
  21     }
  22 
  23     <X extends Number & MyCloseable> X getX() { return null; }
  24 }