src/share/classes/com/sun/tools/javac/comp/Flow.java

changeset 878
fa0e4e1916f4
parent 820
2d5aff89aaa3
child 880
0c24826853b2
equal deleted inserted replaced
877:351027202f60 878:fa0e4e1916f4
312 */ 312 */
313 void errorUncaught() { 313 void errorUncaught() {
314 for (PendingExit exit = pendingExits.next(); 314 for (PendingExit exit = pendingExits.next();
315 exit != null; 315 exit != null;
316 exit = pendingExits.next()) { 316 exit = pendingExits.next()) {
317 boolean synthetic = classDef != null && 317 if (classDef != null &&
318 classDef.pos == exit.tree.pos; 318 classDef.pos == exit.tree.pos) {
319 log.error(exit.tree.pos(), 319 log.error(exit.tree.pos(),
320 synthetic 320 "unreported.exception.default.constructor",
321 ? "unreported.exception.default.constructor" 321 exit.thrown);
322 : "unreported.exception.need.to.catch.or.throw", 322 } else if (exit.tree.getTag() == JCTree.VARDEF &&
323 exit.thrown); 323 ((JCVariableDecl)exit.tree).sym.isResourceVariable()) {
324 log.error(exit.tree.pos(),
325 "unreported.exception.implicit.close",
326 exit.thrown,
327 ((JCVariableDecl)exit.tree).sym.name);
328 } else {
329 log.error(exit.tree.pos(),
330 "unreported.exception.need.to.catch.or.throw",
331 exit.thrown);
332 }
324 } 333 }
325 } 334 }
326 335
327 /** Record that exception is potentially thrown and check that it 336 /** Record that exception is potentially thrown and check that it
328 * is caught. 337 * is caught.
1019 names.close, 1028 names.close,
1020 List.<Type>nil(), 1029 List.<Type>nil(),
1021 List.<Type>nil()); 1030 List.<Type>nil());
1022 if (closeMethod.kind == MTH) { 1031 if (closeMethod.kind == MTH) {
1023 for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) { 1032 for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) {
1024 markThrown(tree.body, t); 1033 markThrown(resource, t);
1025 } 1034 }
1026 } 1035 }
1027 } 1036 }
1028 } 1037 }
1029 } 1038 }

mercurial