JDK-7148025 : javac should not warn about InterruptedException on the declaration of AutoCloseable itself
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-02-23
  • Updated: 2012-03-19
  • Resolved: 2012-03-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b29Fixed
Related Reports
Relates :  
Description
As part of warnings cleanup day, it was noted that javac -Xlint:all will warn about the declaration of java.lang.AutoCloseable.close being about to throw InterruptedException.

Since this is a required part of the platform, it is neither helpful not necessary for javac to warn about this particular close method.

Comments
SUGGESTED FIX # HG changeset patch # User darcy # Date 1330019589 28800 # Node ID 3ad851a7e884be99f18bbfed5a9909e9a3636e39 # Parent be456f9c64e818161c789252145d4ddc292ae863 7148025: javac should not warn about InterrupttedException on the declaration of AutoCloseable itself Reviewed-by: mcimadamore --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat Feb 18 16:12:28 2012 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Feb 23 09:53:09 2012 -0800 @@ -1146,7 +1146,8 @@ public class Attr extends JCTree.Visitor void checkAutoCloseable(DiagnosticPosition pos, Env<AttrContext> env, Type resource) { if (!resource.isErroneous() && - types.asSuper(resource, syms.autoCloseableType.tsym) != null) { + types.asSuper(resource, syms.autoCloseableType.tsym) != null && + !types.isSameType(resource, syms.autoCloseableType)) { // Don't emit warning for AutoCloseable itself Symbol close = syms.noSymbol; boolean prevDeferDiags = log.deferDiagnostics; Queue<JCDiagnostic> prevDeferredDiags = log.deferredDiagnostics;
23-02-2012

PUBLIC COMMENTS See http://hg.openjdk.java.net/jdk8/tl/langtools/rev/3ad851a7e884
23-02-2012

EVALUATION A fine idea.
23-02-2012