Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8155591

Misleading warning when not overriding close method in interface extending AutoCloseable

    Details

      Description

      For the following code:

      interface Foo extends AutoCloseable {
      }

      javac will, when compiling with -Xlint, emit a slightly misleading/confusing warning:

      $ javac -Xlint Foo.java
      Foo.java:1: warning: [try] auto-closeable resource Foo has a member method close() that could throw InterruptedException
      public interface Foo extends AutoCloseable {
             ^
      1 warning

      Given that Foo doesn't even mention close() explicitly the warning is not as helpful as it could/should be.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sadayapalam Srikanth Adayapalam
                Reporter:
                mikael Mikael Vidstedt
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: