JavahTask( Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes) { this(); this.log = getPrintWriterForWriter(out); this.fileManager = fileManager; this.diagnosticListener = diagnosticListener; try { handleOptions(options, false); } catch (BadArgs e) { throw new IllegalArgumentException(e.getMessage()); } this.classes = new ArrayList<>(); if (classes != null) { for (String classname : classes) { Objects.requireNonNull(classname); this.classes.add(classname); } } }
int run(String[] args) { try { handleOptions(args); boolean ok = run(); return ok ? 0 : 1; } catch (BadArgs e) { diagnosticListener.report(createDiagnostic(e.key, e.args)); return 1; } catch (InternalError e) { diagnosticListener.report(createDiagnostic("err.internal.error", e.getMessage())); return 1; } catch (Util.Exit e) { return e.exitValue; } finally { log.flush(); } }
public void handleOptions(String[] args) throws BadArgs { handleOptions(Arrays.asList(args), true); }