src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 21,47 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package com.sun.tools.doclets.formats.html;
import java.net.*;
import java.util.*;
import javax.tools.JavaFileManager;
! import com.sun.javadoc.*;
! import com.sun.tools.doclets.formats.html.markup.*;
! import com.sun.tools.doclets.internal.toolkit.*;
! import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclint.DocLint;
- import com.sun.tools.javac.file.JavacFileManager;
- import com.sun.tools.javac.util.Context;
- import com.sun.tools.javac.util.StringUtils;
- import com.sun.tools.javadoc.RootDocImpl;
/**
* Configure the output based on the command line options.
* <p>
* Also determine the length of the command line option. For example,
* for a option "-header" there will be a string argument associated, then the
--- 21,61 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package jdk.javadoc.internal.doclets.formats.html;
import java.net.*;
import java.util.*;
+ import javax.lang.model.element.Element;
+ import javax.lang.model.element.PackageElement;
+ import javax.lang.model.element.TypeElement;
import javax.tools.JavaFileManager;
+ import javax.tools.JavaFileObject;
+ import javax.tools.StandardJavaFileManager;
! import com.sun.source.util.DocTreePath;
import com.sun.tools.doclint.DocLint;
+ import jdk.javadoc.doclet.Doclet;
+ import jdk.javadoc.doclet.DocletEnvironment;
+ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
+ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
+ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion;
+ import jdk.javadoc.internal.doclets.toolkit.Configuration;
+ import jdk.javadoc.internal.doclets.toolkit.Content;
+ import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
+ import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+ import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+ import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
+ import jdk.javadoc.internal.doclets.toolkit.util.Utils;
+
+ import static javax.tools.Diagnostic.Kind.*;
+
/**
* Configure the output based on the command line options.
* <p>
* Also determine the length of the command line option. For example,
* for a option "-header" there will be a string argument associated, then the
*** 119,128 ****
--- 133,144 ----
/**
* Argument for command line option "-Xdocrootparent".
*/
public String docrootparent = "";
+ public boolean sortedMethodDetails = false;
+
/**
* True if command line option "-nohelp" is used. Default value is false.
*/
public boolean nohelp = false;
*** 163,175 ****
* false
*/
private boolean nooverview = false;
/**
! * True if command line option "-overview" is used. Default value is false.
*/
! public boolean overview = false;
/**
* This is true if option "-overview" is used or option "-overview" is not
* used and number of packages is more than one.
*/
--- 179,191 ----
* false
*/
private boolean nooverview = false;
/**
! * The overview path specified with "-overview" flag.
*/
! public String overviewpath = null;
/**
* This is true if option "-overview" is used or option "-overview" is not
* used and number of packages is more than one.
*/
*** 181,191 ****
public HtmlVersion htmlVersion = HtmlVersion.HTML4;
/**
* Collected set of doclint options
*/
! public Set<String> doclintOpts = new LinkedHashSet<>();
/**
* Unique Resource Handler for this package.
*/
public final MessageRetriever standardmessage;
--- 197,207 ----
public HtmlVersion htmlVersion = HtmlVersion.HTML4;
/**
* Collected set of doclint options
*/
! public Map<Doclet.Option, String> doclintOpts = new LinkedHashMap<>();
/**
* Unique Resource Handler for this package.
*/
public final MessageRetriever standardmessage;
*** 195,207 ****
* documentation.
*/
public DocPath topFile = DocPath.empty;
/**
! * The classdoc for the class file getting generated.
*/
! public ClassDoc currentcd = null; // Set this classdoc in the ClassWriter.
protected List<SearchIndexItem> memberSearchIndex = new ArrayList<>();
protected List<SearchIndexItem> packageSearchIndex = new ArrayList<>();
--- 211,223 ----
* documentation.
*/
public DocPath topFile = DocPath.empty;
/**
! * The TypeElement for the class file getting generated.
*/
! public TypeElement currentTypeElement = null; // Set this TypeElement in the ClassWriter.
protected List<SearchIndexItem> memberSearchIndex = new ArrayList<>();
protected List<SearchIndexItem> packageSearchIndex = new ArrayList<>();
*** 217,240 ****
* Constructor. Initializes resource for the
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
*/
public ConfigurationImpl() {
standardmessage = new MessageRetriever(this,
! "com.sun.tools.doclets.formats.html.resources.standard");
}
! private final String versionRBName = "com.sun.tools.javadoc.resources.version";
private ResourceBundle versionRB;
/**
* Return the build date for the doclet.
*/
@Override
public String getDocletSpecificBuildDate() {
if (versionRB == null) {
try {
! versionRB = ResourceBundle.getBundle(versionRBName);
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
--- 233,257 ----
* Constructor. Initializes resource for the
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
*/
public ConfigurationImpl() {
standardmessage = new MessageRetriever(this,
! "jdk.javadoc.internal.doclets.formats.html.resources.standard");
}
! private final String versionRBName = "jdk.javadoc.internal.tool.resources.version";
private ResourceBundle versionRB;
/**
* Return the build date for the doclet.
+ * @return the build date
*/
@Override
public String getDocletSpecificBuildDate() {
if (versionRB == null) {
try {
! versionRB = ResourceBundle.getBundle(versionRBName, getLocale());
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
*** 243,509 ****
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
! /**
! * Depending upon the command line options provided by the user, set
! * configure the output generation environment.
! *
! * @param options The array of option names and values.
! */
! @Override
! public void setSpecificDocletOptions(String[][] options) {
! for (int oi = 0; oi < options.length; ++oi) {
! String[] os = options[oi];
! String opt = StringUtils.toLowerCase(os[0]);
! if (opt.equals("-footer")) {
! footer = os[1];
! } else if (opt.equals("-header")) {
! header = os[1];
! } else if (opt.equals("-packagesheader")) {
! packagesheader = os[1];
! } else if (opt.equals("-doctitle")) {
! doctitle = os[1];
! } else if (opt.equals("-windowtitle")) {
! windowtitle = os[1].replaceAll("\\<.*?>", "");
! } else if (opt.equals("-top")) {
! top = os[1];
! } else if (opt.equals("-bottom")) {
! bottom = os[1];
! } else if (opt.equals("-helpfile")) {
! helpfile = os[1];
! } else if (opt.equals("-stylesheetfile")) {
! stylesheetfile = os[1];
! } else if (opt.equals("-charset")) {
! charset = os[1];
! } else if (opt.equals("-xdocrootparent")) {
! docrootparent = os[1];
! } else if (opt.equals("-nohelp")) {
! nohelp = true;
! } else if (opt.equals("-splitindex")) {
! splitindex = true;
! } else if (opt.equals("-noindex")) {
! createindex = false;
! } else if (opt.equals("-use")) {
! classuse = true;
! } else if (opt.equals("-notree")) {
! createtree = false;
! } else if (opt.equals("-nodeprecatedlist")) {
! nodeprecatedlist = true;
! } else if (opt.equals("-nonavbar")) {
! nonavbar = true;
! } else if (opt.equals("-nooverview")) {
! nooverview = true;
! } else if (opt.equals("-overview")) {
! overview = true;
! } else if (opt.equals("-html4")) {
! htmlVersion = HtmlVersion.HTML4;
! } else if (opt.equals("-html5")) {
! htmlVersion = HtmlVersion.HTML5;
! } else if (opt.equals("-xdoclint")) {
! doclintOpts.add(DocLint.XMSGS_OPTION);
! } else if (opt.startsWith("-xdoclint:")) {
! doclintOpts.add(DocLint.XMSGS_CUSTOM_PREFIX + opt.substring(opt.indexOf(":") + 1));
! } else if (opt.startsWith("-xdoclint/package:")) {
! doclintOpts.add(DocLint.XCHECK_PACKAGE + opt.substring(opt.indexOf(":") + 1));
! }
! }
! if (root.specifiedClasses().length > 0) {
! Map<String,PackageDoc> map = new HashMap<>();
! PackageDoc pd;
! ClassDoc[] classes = root.classes();
! for (ClassDoc aClass : classes) {
! pd = aClass.containingPackage();
! if (!map.containsKey(pd.name())) {
! map.put(pd.name(), pd);
! }
! }
! }
! setCreateOverview();
! setTopFile(root);
!
! if (root instanceof RootDocImpl) {
! ((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames(),
! StringUtils.toLowerCase(htmlVersion.name()));
! }
! }
!
! /**
! * Returns the "length" of a given option. If an option takes no
! * arguments, its length is one. If it takes one argument, it's
! * length is two, and so on. This method is called by JavaDoc to
! * parse the options it does not recognize. It then calls
! * {@link #validOptions(String[][], DocErrorReporter)} to
! * validate them.
! * <b>Note:</b><br>
! * The options arrive as case-sensitive strings. For options that
! * are not case-sensitive, use toLowerCase() on the option string
! * before comparing it.
! *
! * @return number of arguments + 1 for a option. Zero return means
! * option not known. Negative value means error occurred.
! */
! public int optionLength(String option) {
! int result = -1;
! if ((result = super.optionLength(option)) > 0) {
! return result;
! }
! // otherwise look for the options we have added
! option = StringUtils.toLowerCase(option);
! if (option.equals("-nodeprecatedlist") ||
! option.equals("-noindex") ||
! option.equals("-notree") ||
! option.equals("-nohelp") ||
! option.equals("-splitindex") ||
! option.equals("-serialwarn") ||
! option.equals("-use") ||
! option.equals("-nonavbar") ||
! option.equals("-nooverview") ||
! option.equals("-html4") ||
! option.equals("-html5") ||
! option.equals("-xdoclint") ||
! option.startsWith("-xdoclint:") ||
! option.startsWith("-xdoclint/package:")) {
! return 1;
! } else if (option.equals("-help")) {
! // Uugh: first, this should not be hidden inside optionLength,
! // and second, we should not be writing directly to stdout.
! // But we have no access to a DocErrorReporter, which would
! // allow use of reporter.printNotice
! System.out.println(getText("doclet.usage"));
! return 1;
! } else if (option.equals("-x")) {
! // Uugh: first, this should not be hidden inside optionLength,
! // and second, we should not be writing directly to stdout.
! // But we have no access to a DocErrorReporter, which would
! // allow use of reporter.printNotice
! System.out.println(getText("doclet.X.usage"));
! return 1;
! } else if (option.equals("-footer") ||
! option.equals("-header") ||
! option.equals("-packagesheader") ||
! option.equals("-doctitle") ||
! option.equals("-windowtitle") ||
! option.equals("-top") ||
! option.equals("-bottom") ||
! option.equals("-helpfile") ||
! option.equals("-stylesheetfile") ||
! option.equals("-charset") ||
! option.equals("-overview") ||
! option.equals("-xdocrootparent")) {
! return 2;
! } else {
! return 0;
! }
! }
!
! /**
! * {@inheritDoc}
! */
! @Override
! public boolean validOptions(String options[][],
! DocErrorReporter reporter) {
! boolean helpfile = false;
! boolean nohelp = false;
! boolean overview = false;
! boolean nooverview = false;
! boolean splitindex = false;
! boolean noindex = false;
// check shared options
! if (!generalValidOptions(options, reporter)) {
return false;
}
// otherwise look at our options
! for (int oi = 0; oi < options.length; ++oi) {
! String[] os = options[oi];
! String opt = StringUtils.toLowerCase(os[0]);
! if (opt.equals("-helpfile")) {
if (nohelp == true) {
! reporter.printError(getText("doclet.Option_conflict",
"-helpfile", "-nohelp"));
return false;
}
! if (helpfile == true) {
! reporter.printError(getText("doclet.Option_reuse",
"-helpfile"));
return false;
}
! DocFile help = DocFile.createFileForInput(this, os[1]);
if (!help.exists()) {
! reporter.printError(getText("doclet.File_not_found", os[1]));
return false;
}
! helpfile = true;
! } else if (opt.equals("-nohelp")) {
! if (helpfile == true) {
! reporter.printError(getText("doclet.Option_conflict",
"-nohelp", "-helpfile"));
return false;
}
! nohelp = true;
! } else if (opt.equals("-xdocrootparent")) {
try {
! new URL(os[1]);
} catch (MalformedURLException e) {
! reporter.printError(getText("doclet.MalformedURL", os[1]));
return false;
}
! } else if (opt.equals("-overview")) {
if (nooverview == true) {
! reporter.printError(getText("doclet.Option_conflict",
"-overview", "-nooverview"));
return false;
}
! if (overview == true) {
! reporter.printError(getText("doclet.Option_reuse",
! "-overview"));
! return false;
! }
! overview = true;
! } else if (opt.equals("-nooverview")) {
! if (overview == true) {
! reporter.printError(getText("doclet.Option_conflict",
"-nooverview", "-overview"));
return false;
}
! nooverview = true;
! } else if (opt.equals("-splitindex")) {
! if (noindex == true) {
! reporter.printError(getText("doclet.Option_conflict",
"-splitindex", "-noindex"));
return false;
}
! splitindex = true;
! } else if (opt.equals("-noindex")) {
if (splitindex == true) {
! reporter.printError(getText("doclet.Option_conflict",
"-noindex", "-splitindex"));
return false;
}
! noindex = true;
! } else if (opt.startsWith("-xdoclint:")) {
! if (opt.contains("/")) {
! reporter.printError(getText("doclet.Option_doclint_no_qualifiers"));
return false;
}
! if (!DocLint.isValidOption(
! opt.replace("-xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX))) {
! reporter.printError(getText("doclet.Option_doclint_invalid_arg"));
return false;
}
! } else if (opt.startsWith("-xdoclint/package:")) {
! if (!DocLint.isValidOption(
! opt.replace("-xdoclint/package:", DocLint.XCHECK_PACKAGE))) {
! reporter.printError(getText("doclet.Option_doclint_package_invalid_arg"));
return false;
}
}
}
return true;
}
/**
* Return true if the generated output is HTML5.
*/
public boolean isOutputHtml5() {
return htmlVersion == HtmlVersion.HTML5;
--- 260,376 ----
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
! protected boolean validateOptions() {
// check shared options
! if (!generalValidOptions()) {
return false;
}
// otherwise look at our options
! for (Doclet.Option opt : optionsProcessed) {
! if (opt.matches("-helpfile")) {
if (nohelp == true) {
! reporter.print(ERROR, getText("doclet.Option_conflict",
"-helpfile", "-nohelp"));
return false;
}
! if (this.helpfile != null) {
! reporter.print(ERROR, getText("doclet.Option_reuse",
"-helpfile"));
return false;
}
! DocFile help = DocFile.createFileForInput(this, helpfile);
if (!help.exists()) {
! reporter.print(ERROR, getText("doclet.File_not_found", helpfile));
return false;
}
! } else if (opt.matches("-nohelp")) {
! if (helpfile != null) {
! reporter.print(ERROR, getText("doclet.Option_conflict",
"-nohelp", "-helpfile"));
return false;
}
! } else if (opt.matches("-xdocrootparent")) {
try {
! URL ignored = new URL(docrootparent);
} catch (MalformedURLException e) {
! reporter.print(ERROR, getText("doclet.MalformedURL", docrootparent));
return false;
}
! } else if (opt.matches("-overview")) {
if (nooverview == true) {
! reporter.print(ERROR, getText("doclet.Option_conflict",
"-overview", "-nooverview"));
return false;
}
! } else if (opt.matches("-nooverview")) {
! if (overviewpath != null) {
! reporter.print(ERROR, getText("doclet.Option_conflict",
"-nooverview", "-overview"));
return false;
}
! } else if (opt.matches("-splitindex")) {
! if (createindex == false) {
! reporter.print(ERROR, getText("doclet.Option_conflict",
"-splitindex", "-noindex"));
return false;
}
! } else if (opt.matches("-noindex")) {
if (splitindex == true) {
! reporter.print(ERROR, getText("doclet.Option_conflict",
"-noindex", "-splitindex"));
return false;
}
! } else if (opt.matches("-xdoclint:")) {
! String dopt = doclintOpts.get(opt);
! if (dopt == null) {
! continue;
! }
! if (dopt.contains("/")) {
! reporter.print(ERROR, getText("doclet.Option_doclint_no_qualifiers"));
return false;
}
! if (!DocLint.isValidOption(dopt)) {
! reporter.print(ERROR, getText("doclet.Option_doclint_invalid_arg"));
return false;
}
! } else if (opt.matches("-xdoclint/package:")) {
! String dopt = doclintOpts.get(opt);
! if (!DocLint.isValidOption(dopt)) {
! reporter.print(ERROR, getText("doclet.Option_doclint_package_invalid_arg"));
return false;
}
}
}
return true;
}
+ @Override
+ public boolean finishOptionSettings() {
+ if (!validateOptions()) {
+ return false;
+ }
+ if (!root.getSpecifiedElements().isEmpty()) {
+ Map<String, PackageElement> map = new HashMap<>();
+ PackageElement pkg;
+ List<TypeElement> classes = new ArrayList<>(root.getIncludedClasses());
+ for (TypeElement aClass : classes) {
+ pkg = utils.containingPackage(aClass);
+ if (!map.containsKey(utils.getPackageName(pkg))) {
+ map.put(utils.getPackageName(pkg), pkg);
+ }
+ }
+ }
+ setCreateOverview();
+ setTopFile(root);
+ workArounds.initDocLint(doclintOpts.values(), tagletManager.getCustomTagNames(),
+ Utils.toLowerCase(htmlVersion.name()));
+ return true;
+ }
+
/**
* Return true if the generated output is HTML5.
*/
public boolean isOutputHtml5() {
return htmlVersion == HtmlVersion.HTML5;
*** 532,576 ****
* package to document. It will be a class page(first in the sorted order),
* if only classes are provided on the command line.
*
* @param root Root of the program structure.
*/
! protected void setTopFile(RootDoc root) {
if (!checkForDeprecation(root)) {
return;
}
if (createoverview) {
topFile = DocPaths.OVERVIEW_SUMMARY;
} else {
! if (packages.size() == 1 && packages.first().name().equals("")) {
! if (root.classes().length > 0) {
! ClassDoc[] classarr = root.classes();
! Arrays.sort(classarr);
! ClassDoc cd = getValidClass(classarr);
! topFile = DocPath.forClass(cd);
}
} else if (!packages.isEmpty()) {
topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY);
}
}
}
! protected ClassDoc getValidClass(ClassDoc[] classarr) {
if (!nodeprecated) {
! return classarr[0];
}
! for (ClassDoc cd : classarr) {
! if (cd.tags("deprecated").length == 0) {
! return cd;
}
}
return null;
}
! protected boolean checkForDeprecation(RootDoc root) {
! for (ClassDoc cd : root.classes()) {
! if (isGeneratedDoc(cd)) {
return true;
}
}
return false;
}
--- 399,442 ----
* package to document. It will be a class page(first in the sorted order),
* if only classes are provided on the command line.
*
* @param root Root of the program structure.
*/
! protected void setTopFile(DocletEnvironment root) {
if (!checkForDeprecation(root)) {
return;
}
if (createoverview) {
topFile = DocPaths.OVERVIEW_SUMMARY;
} else {
! if (packages.size() == 1 && packages.first().isUnnamed()) {
! if (!root.getIncludedClasses().isEmpty()) {
! List<TypeElement> classes = new ArrayList<>(root.getIncludedClasses());
! TypeElement te = getValidClass(classes);
! topFile = DocPath.forClass(utils, te);
}
} else if (!packages.isEmpty()) {
topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY);
}
}
}
! protected TypeElement getValidClass(List<TypeElement> classes) {
if (!nodeprecated) {
! return classes.get(0);
}
! for (TypeElement te : classes) {
! if (!utils.isDeprecated(te)) {
! return te;
}
}
return null;
}
! protected boolean checkForDeprecation(DocletEnvironment root) {
! for (TypeElement te : root.getIncludedClasses()) {
! if (isGeneratedDoc(te)) {
return true;
}
}
return false;
}
*** 578,588 ****
/**
* Generate "overview.html" page if option "-overview" is used or number of
* packages is more than one. Sets {@link #createoverview} field to true.
*/
protected void setCreateOverview() {
! if ((overview || packages.size() > 1) && !nooverview) {
createoverview = true;
}
}
/**
--- 444,454 ----
/**
* Generate "overview.html" page if option "-overview" is used or number of
* packages is more than one. Sets {@link #createoverview} field to true.
*/
protected void setCreateOverview() {
! if ((overviewpath != null || packages.size() > 1) && !nooverview) {
createoverview = true;
}
}
/**
*** 595,660 ****
/**
* {@inheritDoc}
*/
@Override
! public Comparator<ProgramElementDoc> getMemberComparator() {
! return null;
}
/**
! * {@inheritDoc}
*/
! @Override
! public Locale getLocale() {
! if (root instanceof RootDocImpl)
! return ((RootDocImpl)root).getLocale();
! else
! return Locale.getDefault();
}
/**
* {@inheritDoc}
*/
@Override
public JavaFileManager getFileManager() {
! if (fileManager == null) {
! if (root instanceof RootDocImpl)
! fileManager = ((RootDocImpl) root).getFileManager();
! else
! fileManager = new JavacFileManager(new Context(), false, null);
}
! return fileManager;
}
- private JavaFileManager fileManager;
-
@Override
! public boolean showMessage(SourcePosition pos, String key) {
! if (root instanceof RootDocImpl) {
! return pos == null || ((RootDocImpl) root).showTagMessages();
}
- return true;
- }
@Override
public Content newContent() {
return new ContentBuilder();
}
protected void buildSearchTagIndex() {
for (SearchIndexItem sii : tagSearchIndex) {
String tagLabel = sii.getLabel();
! char ch = (tagLabel.length() == 0)
? '*'
: Character.toUpperCase(tagLabel.charAt(0));
- Character unicode = ch;
List<SearchIndexItem> list = tagSearchIndexMap.get(unicode);
if (list == null) {
list = new ArrayList<>();
tagSearchIndexMap.put(unicode, list);
}
list.add(sii);
}
tagSearchIndexKeys = tagSearchIndexMap.keySet();
}
}
--- 461,745 ----
/**
* {@inheritDoc}
*/
@Override
! public Locale getLocale() {
! if (locale == null)
! return Locale.getDefault();
! return locale;
}
/**
! * Return the path of the overview file and null if it does not exist.
! *
! * @return the path of the overview file and null if it does not exist.
*/
! public JavaFileObject getOverviewPath() {
! if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager) {
! StandardJavaFileManager fm = (StandardJavaFileManager) getFileManager();
! return fm.getJavaFileObjects(overviewpath).iterator().next();
}
+ return null;
+ }
/**
* {@inheritDoc}
*/
@Override
public JavaFileManager getFileManager() {
! return root.getJavaFileManager();
}
!
! @Override
! public boolean showMessage(DocTreePath path, String key) {
! return (path == null || workArounds.haveDocLint());
}
@Override
! public boolean showMessage(Element e, String key) {
! return (e == null || workArounds.haveDocLint());
}
@Override
public Content newContent() {
return new ContentBuilder();
}
protected void buildSearchTagIndex() {
for (SearchIndexItem sii : tagSearchIndex) {
String tagLabel = sii.getLabel();
! 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);
}
tagSearchIndexKeys = tagSearchIndexMap.keySet();
}
+
+ @Override
+ public Set<Doclet.Option> getSupportedOptions() {
+ Doclet.Option[] options = {
+ new Option(this, "bottom", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ bottom = args.next();
+ return true;
+ }
+ },
+ new Option(this, "charset", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ charset = args.next();
+ return true;
+ }
+ },
+ new Option(this, "doctitle", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ doctitle = args.next();
+ return true;
+ }
+ },
+ new Option(this, "footer", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ footer = args.next();
+ return true;
+ }
+ },
+ new Option(this, "header", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ header = args.next();
+ return true;
+ }
+ },
+ new Option(this, "helpfile", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ helpfile = args.next();
+ return true;
+ }
+ },
+ new Option(this, "html4") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ htmlVersion = HtmlVersion.HTML4;
+ return true;
+ }
+ },
+ new Option(this, "html5") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ htmlVersion = HtmlVersion.HTML5;
+ return true;
+ }
+ },
+ new Option(this, "nohelp") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ nohelp = true;
+ return true;
+ }
+ },
+ new Option(this, "nodeprecatedlist") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ nodeprecatedlist = true;
+ return true;
+ }
+ },
+ new Option(this, "noindex") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ createindex = false;
+ return true;
+ }
+ },
+ new Option(this, "nonavbar") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ nonavbar = true;
+ return true;
+ }
+ },
+ new Hidden(this, "nooverview") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ nooverview = true;
+ return true;
+ }
+ },
+ new Option(this, "notree") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ createtree = false;
+ return true;
+ }
+ },
+ new Hidden(this, "overview", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ overviewpath = args.next();
+ return true;
+ }
+ },
+ new Hidden(this, "packagesheader", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ packagesheader = args.next();
+ return true;
+ }
+ },
+ new Option(this, "splitindex") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ splitindex = true;
+ return true;
+ }
+ },
+ new Option(this, "stylesheetfile", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ stylesheetfile = args.next();
+ return true;
+ }
+ },
+ new Option(this, "top", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ top = args.next();
+ return true;
+ }
+ },
+ new Option(this, "use") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ classuse = true;
+ return true;
+ }
+ },
+ new Option(this, "windowtitle", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ windowtitle = args.next().replaceAll("\\<.*?>", "");
+ return true;
+ }
+ },
+ new XOption(this, "xdoclint") {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ doclintOpts.put(this, DocLint.XMSGS_OPTION);
+ return true;
+ }
+ },
+ new XOption(this, "Xdocrootparent", 1) {
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ docrootparent = args.next();
+ return true;
+ }
+ },
+ new XOption(this, "doclet.xusage.xdoclint-extended.", "Xdoclint:", 0) {
+ @Override
+ public boolean matches(String option) {
+ String opt = option.startsWith("-") ? option.substring(1) : option;
+ return opt.toLowerCase().startsWith(getName().toLowerCase());
+ }
+
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ doclintOpts.put(this, opt.replace("-Xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX));
+ return true;
+ }
+ },
+ new XOption(this, "doclet.xusage.xdoclint-package.", "Xdoclint/package:", 0) {
+ @Override
+ public boolean matches(String option) {
+ String opt = option.startsWith("-") ? option.substring(1) : option;
+ return opt.toLowerCase().startsWith(getName().toLowerCase());
+ }
+
+ @Override
+ public boolean process(String opt, ListIterator<String> args) {
+ optionsProcessed.add(this);
+ doclintOpts.put(this, opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE));
+ return true;
+ }
+ }
+ };
+ Set<Doclet.Option> oset = new TreeSet<>();
+ oset.addAll(Arrays.asList(options));
+ oset.addAll(super.getSupportedOptions());
+ return oset;
+ }
}