mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-06 06:00:26 +00:00
8002168: Cleanup initialization of javadoc Messager
Reviewed-by: darcy
This commit is contained in:
parent
3bd08c5eff
commit
d50b720ecc
@ -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;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user