7148025: javac should not warn about InterrupttedException on the declaration of AutoCloseable itself
authordarcy
Thu, 23 Feb 2012 09:53:09 -0800
changeset 12013 fdcc73079b81
parent 11872 c51754cddc03
child 12014 9515b1eb2a87
7148025: javac should not warn about InterrupttedException on the declaration of AutoCloseable itself Reviewed-by: mcimadamore
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 05 18:03:20 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 23 09:53:09 2012 -0800
@@ -1146,7 +1146,8 @@
 
     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;