--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Jul 29 15:57:18 2010 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Jul 29 15:57:43 2010 +0100
@@ -37,6 +37,7 @@
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Resolve;
import com.sun.tools.javac.tree.JCTree.*;
import static com.sun.tools.javac.code.Flags.*;
@@ -187,6 +188,8 @@
private final Types types;
private final Check chk;
private TreeMaker make;
+ private final Resolve rs;
+ private Env<AttrContext> attrEnv;
private Lint lint;
private final boolean allowRethrowAnalysis;
@@ -205,6 +208,7 @@
types = Types.instance(context);
chk = Check.instance(context);
lint = Lint.instance(context);
+ rs = Resolve.instance(context);
Source source = Source.instance(context);
allowRethrowAnalysis = source.allowMulticatch();
}
@@ -998,15 +1002,21 @@
}
}
for (JCTree resource : tree.resources) {
- MethodSymbol topCloseMethod = (MethodSymbol)syms.autoCloseableType.tsym.members().lookup(names.close).sym;
List<Type> closeableSupertypes = resource.type.isCompound() ?
types.interfaces(resource.type).prepend(types.supertype(resource.type)) :
List.of(resource.type);
for (Type sup : closeableSupertypes) {
if (types.asSuper(sup, syms.autoCloseableType.tsym) != null) {
- MethodSymbol closeMethod = types.implementation(topCloseMethod, sup.tsym, types, true);
- for (Type t : closeMethod.getThrownTypes()) {
- markThrown(tree.body, t);
+ Symbol closeMethod = rs.resolveInternalMethod(tree,
+ attrEnv,
+ sup,
+ names.close,
+ List.<Type>nil(),
+ List.<Type>nil());
+ if (closeMethod.kind == MTH) {
+ for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) {
+ markThrown(tree.body, t);
+ }
}
}
}
@@ -1387,8 +1397,10 @@
/** Perform definite assignment/unassignment analysis on a tree.
*/
- public void analyzeTree(JCTree tree, TreeMaker make) {
+ public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
try {
+ attrEnv = env;
+ JCTree tree = env.tree;
this.make = make;
inits = new Bits();
uninits = new Bits();