8238437: Support separate locales for console messages and HTML content

Reviewed-by: prappo
This commit is contained in:
Jonathan Gibbons 2020-02-07 17:00:23 -08:00
parent faa88c1da6
commit 3461ce9800
28 changed files with 267 additions and 186 deletions

View file

@ -89,7 +89,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
this.typeElement = typeElement;
this.utils = configuration.utils;
this.contents = configuration.contents;
this.resources = configuration.resources;
this.resources = configuration.docResources;
this.links = writer.links;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -182,7 +182,7 @@ public class Contents {
* resources used to look up resource keys, and other details.
*/
Contents(HtmlConfiguration configuration) {
this.resources = configuration.getResources();
this.resources = configuration.getDocResources();
allClassesLabel = getNonBreakContent("doclet.All_Classes");
allImplementedInterfacesLabel = getContent("doclet.All_Implemented_Interfaces");

View file

@ -78,7 +78,7 @@ public class HtmlConfiguration extends BaseConfiguration {
*/
public static final String HTML_DEFAULT_CHARSET = "utf-8";
public final Resources resources;
public final Resources docResources;
/**
* First file to appear in the right-hand frame in the generated
@ -133,17 +133,31 @@ public class HtmlConfiguration extends BaseConfiguration {
*/
public HtmlConfiguration(Doclet doclet, Locale locale, Reporter reporter) {
super(doclet, locale, reporter);
resources = new Resources(locale,
// Use the default locale for console messages.
Resources msgResources = new Resources(Locale.getDefault(),
BaseConfiguration.sharedResourceBundleName,
"jdk.javadoc.internal.doclets.formats.html.resources.standard");
messages = new Messages(this);
// Use the provided locale for generated docs
// Ideally, the doc resources would be in different resource files than the
// message resources, so that we do not have different copies of the same resources.
if (locale.equals(Locale.getDefault())) {
docResources = msgResources;
} else {
docResources = new Resources(locale,
BaseConfiguration.sharedResourceBundleName,
"jdk.javadoc.internal.doclets.formats.html.resources.standard");
}
messages = new Messages(this, msgResources);
contents = new Contents(this);
options = new HtmlOptions(this);
String v;
try {
ResourceBundle rb = ResourceBundle.getBundle(versionBundleName, getLocale());
// the version bundle is not localized
ResourceBundle rb = ResourceBundle.getBundle(versionBundleName, Locale.getDefault());
try {
v = rb.getString("release");
} catch (MissingResourceException e) {
@ -166,10 +180,15 @@ public class HtmlConfiguration extends BaseConfiguration {
}
@Override
public Resources getResources() {
return resources;
public Resources getDocResources() {
return docResources;
}
/**
* Returns a utility object providing commonly used fragments of content.
*
* @return a utility object providing commonly used fragments of content
*/
public Contents getContents() {
return contents;
}
@ -335,12 +354,7 @@ public class HtmlConfiguration extends BaseConfiguration {
Character unicode = (tagLabel.length() == 0)
? '*'
: Character.toUpperCase(tagLabel.charAt(0));
List<SearchIndexItem> list = tagSearchIndexMap.get(unicode);
if (list == null) {
list = new ArrayList<>();
tagSearchIndexMap.put(unicode, list);
}
list.add(sii);
tagSearchIndexMap.computeIfAbsent(unicode, k -> new ArrayList<>()).add(sii);
}
tagSearchIndexKeys = tagSearchIndexMap.keySet();
}
@ -359,7 +373,7 @@ public class HtmlConfiguration extends BaseConfiguration {
if (options.charset() == null) {
options.setCharset(options.docEncoding());
} else if (!options.charset().equals(options.docEncoding())) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict", "-charset", "-docencoding"));
messages.error("doclet.Option_conflict", "-charset", "-docencoding");
return false;
}
}

View file

@ -213,7 +213,7 @@ public class HtmlDocletWriter {
this.options = configuration.getOptions();
this.contents = configuration.contents;
this.messages = configuration.messages;
this.resources = configuration.resources;
this.resources = configuration.docResources;
this.links = new Links(path);
this.utils = configuration.utils;
this.path = path;

View file

@ -33,15 +33,12 @@ import java.util.Set;
import java.util.TreeSet;
import com.sun.tools.doclint.DocLint;
import jdk.javadoc.doclet.Reporter;
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
import jdk.javadoc.internal.doclets.toolkit.Messages;
import jdk.javadoc.internal.doclets.toolkit.Resources;
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
import static javax.tools.Diagnostic.Kind.ERROR;
import static javax.tools.Diagnostic.Kind.WARNING;
/**
* Storage for all options supported by the
* {@link jdk.javadoc.doclet.StandardDoclet standard doclet},
@ -199,8 +196,8 @@ public class HtmlOptions extends BaseOptions {
@Override
public Set<? extends Option> getSupportedOptions() {
Resources resources = config.getResources();
Reporter reporter = config.getReporter();
Messages messages = config.getMessages();
Resources resources = messages.getResources();
List<Option> options = List.of(
new Option(resources, "--add-stylesheet", 1) {
@ -255,13 +252,11 @@ public class HtmlOptions extends BaseOptions {
@Override
public boolean process(String opt, List<String> args) {
if (noHelp) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-helpfile", "-nohelp"));
messages.error("doclet.Option_conflict", "-helpfile", "-nohelp");
return false;
}
if (!helpFile.isEmpty()) {
reporter.print(ERROR, resources.getText("doclet.Option_reuse",
"-helpfile"));
messages.error("doclet.Option_reuse", "-helpfile");
return false;
}
helpFile = args.get(0);
@ -281,8 +276,7 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
noHelp = true;
if (!helpFile.isEmpty()) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-nohelp", "-helpfile"));
messages.error("doclet.Option_conflict", "-nohelp", "-helpfile");
return false;
}
return true;
@ -302,8 +296,7 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
createIndex = false;
if (splitIndex) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-noindex", "-splitindex"));
messages.error("doclet.Option_conflict", "-noindex", "-splitindex");
return false;
}
return true;
@ -323,8 +316,7 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
noOverview = true;
if (overviewPath != null) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-nooverview", "-overview"));
messages.error("doclet.Option_conflict", "-nooverview", "-overview");
return false;
}
return true;
@ -344,8 +336,7 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
overviewPath = args.get(0);
if (noOverview) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-overview", "-nooverview"));
messages.error("doclet.Option_conflict", "-overview", "-nooverview");
return false;
}
return true;
@ -365,8 +356,7 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
splitIndex = true;
if (!createIndex) {
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-splitindex", "-noindex"));
messages.error("doclet.Option_conflict", "-splitindex", "-noindex");
return false;
}
return true;
@ -418,11 +408,11 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
String dopt = opt.replace("-Xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX);
if (dopt.contains("/")) {
reporter.print(ERROR, resources.getText("doclet.Option_doclint_no_qualifiers"));
messages.error("doclet.Option_doclint_no_qualifiers");
return false;
}
if (!DocLint.isValidOption(dopt)) {
reporter.print(ERROR, resources.getText("doclet.Option_doclint_invalid_arg"));
messages.error("doclet.Option_doclint_invalid_arg");
return false;
}
doclintOpts.add(dopt);
@ -435,7 +425,7 @@ public class HtmlOptions extends BaseOptions {
public boolean process(String opt, List<String> args) {
String dopt = opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE);
if (!DocLint.isValidOption(dopt)) {
reporter.print(ERROR, resources.getText("doclet.Option_doclint_package_invalid_arg"));
messages.error("doclet.Option_doclint_package_invalid_arg");
return false;
}
doclintOpts.add(dopt);
@ -450,7 +440,7 @@ public class HtmlOptions extends BaseOptions {
try {
new URL(docrootParent);
} catch (MalformedURLException e) {
reporter.print(ERROR, resources.getText("doclet.MalformedURL", docrootParent));
messages.error("doclet.MalformedURL", docrootParent);
return false;
}
return true;
@ -460,7 +450,7 @@ public class HtmlOptions extends BaseOptions {
new XOption(resources, "--no-frames") {
@Override
public boolean process(String opt, List<String> args) {
reporter.print(WARNING, resources.getText("doclet.NoFrames_specified"));
messages.warning("doclet.NoFrames_specified");
return true;
}
}
@ -477,14 +467,13 @@ public class HtmlOptions extends BaseOptions {
return false;
}
Resources resources = config.getResources();
Reporter reporter = config.getReporter();
Messages messages = config.getMessages();
// check if helpfile exists
if (!helpFile.isEmpty()) {
DocFile help = DocFile.createFileForInput(config, helpFile);
if (!help.exists()) {
reporter.print(ERROR, resources.getText("doclet.File_not_found", helpFile));
messages.error("doclet.File_not_found", helpFile);
return false;
}
}
@ -492,7 +481,7 @@ public class HtmlOptions extends BaseOptions {
if (!stylesheetFile.isEmpty()) {
DocFile stylesheet = DocFile.createFileForInput(config, stylesheetFile);
if (!stylesheet.exists()) {
reporter.print(ERROR, resources.getText("doclet.File_not_found", stylesheetFile));
messages.error("doclet.File_not_found", stylesheetFile);
return false;
}
}
@ -500,7 +489,7 @@ public class HtmlOptions extends BaseOptions {
for (String ssheet : additionalStylesheets) {
DocFile ssfile = DocFile.createFileForInput(config, ssheet);
if (!ssfile.exists()) {
reporter.print(ERROR, resources.getText("doclet.File_not_found", ssheet));
messages.error("doclet.File_not_found", ssheet);
return false;
}
}

View file

@ -234,7 +234,7 @@ public class LinkFactoryImpl extends LinkFactory {
* @return the tool tip for the appropriate class.
*/
private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) {
Resources resources = m_writer.configuration.getResources();
Resources resources = m_writer.configuration.getDocResources();
if (isTypeLink) {
return resources.getText("doclet.Href_Type_Param_Title",
utils.getSimpleName(typeElement));

View file

@ -97,7 +97,7 @@ public class SourceToHTMLConverter {
this.configuration = configuration;
this.options = configuration.getOptions();
this.messages = configuration.getMessages();
this.resources = configuration.resources;
this.resources = configuration.docResources;
this.utils = configuration.utils;
this.docEnv = rd;
this.outputdir = outputdir;

View file

@ -88,7 +88,7 @@ public class TagletWriterImpl extends TagletWriter {
configuration = htmlWriter.configuration;
options = configuration.getOptions();
utils = configuration.utils;
resources = configuration.getResources();
resources = configuration.getDocResources();
}
@Override

View file

@ -141,7 +141,7 @@ public class Navigation {
this.path = path;
this.pathToRoot = path.parent().invert();
this.links = new Links(path);
this.rowListTitle = configuration.getResources().getText("doclet.Navigation");
this.rowListTitle = configuration.getDocResources().getText("doclet.Navigation");
this.searchLabel = contents.getContent("doclet.search");
}

View file

@ -151,7 +151,7 @@ public abstract class AbstractDoclet implements Doclet {
private void reportInternalError(Throwable t) {
if (getClass().equals(StandardDoclet.class) || getClass().equals(HtmlDoclet.class)) {
System.err.println(configuration.getResources().getText("doclet.internal.report.bug"));
System.err.println(configuration.getDocResources().getText("doclet.internal.report.bug"));
}
dumpStack(true, t);
}

View file

@ -60,8 +60,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.Utils.Pair;
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberCache;
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
import static javax.tools.Diagnostic.Kind.*;
/**
* Configure the output based on the options. Doclets should sub-class
* BaseConfiguration, to configure and add their own options. This class contains
@ -154,7 +152,7 @@ public abstract class BaseConfiguration {
public abstract Messages getMessages();
public abstract Resources getResources();
public abstract Resources getDocResources();
/**
* Returns a string identifying the version of the doclet.
@ -334,9 +332,7 @@ public abstract class BaseConfiguration {
}
// add entries for modules which may not have exported packages
modules.forEach((ModuleElement mdle) -> {
modulePackages.computeIfAbsent(mdle, m -> Collections.emptySet());
});
modules.forEach(mdle -> modulePackages.computeIfAbsent(mdle, m -> Collections.emptySet()));
modules.addAll(modulePackages.keySet());
showModules = !modules.isEmpty();
@ -396,18 +392,18 @@ public abstract class BaseConfiguration {
private void initDestDirectory() throws DocletException {
String destDirName = getOptions().destDirName();
if (!destDirName.isEmpty()) {
Resources resources = getResources();
Messages messages = getMessages();
DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
if (!destDir.exists()) {
//Create the output directory (in case it doesn't exist yet)
reporter.print(NOTE, resources.getText("doclet.dest_dir_create", destDirName));
messages.notice("doclet.dest_dir_create", destDirName);
destDir.mkdirs();
} else if (!destDir.isDirectory()) {
throw new SimpleDocletException(resources.getText(
throw new SimpleDocletException(messages.getResources().getText(
"doclet.destination_directory_not_directory_0",
destDir.getPath()));
} else if (!destDir.canWrite()) {
throw new SimpleDocletException(resources.getText(
throw new SimpleDocletException(messages.getResources().getText(
"doclet.destination_directory_not_writable_0",
destDir.getPath()));
}
@ -689,12 +685,12 @@ public abstract class BaseConfiguration {
*/
public boolean isJavaFXMode() {
TypeElement observable = utils.elementUtils.getTypeElement("javafx.beans.Observable");
if (observable != null) {
ModuleElement javafxModule = utils.elementUtils.getModuleOf(observable);
if (javafxModule == null || javafxModule.isUnnamed() || javafxModule.getQualifiedName().contentEquals("javafx.base")) {
return true;
}
if (observable == null) {
return false;
}
return false;
ModuleElement javafxModule = utils.elementUtils.getModuleOf(observable);
return javafxModule == null
|| javafxModule.isUnnamed()
|| javafxModule.getQualifiedName().contentEquals("javafx.base");
}
}

View file

@ -271,7 +271,7 @@ public abstract class BaseOptions {
}
public Set<? extends Option> getSupportedOptions() {
Resources resources = config.getResources();
Resources resources = config.getDocResources();
Messages messages = config.getMessages();
Reporter reporter = config.getReporter();
@ -572,7 +572,7 @@ public abstract class BaseOptions {
osw = new OutputStreamWriter(ost, docencoding);
} catch (UnsupportedEncodingException exc) {
config.reporter.print(ERROR,
config.getResources().getText("doclet.Encoding_not_supported", docencoding));
config.getDocResources().getText("doclet.Encoding_not_supported", docencoding));
return false;
} finally {
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -81,7 +81,7 @@ public class CommentUtils {
protected CommentUtils(BaseConfiguration configuration) {
this.configuration = configuration;
utils = configuration.utils;
resources = configuration.getResources();
resources = configuration.getDocResources();
trees = configuration.docEnv.getDocTrees();
treeFactory = trees.getDocTreeFactory();
elementUtils = configuration.docEnv.getElementUtils();

View file

@ -51,16 +51,26 @@ public class Messages {
* Creates a {@code Messages} object to provide standardized access to
* the doclet's diagnostic reporting mechanisms.
*
* @param configuration the doclet's configuration, used to access
* the doclet's resources, reporter, and additional methods and state
* used to filter out messages, if any, which should be suppressed.
* @param configuration the doclet's configuration, used to access the doclet's
* reporter, and additional methods and state used to
* filter out messages, if any, which should be suppressed.
* @param resources resources for console messages and exceptions
*/
public Messages(BaseConfiguration configuration) {
public Messages(BaseConfiguration configuration, Resources resources) {
this.configuration = configuration;
resources = configuration.getResources();
this.resources = resources;
reporter = configuration.getReporter();
}
/**
* Returns the resources being used when generating messages.
*
* @return the resources
*/
public Resources getResources() {
return resources;
}
// ***** Errors *****
/**

View file

@ -63,7 +63,6 @@ public class Resources {
* specific to a particular format
*/
public Resources(Locale locale, String commonBundleName, String docletBundleName) {
this.commonBundle = ResourceBundle.getBundle(commonBundleName, locale);
this.docletBundle = ResourceBundle.getBundle(docletBundleName, locale);

View file

@ -100,7 +100,7 @@ public abstract class AbstractBuilder {
this.options = configuration.getOptions();
this.builderFactory = configuration.getBuilderFactory();
this.messages = configuration.getMessages();
this.resources = configuration.getResources();
this.resources = configuration.getDocResources();
this.utils = configuration.utils;
this.containingPackagesSeen = c.containingPackagesSeen;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -305,7 +305,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
case RECORD_COMPONENT: key = "doclet.RecordComponents" ; break;
default: throw new IllegalArgumentException(kind.toString());
}
String header = writer.configuration().getResources().getText(key);
String header = writer.configuration().getDocResources().getText(key);
result.add(writer.getParamHeader(header));
}
result.add(writer.paramTagOutput(e, paramTag, name));

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -25,13 +25,6 @@
package jdk.javadoc.internal.doclets.toolkit.taglets;
import java.util.List;
import javax.lang.model.element.Element;
import com.sun.source.doctree.DocTree;
import jdk.javadoc.internal.doclets.toolkit.Content;
/**
* A taglet that adds the initial line of documentation to the JavaFX
* property getters.
@ -52,6 +45,6 @@ public class PropertyGetterTaglet extends BasePropertyTaglet {
@Override
String getText(TagletWriter tagletWriter) {
return tagletWriter.configuration().getResources().getText("doclet.PropertyGetter");
return tagletWriter.configuration().getDocResources().getText("doclet.PropertyGetter");
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -45,6 +45,6 @@ public class PropertySetterTaglet extends BasePropertyTaglet {
@Override
String getText(TagletWriter tagletWriter) {
return tagletWriter.configuration().getResources().getText("doclet.PropertySetter");
return tagletWriter.configuration().getDocResources().getText("doclet.PropertySetter");
}
}

View file

@ -199,7 +199,7 @@ public class TagletManager {
this.docEnv = configuration.docEnv;
this.doclet = configuration.doclet;
this.messages = configuration.getMessages();
this.resources = configuration.getResources();
this.resources = configuration.getDocResources();
this.showTaglets = options.showTaglets();
this.utils = configuration.utils;
this.tagletPath = options.tagletPath();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -134,7 +134,7 @@ public class Extern {
public Extern(BaseConfiguration configuration) {
this.configuration = configuration;
this.resources = configuration.getResources();
this.resources = configuration.getDocResources();
this.utils = configuration.utils;
}

View file

@ -240,8 +240,8 @@ public class Group {
Map<String, SortedSet<ModuleElement>> groupModuleMap = new HashMap<>();
String defaultGroupName =
(elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
configuration.getResources().getText("doclet.Modules") :
configuration.getResources().getText("doclet.Other_Modules");
configuration.getDocResources().getText("doclet.Modules") :
configuration.getDocResources().getText("doclet.Other_Modules");
// if the user has not used the default group name, add it
if (!groupList.contains(defaultGroupName)) {
groupList.add(defaultGroupName);
@ -282,8 +282,8 @@ public class Group {
Map<String, SortedSet<PackageElement>> groupPackageMap = new HashMap<>();
String defaultGroupName =
(elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
configuration.getResources().getText("doclet.Packages") :
configuration.getResources().getText("doclet.Other_Packages");
configuration.getDocResources().getText("doclet.Packages") :
configuration.getDocResources().getText("doclet.Other_Packages");
// if the user has not used the default group name, add it
if (!groupList.contains(defaultGroupName)) {
groupList.add(defaultGroupName);

View file

@ -58,7 +58,7 @@ public class MetaKeywords {
*/
public MetaKeywords(BaseConfiguration configuration) {
options = configuration.getOptions();
resources = configuration.getResources();
resources = configuration.getDocResources();
utils = configuration.utils;
}

View file

@ -86,7 +86,7 @@ class StandardDocFileFactory extends DocFileFactory {
fileManager.setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
} catch (IOException e) {
// generic IOException from file manager, setting location, e.g. file not a directory
String message = configuration.getResources().getText("doclet.error.initializing.dest.dir", e);
String message = configuration.getDocResources().getText("doclet.error.initializing.dest.dir", e);
throw new SimpleDocletException(message, e);
}
}

View file

@ -144,7 +144,7 @@ public class Utils {
configuration = c;
options = configuration.getOptions();
messages = configuration.getMessages();
resources = configuration.getResources();
resources = configuration.getDocResources();
elementUtils = c.docEnv.getElementUtils();
typeUtils = c.docEnv.getTypeUtils();
docTrees = c.docEnv.getDocTrees();

View file

@ -733,7 +733,7 @@ public class Start {
}
if (Doclet.class.isAssignableFrom(docletClass)) {
messager.setLocale(locale);
messager.setLocale(Locale.getDefault()); // use default locale for console messages
try {
Object o = docletClass.getConstructor().newInstance();
doclet = (Doclet) o;
@ -818,10 +818,6 @@ public class Start {
messager.printErrorUsingKey(key, args);
}
void warn(String key, Object... args) {
messager.printWarningUsingKey(key, args);
}
/**
* Get the locale if specified on the command line
* else return null and if locale option is not used
@ -841,21 +837,4 @@ public class Start {
}
}
/**
* Search the locale for specified language, specified country and
* specified variant.
*/
private Locale searchLocale(String language, String country,
String variant) {
for (Locale loc : Locale.getAvailableLocales()) {
if (loc.getLanguage().equals(language) &&
(country == null || loc.getCountry().equals(country)) &&
(variant == null || loc.getVariant().equals(variant))) {
return loc;
}
}
return null;
}
}