7148025: javac should not warn about InterrupttedException on the declaration of AutoCloseable itself
Reviewed-by: mcimadamore
--- 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;