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. |