提交 45c901d1 编写于 作者: J jjg

8002168: Cleanup initialization of javadoc Messager

Reviewed-by: darcy
上级 35990e1d
......@@ -54,6 +54,8 @@ import static com.sun.tools.javac.code.Flags.*;
* @author Neal Gafter (rewrite)
*/
class Start {
/** Context for this invocation. */
private final Context context;
private final String defaultDocletClassName;
private final ClassLoader docletParentClassLoader;
......@@ -69,7 +71,7 @@ class Start {
private long defaultFilter = PUBLIC | PROTECTED;
private Messager messager;
private final Messager messager;
String docLocale = "";
......@@ -96,8 +98,8 @@ class Start {
PrintWriter noticeWriter,
String defaultDocletClassName,
ClassLoader docletParentClassLoader) {
Context tempContext = new Context(); // interim context until option decoding completed
messager = new Messager(tempContext, programName, errWriter, warnWriter, noticeWriter);
context = new Context();
messager = new Messager(context, programName, errWriter, warnWriter, noticeWriter);
this.defaultDocletClassName = defaultDocletClassName;
this.docletParentClassLoader = docletParentClassLoader;
}
......@@ -108,8 +110,8 @@ class Start {
Start(String programName, String defaultDocletClassName,
ClassLoader docletParentClassLoader) {
Context tempContext = new Context(); // interim context until option decoding completed
messager = new Messager(tempContext, programName);
context = new Context();
messager = new Messager(context, programName);
this.defaultDocletClassName = defaultDocletClassName;
this.docletParentClassLoader = docletParentClassLoader;
}
......@@ -219,16 +221,6 @@ class Start {
ListBuffer<String> subPackages = new ListBuffer<String>();
ListBuffer<String> excludedPackages = new ListBuffer<String>();
Context context = new Context();
// Setup a new Messager, using the same initial parameters as the
// existing Messager, except that this one will be able to use any
// options that may be set up below.
Messager.preRegister(context,
messager.programName,
messager.getWriter(Log.WriterKind.ERROR),
messager.getWriter(Log.WriterKind.WARNING),
messager.getWriter(Log.WriterKind.NOTICE));
Options compOpts = Options.instance(context);
boolean docClasses = false;
......@@ -368,6 +360,7 @@ class Start {
javaNames.append(arg);
}
}
compOpts.notifyListeners();
if (javaNames.isEmpty() && subPackages.isEmpty()) {
usageError("main.No_packages_or_classes_specified");
......@@ -401,10 +394,6 @@ class Start {
boolean ok = root != null;
if (ok) ok = docletInvoker.start(root);
Messager docletMessager = Messager.instance0(context);
messager.nwarnings += docletMessager.nwarnings;
messager.nerrors += docletMessager.nerrors;
// We're done.
if (compOpts.get("-verbose") != null) {
tm = System.currentTimeMillis() - tm;
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -23,7 +23,7 @@
/*
* @test
* @bug 6958836
* @bug 6958836 8002168
* @summary javadoc should support -Xmaxerrs and -Xmaxwarns
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册