private void errorReporter(ExecutionContext cx, Throwable throwable) { try { throw throwable; } catch (StopExecutionException e) { if (e.getReason() == Reason.Quit) { System.exit(0); } } catch (ScriptException e) { handleException(cx.getRealm(), e); } catch (UnhandledRejectionException e) { handleException(cx.getRealm(), e); } catch (StackOverflowError e) { handleException(cx.getRealm(), e); } catch (OutOfMemoryError e) { handleException(cx.getRealm(), e); } catch (InternalException e) { handleException(e); } catch (BootstrapMethodError e) { handleException(e.getCause()); } catch (UncheckedIOException e) { handleException(e.getCause()); } catch (Throwable e) { printStackTrace(System.err, e, options.stacktraceDepth); System.exit(1); } }
/** REPL: Loop */ private void loop() throws InterruptedException { Realm realm = newRealm(); World world = realm.getWorld(); TaskSource taskSource = createTaskSource(realm); for (; ; ) { try { world.runEventLoop(taskSource); return; } catch (StopExecutionException e) { if (e.getReason() == Reason.Quit) { System.exit(0); } } catch (ParserExceptionWithSource e) { handleException(e); } catch (ScriptException e) { handleException(realm, e); } catch (UnhandledRejectionException e) { handleException(realm, e); } catch (StackOverflowError e) { handleException(realm, e); } catch (OutOfMemoryError e) { handleException(realm, e); } catch (InternalException e) { handleException(e); } catch (BootstrapMethodError e) { handleException(e.getCause()); } catch (UncheckedIOException e) { handleException(e.getCause()); } } }
/** * Visitor method: print expression tree. * * @param prec The current precedence level. */ public void printExpr(JCTree tree, int prec) throws IOException { int prevPrec = this.prec; try { this.prec = prec; if (tree == null) print("/*missing*/"); else { tree.accept(this); } } catch (UncheckedIOException ex) { IOException e = new IOException(ex.getMessage()); e.initCause(ex); throw e; } finally { this.prec = prevPrec; } }
/** * Visitor method: print expression tree. * * @param prec The current precedence level. */ public void printExpr(JCTree tree, int prec) throws IOException { int prevPrec = this.prec; try { this.prec = prec; if (tree == null) print("/*missing*/"); else { consumeComments(tree.pos); tree.accept(this); int endPos = endPos(tree); consumeTrailingComments(endPos); } } catch (UncheckedIOException ex) { IOException e = new IOException(ex.getMessage()); e.initCause(ex); throw e; } finally { this.prec = prevPrec; } }