--- /dev/null 2009-07-06 20:02:10.000000000 -0700 +++ new/test/tools/javac/AutomaticResourceManagement/ArmLint.java 2010-07-14 01:57:49.000000000 -0700 @@ -0,0 +1,38 @@ +/* + * @test /nodynamiccopyright/ + * @bug 6911256 6964740 6965277 + * @author Joseph D. Darcy + * @summary Check that -Xlint:arm warnings are generated as expected + * @compile/ref=ArmLint.out -Xlint:arm -XDrawDiagnostics ArmLint.java + */ + +class ArmLint implements AutoCloseable { + public static void main(String... args) { + try(ArmLint r1 = new ArmLint(); + ArmLint r2 = new ArmLint(); + ArmLint r3 = new ArmLint()) { + r1.close(); // The resource's close + r2.close(42); // *Not* the resource's close + // r3 not referenced + } + + try(@SuppressWarnings("arm") ArmLint r4 = new ArmLint()) { + // r4 not referenced + } + } + + /** + * The AutoCloseable method of a resource. + */ + @Override + public void close () { + return; + } + + /** + * Not the AutoCloseable method of a resource. + */ + public void close (int arg) { + return; + } +}