diff --git a/src/share/classes/com/sun/tools/javadoc/Start.java b/src/share/classes/com/sun/tools/javadoc/Start.java index 44c55d19d015f2af99a5d2b6df1373a3b03de652..e26070180d5728d19b4a54a99036045b30672a83 100644 --- a/src/share/classes/com/sun/tools/javadoc/Start.java +++ b/src/share/classes/com/sun/tools/javadoc/Start.java @@ -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 subPackages = new ListBuffer(); ListBuffer excludedPackages = new ListBuffer(); - 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; diff --git a/test/tools/javadoc/6958836/Test.java b/test/tools/javadoc/6958836/Test.java index b14949f392de67f43241a93c2c38a1624a56edb5..75222700a988400e71578d876d4a8ca1e65b0b7f 100644 --- a/test/tools/javadoc/6958836/Test.java +++ b/test/tools/javadoc/6958836/Test.java @@ -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 */