void () { // Expect error in case when it happens inside the resource itself doTest( """ class X implements AutoCloseable { @Override public void close() {} private static void example() { <warning descr="'X' used without 'try'-with-resources statement">createPossiblyDependantResource</warning>(); } private static X createPossiblyDependantResource() { return null; } }"""); }