8237492: Reorganize impl of doclet options
8237726: Fix signature of StandardDoclet.getSupportedOptions Reviewed-by: prappo, hannesw, ksrini
This commit is contained in:
parent
c6c828fa6e
commit
9e4830fc30
@ -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
|
||||
@ -154,11 +154,11 @@ public interface Doclet {
|
||||
* The kind of an option.
|
||||
*/
|
||||
enum Kind {
|
||||
/** an extended option, such as those prefixed with -X */
|
||||
/** An extended option, such as those prefixed with {@code -X}. */
|
||||
EXTENDED,
|
||||
/** a standard option */
|
||||
/** A standard option. */
|
||||
STANDARD,
|
||||
/** an implementation reserved option */
|
||||
/** An implementation-reserved option. */
|
||||
OTHER;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -85,7 +85,7 @@ public class StandardDoclet implements Doclet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Doclet.Option> getSupportedOptions() {
|
||||
public Set<? extends Doclet.Option> getSupportedOptions() {
|
||||
return htmlDoclet.getSupportedOptions();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -73,6 +73,7 @@ import static javax.lang.model.element.Modifier.SYNCHRONIZED;
|
||||
public abstract class AbstractMemberWriter implements MemberSummaryWriter {
|
||||
|
||||
protected final HtmlConfiguration configuration;
|
||||
protected final HtmlOptions options;
|
||||
protected final Utils utils;
|
||||
protected final SubWriterHolderWriter writer;
|
||||
protected final Contents contents;
|
||||
@ -80,14 +81,11 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
|
||||
protected final Links links;
|
||||
|
||||
protected final TypeElement typeElement;
|
||||
public final boolean nodepr;
|
||||
|
||||
protected boolean printedSummaryHeader = false;
|
||||
|
||||
public AbstractMemberWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
this.configuration = writer.configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.writer = writer;
|
||||
this.nodepr = configuration.nodeprecated;
|
||||
this.typeElement = typeElement;
|
||||
this.utils = configuration.utils;
|
||||
this.contents = configuration.contents;
|
||||
@ -380,7 +378,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
|
||||
}
|
||||
|
||||
protected void serialWarning(Element e, String key, String a1, String a2) {
|
||||
if (configuration.serialwarn) {
|
||||
if (options.serialWarn) {
|
||||
configuration.messages.warning(e, key, a1, a2);
|
||||
}
|
||||
}
|
||||
@ -598,7 +596,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
|
||||
// Name
|
||||
HtmlTree nameSpan = new HtmlTree(HtmlTag.SPAN);
|
||||
nameSpan.setStyle(HtmlStyle.memberName);
|
||||
if (configuration.linksource) {
|
||||
if (options.linkSource) {
|
||||
Content name = new StringContent(name(element));
|
||||
writer.addSrcLink(element, name, nameSpan);
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -141,7 +141,7 @@ public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
|
||||
.setFooter(footer)
|
||||
.toContent());
|
||||
printHtmlDocument(
|
||||
configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
|
||||
configuration.metakeywords.getOverviewMetaKeywords(title, configuration.getOptions().docTitle),
|
||||
description, body);
|
||||
}
|
||||
|
||||
@ -158,8 +158,9 @@ public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
|
||||
* @param body the document tree to which the title will be added
|
||||
*/
|
||||
protected void addConfigurationTitle(Content body) {
|
||||
if (configuration.doctitle.length() > 0) {
|
||||
Content title = new RawHtml(configuration.doctitle);
|
||||
String doctitle = configuration.getOptions().docTitle;
|
||||
if (!doctitle.isEmpty()) {
|
||||
Content title = new RawHtml(doctitle);
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
|
||||
HtmlStyle.title, title);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
@ -113,7 +113,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter {
|
||||
.setHeader(new TableHeader(contents.packageLabel, contents.descriptionLabel))
|
||||
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
|
||||
for (PackageElement pkg : configuration.packages) {
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
|
||||
if (!(configuration.getOptions().noDeprecated && utils.isDeprecated(pkg))) {
|
||||
Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
|
||||
Content summaryContent = new ContentBuilder();
|
||||
addSummaryComment(pkg, summaryContent);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -187,7 +187,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
|
||||
Content annotationName = new StringContent(utils.getSimpleName(annotationType));
|
||||
Content parameterLinks = getTypeParameterLinks(linkInfo);
|
||||
if (configuration.linksource) {
|
||||
if (configuration.getOptions().linkSource) {
|
||||
addSrcLink(annotationType, annotationName, pre);
|
||||
pre.add(parameterLinks);
|
||||
} else {
|
||||
@ -203,7 +203,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
*/
|
||||
@Override
|
||||
public void addAnnotationTypeDescription(Content annotationInfoTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!configuration.getOptions().noComment) {
|
||||
if (!utils.getFullBody(annotationType).isEmpty()) {
|
||||
addInlineComment(annotationType, annotationInfoTree);
|
||||
}
|
||||
@ -215,7 +215,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
*/
|
||||
@Override
|
||||
public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!configuration.getOptions().noComment) {
|
||||
addTagsInfo(annotationType, annotationInfoTree);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -54,6 +54,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
|
||||
/**
|
||||
@ -158,19 +159,21 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration, ClassTree classtree) throws DocFileIOException {
|
||||
ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
|
||||
boolean nodeprecated = configuration.getOptions().noDeprecated;
|
||||
Utils utils = configuration.utils;
|
||||
for (TypeElement aClass : configuration.getIncludedTypeElements()) {
|
||||
// If -nodeprecated option is set and the containing package is marked
|
||||
// as deprecated, do not generate the class-use page. We will still generate
|
||||
// the class-use page if the class is marked as deprecated but the containing
|
||||
// package is not since it could still be linked from that package-use page.
|
||||
if (!(configuration.nodeprecated &&
|
||||
configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass))))
|
||||
if (!(nodeprecated &&
|
||||
utils.isDeprecated(utils.containingPackage(aClass))))
|
||||
ClassUseWriter.generate(configuration, mapper, aClass);
|
||||
}
|
||||
for (PackageElement pkg : configuration.packages) {
|
||||
// If -nodeprecated option is set and the package is marked
|
||||
// as deprecated, do not generate the package-use page.
|
||||
if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
|
||||
if (!(nodeprecated && utils.isDeprecated(pkg)))
|
||||
PackageUseWriter.generate(configuration, mapper, pkg);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -228,7 +228,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
linkInfo.linkToSelf = false;
|
||||
Content className = new StringContent(utils.getSimpleName(typeElement));
|
||||
Content parameterLinks = getTypeParameterLinks(linkInfo);
|
||||
if (configuration.linksource) {
|
||||
if (configuration.getOptions().linkSource) {
|
||||
addSrcLink(typeElement, className, pre);
|
||||
pre.add(parameterLinks);
|
||||
} else {
|
||||
@ -299,7 +299,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
*/
|
||||
@Override
|
||||
public void addClassDescription(Content classInfoTree) {
|
||||
if(!configuration.nocomment) {
|
||||
if(!configuration.getOptions().noComment) {
|
||||
// generate documentation for the class.
|
||||
if (!utils.getFullBody(typeElement).isEmpty()) {
|
||||
addInlineComment(typeElement, classInfoTree);
|
||||
@ -312,7 +312,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
*/
|
||||
@Override
|
||||
public void addClassTagInfo(Content classInfoTree) {
|
||||
if(!configuration.nocomment) {
|
||||
if(!configuration.getOptions().noComment) {
|
||||
// Print Information about all the tags here
|
||||
addTagsInfo(typeElement, classInfoTree);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -259,7 +259,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
|
||||
|
||||
/**
|
||||
* Get list of all the deprecated classes and members in all the Packages
|
||||
* specified on the Command Line.
|
||||
* specified on the command line.
|
||||
* Then instantiate DeprecatedListWriter and generate File.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -64,6 +64,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
public final Location location;
|
||||
public final DocPath source;
|
||||
public final HtmlConfiguration configuration;
|
||||
private final HtmlOptions options;
|
||||
private Navigation navBar;
|
||||
|
||||
/**
|
||||
@ -75,6 +76,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
*/
|
||||
public DocFilesHandlerImpl(HtmlConfiguration configuration, Element element) {
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.element = element;
|
||||
|
||||
switch (element.getKind()) {
|
||||
@ -160,7 +162,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
}
|
||||
}
|
||||
} else if (srcfile.isDirectory()) {
|
||||
if (configuration.copydocfilesubdirs
|
||||
if (options.copyDocfileSubdirs
|
||||
&& !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
|
||||
DocPath dirDocPath = dstDocPath.resolve(srcfile.getName());
|
||||
copyDirectory(srcfile, dirDocPath, first);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -201,7 +201,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.MEMBER, typeElement, false);
|
||||
Content label;
|
||||
if (configuration.summarizeOverriddenMethods) {
|
||||
if (options.summarizeOverriddenMethods) {
|
||||
label = new StringContent(utils.isClass(typeElement)
|
||||
? resources.getText("doclet.Fields_Declared_In_Class")
|
||||
: resources.getText("doclet.Fields_Declared_In_Interface"));
|
||||
|
@ -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
|
||||
@ -132,7 +132,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.setStyle(HtmlStyle.blockList);
|
||||
|
||||
// Overview
|
||||
if (configuration.createoverview) {
|
||||
if (options.createOverview) {
|
||||
Content overviewHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
contents.overviewLabel);
|
||||
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, overviewHeading);
|
||||
@ -246,7 +246,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.add(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
|
||||
// Class Use
|
||||
if (configuration.classuse) {
|
||||
if (options.classUse) {
|
||||
Content useHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
contents.getContent("doclet.help.use.head"));
|
||||
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, useHead);
|
||||
@ -257,7 +257,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
|
||||
// Tree
|
||||
if (configuration.createtree) {
|
||||
if (options.createTree) {
|
||||
Content treeHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
contents.getContent("doclet.help.tree.head"));
|
||||
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, treeHead);
|
||||
@ -275,7 +275,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
if (!(configuration.nodeprecatedlist || configuration.nodeprecated)) {
|
||||
if (!(options.noDeprecatedList || options.noDeprecated)) {
|
||||
Content dHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
contents.deprecatedAPI);
|
||||
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, dHead);
|
||||
@ -288,9 +288,9 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
|
||||
// Index
|
||||
if (configuration.createindex) {
|
||||
if (options.createIndex) {
|
||||
Content indexlink;
|
||||
if (configuration.splitindex) {
|
||||
if (options.splitIndex) {
|
||||
indexlink = links.createLink(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)),
|
||||
resources.getText("doclet.Index"));
|
||||
} else {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -37,7 +36,6 @@ 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;
|
||||
@ -53,9 +51,9 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import static javax.tools.Diagnostic.Kind.*;
|
||||
|
||||
/**
|
||||
* Configure the output based on the command line options.
|
||||
* Configure the output based on the command-line options.
|
||||
* <p>
|
||||
* Also determine the length of the command line option. For example,
|
||||
* Also determine the length of the command-line option. For example,
|
||||
* for a option "-header" there will be a string argument associated, then the
|
||||
* the length of option "-header" is two. But for option "-nohelp" no argument
|
||||
* is needed so it's length is 1.
|
||||
@ -77,125 +75,6 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
*/
|
||||
public static final String HTML_DEFAULT_CHARSET = "utf-8";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-header".
|
||||
*/
|
||||
public String header = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-packagesheader".
|
||||
*/
|
||||
public String packagesheader = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-footer".
|
||||
*/
|
||||
public String footer = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-doctitle".
|
||||
*/
|
||||
public String doctitle = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-windowtitle".
|
||||
*/
|
||||
public String windowtitle = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-top".
|
||||
*/
|
||||
public String top = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-bottom".
|
||||
*/
|
||||
public String bottom = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-helpfile".
|
||||
*/
|
||||
public String helpfile = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-stylesheetfile".
|
||||
*/
|
||||
public String stylesheetfile = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "--add-stylesheet".
|
||||
*/
|
||||
public List<String> additionalStylesheets = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Argument for command line option "-Xdocrootparent".
|
||||
*/
|
||||
public String docrootparent = "";
|
||||
|
||||
/**
|
||||
* True if command line option "-nohelp" is used. Default value is false.
|
||||
*/
|
||||
public boolean nohelp = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-splitindex" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean splitindex = false;
|
||||
|
||||
/**
|
||||
* False if command line option "-noindex" is used. Default value is true.
|
||||
*/
|
||||
public boolean createindex = true;
|
||||
|
||||
/**
|
||||
* True if command line option "-use" is used. Default value is false.
|
||||
*/
|
||||
public boolean classuse = false;
|
||||
|
||||
/**
|
||||
* False if command line option "-notree" is used. Default value is true.
|
||||
*/
|
||||
public boolean createtree = true;
|
||||
|
||||
/**
|
||||
* The META charset tag used for cross-platform viewing.
|
||||
*/
|
||||
public String charset = null;
|
||||
|
||||
/**
|
||||
* True if command line option "-nodeprecated" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean nodeprecatedlist = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-nonavbar" is used. Default value is false.
|
||||
*/
|
||||
public boolean nonavbar = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-nooverview" is used. Default value is
|
||||
* 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.
|
||||
*/
|
||||
public boolean createoverview = false;
|
||||
|
||||
/**
|
||||
* Collected set of doclint options
|
||||
*/
|
||||
public Map<Doclet.Option, String> doclintOpts = new LinkedHashMap<>();
|
||||
|
||||
public final Resources resources;
|
||||
|
||||
/**
|
||||
@ -231,6 +110,8 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
|
||||
public Map<Element, List<DocPath>> localStylesheetMap = new HashMap<>();
|
||||
|
||||
private final HtmlOptions options;
|
||||
|
||||
/**
|
||||
* Creates an object to hold the configuration for a doclet.
|
||||
*
|
||||
@ -244,6 +125,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
|
||||
messages = new Messages(this);
|
||||
contents = new Contents(this);
|
||||
options = new HtmlOptions(this);
|
||||
|
||||
String v;
|
||||
try {
|
||||
@ -283,54 +165,14 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
return messages;
|
||||
}
|
||||
|
||||
protected boolean validateOptions() {
|
||||
// check shared options
|
||||
if (!generalValidOptions()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if helpfile exists
|
||||
if (!helpfile.isEmpty()) {
|
||||
DocFile help = DocFile.createFileForInput(this, helpfile);
|
||||
if (!help.exists()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.File_not_found", helpfile));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// check if stylesheetfile exists
|
||||
if (!stylesheetfile.isEmpty()) {
|
||||
DocFile stylesheet = DocFile.createFileForInput(this, stylesheetfile);
|
||||
if (!stylesheet.exists()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.File_not_found", stylesheetfile));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// check if additional stylesheets exists
|
||||
for (String ssheet : additionalStylesheets) {
|
||||
DocFile ssfile = DocFile.createFileForInput(this, ssheet);
|
||||
if (!ssfile.exists()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.File_not_found", ssheet));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// In a more object-oriented world, this would be done by methods on the Option objects.
|
||||
// Note that -windowtitle silently removes any and all HTML elements, and so does not need
|
||||
// to be handled here.
|
||||
utils.checkJavaScriptInOption("-header", header);
|
||||
utils.checkJavaScriptInOption("-footer", footer);
|
||||
utils.checkJavaScriptInOption("-top", top);
|
||||
utils.checkJavaScriptInOption("-bottom", bottom);
|
||||
utils.checkJavaScriptInOption("-doctitle", doctitle);
|
||||
utils.checkJavaScriptInOption("-packagesheader", packagesheader);
|
||||
|
||||
return true;
|
||||
@Override
|
||||
public HtmlOptions getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean finishOptionSettings() {
|
||||
if (!validateOptions()) {
|
||||
if (!options.validateOptions()) {
|
||||
return false;
|
||||
}
|
||||
if (!getSpecifiedTypeElements().isEmpty()) {
|
||||
@ -346,7 +188,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
docPaths = new DocPaths(utils);
|
||||
setCreateOverview();
|
||||
setTopFile(docEnv);
|
||||
workArounds.initDocLint(doclintOpts.values(), tagletManager.getAllTagletNames());
|
||||
workArounds.initDocLint(options.doclintOpts.values(), tagletManager.getAllTagletNames());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -364,7 +206,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
if (!checkForDeprecation(docEnv)) {
|
||||
return;
|
||||
}
|
||||
if (createoverview) {
|
||||
if (options.createOverview) {
|
||||
topFile = DocPaths.INDEX;
|
||||
} else {
|
||||
if (showModules) {
|
||||
@ -382,7 +224,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
}
|
||||
|
||||
protected TypeElement getValidClass(List<TypeElement> classes) {
|
||||
if (!nodeprecated) {
|
||||
if (!options.noDeprecated) {
|
||||
return classes.get(0);
|
||||
}
|
||||
for (TypeElement te : classes) {
|
||||
@ -404,14 +246,14 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
|
||||
/**
|
||||
* Generate "overview.html" page if option "-overview" is used or number of
|
||||
* packages is more than one. Sets {@link #createoverview} field to true.
|
||||
* packages is more than one. Sets {@link HtmlOptions#createOverview} field to true.
|
||||
*/
|
||||
protected void setCreateOverview() {
|
||||
if (!nooverview) {
|
||||
if (overviewpath != null
|
||||
if (!options.noOverview) {
|
||||
if (options.overviewPath != null
|
||||
|| modules.size() > 1
|
||||
|| (modules.isEmpty() && packages.size() > 1)) {
|
||||
createoverview = true;
|
||||
options.createOverview = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -441,6 +283,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
*/
|
||||
@Override
|
||||
public JavaFileObject getOverviewPath() {
|
||||
String overviewpath = options.overviewPath;
|
||||
if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager) {
|
||||
StandardJavaFileManager fm = (StandardJavaFileManager) getFileManager();
|
||||
return fm.getJavaFileObjects(overviewpath).iterator().next();
|
||||
@ -449,6 +292,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
}
|
||||
|
||||
public DocPath getMainStylesheet() {
|
||||
String stylesheetfile = options.stylesheetFile;
|
||||
if(!stylesheetfile.isEmpty()){
|
||||
DocFile docFile = DocFile.createFileForInput(this, stylesheetfile);
|
||||
return DocPath.create(docFile.getName());
|
||||
@ -457,7 +301,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
}
|
||||
|
||||
public List<DocPath> getAdditionalStylesheets() {
|
||||
return additionalStylesheets.stream()
|
||||
return options.additionalStylesheets.stream()
|
||||
.map(ssf -> DocFile.createFileForInput(this, ssf)).map(file -> DocPath.create(file.getName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@ -496,265 +340,18 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
tagSearchIndexKeys = tagSearchIndexMap.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Doclet.Option> getSupportedOptions() {
|
||||
Resources resources = getResources();
|
||||
Doclet.Option[] options = {
|
||||
new Option(resources, "--add-stylesheet", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
additionalStylesheets.add(args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-bottom", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
bottom = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-charset", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
charset = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-doctitle", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
doctitle = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-footer", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
footer = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-header", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
header = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-helpfile", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
if (nohelp == true) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-helpfile", "-nohelp"));
|
||||
return false;
|
||||
}
|
||||
if (!helpfile.isEmpty()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_reuse",
|
||||
"-helpfile"));
|
||||
return false;
|
||||
}
|
||||
helpfile = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-html5") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nohelp") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nohelp = true;
|
||||
if (!helpfile.isEmpty()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-nohelp", "-helpfile"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nodeprecatedlist") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nodeprecatedlist = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-noindex") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
createindex = false;
|
||||
if (splitindex == true) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-noindex", "-splitindex"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nonavbar") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nonavbar = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "-nooverview") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nooverview = true;
|
||||
if (overviewpath != null) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-nooverview", "-overview"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-notree") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
createtree = false;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-overview", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
overviewpath = args.get(0);
|
||||
if (nooverview == true) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-overview", "-nooverview"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "-packagesheader", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
packagesheader = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-splitindex") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
splitindex = true;
|
||||
if (createindex == false) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-splitindex", "-noindex"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "--main-stylesheet -stylesheetfile", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
stylesheetfile = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-top", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
top = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-use") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
classuse = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-windowtitle", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
windowtitle = args.get(0).replaceAll("\\<.*?>", "");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new XOption(resources, "-Xdoclint") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
doclintOpts.put(this, DocLint.XMSGS_OPTION);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new XOption(resources, "-Xdocrootparent", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
docrootparent = args.get(0);
|
||||
try {
|
||||
URL ignored = new URL(docrootparent);
|
||||
} catch (MalformedURLException e) {
|
||||
reporter.print(ERROR, resources.getText("doclet.MalformedURL", docrootparent));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new XOption(resources, "doclet.usage.xdoclint-extended", "-Xdoclint:", 0) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
String dopt = opt.replace("-Xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX);
|
||||
doclintOpts.put(this, dopt);
|
||||
if (dopt.contains("/")) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_doclint_no_qualifiers"));
|
||||
return false;
|
||||
}
|
||||
if (!DocLint.isValidOption(dopt)) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_doclint_invalid_arg"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new XOption(resources, "doclet.usage.xdoclint-package", "-Xdoclint/package:", 0) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
String dopt = opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE);
|
||||
doclintOpts.put(this, dopt);
|
||||
if (!DocLint.isValidOption(dopt)) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_doclint_package_invalid_arg"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new XOption(resources, "--no-frames") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
reporter.print(WARNING, resources.getText("doclet.NoFrames_specified"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
Set<Doclet.Option> oset = new TreeSet<>();
|
||||
oset.addAll(Arrays.asList(options));
|
||||
oset.addAll(super.getSupportedOptions());
|
||||
return oset;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean finishOptionSettings0() throws DocletException {
|
||||
if (docencoding == null) {
|
||||
if (charset == null) {
|
||||
docencoding = charset = (encoding == null) ? HTML_DEFAULT_CHARSET : encoding;
|
||||
if (options.docEncoding == null) {
|
||||
if (options.charset == null) {
|
||||
options.docEncoding = options.charset = (options.encoding == null) ? HTML_DEFAULT_CHARSET : options.encoding;
|
||||
} else {
|
||||
docencoding = charset;
|
||||
options.docEncoding = options.charset;
|
||||
}
|
||||
} else {
|
||||
if (charset == null) {
|
||||
charset = docencoding;
|
||||
} else if (!charset.equals(docencoding)) {
|
||||
if (options.charset == null) {
|
||||
options.charset = options.docEncoding;
|
||||
} else if (!options.charset.equals(options.docEncoding)) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict", "-charset", "-docencoding"));
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -108,7 +108,8 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
|
||||
throws DocletException {
|
||||
super.generateOtherFiles(docEnv, classtree);
|
||||
if (configuration.linksource) {
|
||||
HtmlOptions options = configuration.getOptions();
|
||||
if (options.linkSource) {
|
||||
SourceToHTMLConverter.convertRoot(configuration,
|
||||
docEnv, DocPaths.SOURCE_OUTPUT);
|
||||
}
|
||||
@ -119,27 +120,27 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
messages.error("doclet.No_Non_Deprecated_Classes_To_Document");
|
||||
return;
|
||||
}
|
||||
boolean nodeprecated = configuration.nodeprecated;
|
||||
performCopy(configuration.helpfile);
|
||||
performCopy(configuration.stylesheetfile);
|
||||
for (String stylesheet : configuration.additionalStylesheets) {
|
||||
boolean nodeprecated = options.noDeprecated;
|
||||
performCopy(options.helpFile);
|
||||
performCopy(options.stylesheetFile);
|
||||
for (String stylesheet : options.additionalStylesheets) {
|
||||
performCopy(stylesheet);
|
||||
}
|
||||
// do early to reduce memory footprint
|
||||
if (configuration.classuse) {
|
||||
if (options.classUse) {
|
||||
ClassUseWriter.generate(configuration, classtree);
|
||||
}
|
||||
IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated);
|
||||
|
||||
if (configuration.createtree) {
|
||||
if (options.createTree) {
|
||||
TreeWriter.generate(configuration, classtree);
|
||||
}
|
||||
|
||||
if (!(configuration.nodeprecatedlist || nodeprecated)) {
|
||||
if (!(options.noDeprecatedList || nodeprecated)) {
|
||||
DeprecatedListWriter.generate(configuration);
|
||||
}
|
||||
|
||||
if (configuration.createoverview) {
|
||||
if (options.createOverview) {
|
||||
if (configuration.showModules) {
|
||||
ModuleIndexWriter.generate(configuration);
|
||||
} else {
|
||||
@ -147,9 +148,9 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
}
|
||||
}
|
||||
|
||||
if (configuration.createindex) {
|
||||
if (options.createIndex) {
|
||||
configuration.buildSearchTagIndex();
|
||||
if (configuration.splitindex) {
|
||||
if (options.splitIndex) {
|
||||
SplitIndexWriter.generate(configuration, indexbuilder);
|
||||
} else {
|
||||
SingleIndexWriter.generate(configuration, indexbuilder);
|
||||
@ -162,25 +163,25 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
SystemPropertiesWriter.generate(configuration);
|
||||
}
|
||||
|
||||
if (configuration.createoverview) {
|
||||
if (options.createOverview) {
|
||||
IndexRedirectWriter.generate(configuration, DocPaths.OVERVIEW_SUMMARY, DocPaths.INDEX);
|
||||
} else {
|
||||
IndexRedirectWriter.generate(configuration);
|
||||
}
|
||||
|
||||
if (configuration.helpfile.isEmpty() && !configuration.nohelp) {
|
||||
if (options.helpFile.isEmpty() && !options.noHelp) {
|
||||
HelpWriter.generate(configuration);
|
||||
}
|
||||
// If a stylesheet file is not specified, copy the default stylesheet
|
||||
// and replace newline with platform-specific newline.
|
||||
DocFile f;
|
||||
if (configuration.stylesheetfile.length() == 0) {
|
||||
if (options.stylesheetFile.length() == 0) {
|
||||
f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
|
||||
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), true, true);
|
||||
}
|
||||
f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
|
||||
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
|
||||
if (configuration.createindex) {
|
||||
if (options.createIndex) {
|
||||
f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS);
|
||||
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_JS), true, true);
|
||||
|
||||
@ -272,26 +273,27 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
*/
|
||||
@Override // defined by AbstractDoclet
|
||||
protected void generatePackageFiles(ClassTree classtree) throws DocletException {
|
||||
HtmlOptions options = configuration.getOptions();
|
||||
Set<PackageElement> packages = configuration.packages;
|
||||
List<PackageElement> pList = new ArrayList<>(packages);
|
||||
for (PackageElement pkg : pList) {
|
||||
// if -nodeprecated option is set and the package is marked as
|
||||
// deprecated, do not generate the package-summary.html, package-frame.html
|
||||
// and package-tree.html pages for that package.
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
|
||||
if (!(options.noDeprecated && utils.isDeprecated(pkg))) {
|
||||
AbstractBuilder packageSummaryBuilder =
|
||||
configuration.getBuilderFactory().getPackageSummaryBuilder(pkg);
|
||||
packageSummaryBuilder.build();
|
||||
if (configuration.createtree) {
|
||||
PackageTreeWriter.generate(configuration, pkg, configuration.nodeprecated);
|
||||
if (options.createTree) {
|
||||
PackageTreeWriter.generate(configuration, pkg, options.noDeprecated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // defined by Doclet
|
||||
public Set<Option> getSupportedOptions() {
|
||||
return configuration.getSupportedOptions();
|
||||
public Set<? extends Option> getSupportedOptions() {
|
||||
return configuration.getOptions().getSupportedOptions();
|
||||
}
|
||||
|
||||
private void performCopy(String filename) throws DocFileIOException {
|
||||
|
@ -153,6 +153,8 @@ public class HtmlDocletWriter {
|
||||
*/
|
||||
public final HtmlConfiguration configuration;
|
||||
|
||||
protected final HtmlOptions options;
|
||||
|
||||
protected final Utils utils;
|
||||
|
||||
protected final Contents contents;
|
||||
@ -208,6 +210,7 @@ public class HtmlDocletWriter {
|
||||
*/
|
||||
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) {
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.contents = configuration.contents;
|
||||
this.messages = configuration.messages;
|
||||
this.resources = configuration.resources;
|
||||
@ -259,9 +262,9 @@ public class HtmlDocletWriter {
|
||||
// append htmlstr up to start of next {@docroot}
|
||||
buf.append(htmlstr.substring(prevEnd, match));
|
||||
prevEnd = docrootMatcher.end();
|
||||
if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) {
|
||||
if (options.docrootParent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) {
|
||||
// Insert the absolute link if {@docRoot} is followed by "/..".
|
||||
buf.append(configuration.docrootparent);
|
||||
buf.append(options.docrootParent);
|
||||
prevEnd += 3;
|
||||
} else {
|
||||
// Insert relative path where {@docRoot} was located
|
||||
@ -276,7 +279,7 @@ public class HtmlDocletWriter {
|
||||
return buf.toString();
|
||||
}
|
||||
//where:
|
||||
// Note: {@docRoot} is not case sensitive when passed in w/command line option:
|
||||
// Note: {@docRoot} is not case sensitive when passed in with a command-line option:
|
||||
private static final Pattern docrootPattern =
|
||||
Pattern.compile(Pattern.quote("{@docroot}"), Pattern.CASE_INSENSITIVE);
|
||||
|
||||
@ -339,7 +342,7 @@ public class HtmlDocletWriter {
|
||||
* @param htmltree the documentation tree to which the tags will be added
|
||||
*/
|
||||
protected void addTagsInfo(Element e, Content htmltree) {
|
||||
if (configuration.nocomment) {
|
||||
if (options.noComment) {
|
||||
return;
|
||||
}
|
||||
Content dl = new HtmlTree(HtmlTag.DL);
|
||||
@ -448,14 +451,14 @@ public class HtmlDocletWriter {
|
||||
List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets();
|
||||
additionalStylesheets.addAll(localStylesheets);
|
||||
Head head = new Head(path, configuration.docletVersion, configuration.startTime)
|
||||
.setTimestamp(!configuration.notimestamp)
|
||||
.setTimestamp(!options.noTimestamp)
|
||||
.setDescription(description)
|
||||
.setGenerator(getGenerator(getClass()))
|
||||
.setTitle(winTitle)
|
||||
.setCharset(configuration.charset)
|
||||
.setCharset(options.charset)
|
||||
.addKeywords(metakeywords)
|
||||
.setStylesheets(configuration.getMainStylesheet(), additionalStylesheets)
|
||||
.setIndex(configuration.createindex, mainBodyScript)
|
||||
.setIndex(options.createIndex, mainBodyScript)
|
||||
.addContent(extraHeadContent);
|
||||
|
||||
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body);
|
||||
@ -470,8 +473,8 @@ public class HtmlDocletWriter {
|
||||
* @return the window title string
|
||||
*/
|
||||
public String getWindowTitle(String title) {
|
||||
if (configuration.windowtitle.length() > 0) {
|
||||
title += " (" + configuration.windowtitle + ")";
|
||||
if (options.windowTitle.length() > 0) {
|
||||
title += " (" + options.windowTitle + ")";
|
||||
}
|
||||
return title;
|
||||
}
|
||||
@ -485,12 +488,12 @@ public class HtmlDocletWriter {
|
||||
public Content getUserHeaderFooter(boolean header) {
|
||||
String content;
|
||||
if (header) {
|
||||
content = replaceDocRootDir(configuration.header);
|
||||
content = replaceDocRootDir(options.header);
|
||||
} else {
|
||||
if (configuration.footer.length() != 0) {
|
||||
content = replaceDocRootDir(configuration.footer);
|
||||
if (options.footer.length() != 0) {
|
||||
content = replaceDocRootDir(options.footer);
|
||||
} else {
|
||||
content = replaceDocRootDir(configuration.header);
|
||||
content = replaceDocRootDir(options.header);
|
||||
}
|
||||
}
|
||||
Content rawContent = new RawHtml(content);
|
||||
@ -503,7 +506,7 @@ public class HtmlDocletWriter {
|
||||
* @param htmlTree the content tree to which user specified top will be added
|
||||
*/
|
||||
public void addTop(Content htmlTree) {
|
||||
Content top = new RawHtml(replaceDocRootDir(configuration.top));
|
||||
Content top = new RawHtml(replaceDocRootDir(options.top));
|
||||
htmlTree.add(top);
|
||||
}
|
||||
|
||||
@ -513,7 +516,7 @@ public class HtmlDocletWriter {
|
||||
* @param htmlTree the content tree to which user specified bottom will be added
|
||||
*/
|
||||
public void addBottom(Content htmlTree) {
|
||||
Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
|
||||
Content bottom = new RawHtml(replaceDocRootDir(options.bottom));
|
||||
Content small = HtmlTree.SMALL(bottom);
|
||||
Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
|
||||
htmlTree.add(p);
|
||||
@ -1259,7 +1262,7 @@ public class HtmlDocletWriter {
|
||||
*/
|
||||
private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr,
|
||||
boolean first, boolean inSummary, Content htmltree) {
|
||||
if(configuration.nocomment){
|
||||
if (options.noComment){
|
||||
return;
|
||||
}
|
||||
Content div;
|
||||
@ -1420,8 +1423,8 @@ public class HtmlDocletWriter {
|
||||
for (DocTree dt : node.getValue()) {
|
||||
if (utils.isText(dt) && isHRef) {
|
||||
String text = ((TextTree) dt).getBody();
|
||||
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
|
||||
result.add(configuration.docrootparent);
|
||||
if (text.startsWith("/..") && !options.docrootParent.isEmpty()) {
|
||||
result.add(options.docrootParent);
|
||||
docRootContent = new ContentBuilder();
|
||||
result.add(textCleanup(text.substring(3), isLastNode));
|
||||
} else {
|
||||
|
@ -0,0 +1,519 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.sun.tools.doclint.DocLint;
|
||||
import jdk.javadoc.doclet.Doclet;
|
||||
import jdk.javadoc.doclet.Reporter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
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},
|
||||
* including the format-independent options handled
|
||||
* by {@link BaseOptions}.
|
||||
*
|
||||
*/
|
||||
public class HtmlOptions extends BaseOptions {
|
||||
//<editor-fold desc="Option values">
|
||||
/**
|
||||
* Argument for command-line option {@code --add-stylesheet}.
|
||||
*/
|
||||
public List<String> additionalStylesheets = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -bottom}.
|
||||
*/
|
||||
public String bottom = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -charset}.
|
||||
* The META charset tag used for cross-platform viewing.
|
||||
*/
|
||||
public String charset = null;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -use}.
|
||||
* True if command-line option "-use" is used. Default value is false.
|
||||
*/
|
||||
public boolean classUse = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -noindex}.
|
||||
* False if command-line option "-noindex" is used. Default value is true.
|
||||
*/
|
||||
public boolean createIndex = true;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -overview}.
|
||||
* This is true if option "-overview" is used or option "-overview" is not
|
||||
* used and number of packages is more than one.
|
||||
*/
|
||||
public boolean createOverview = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -notree}.
|
||||
* False if command-line option "-notree" is used. Default value is true.
|
||||
*/
|
||||
public boolean createTree = true;
|
||||
|
||||
/**
|
||||
* Arguments for command-line option {@code -Xdoclint} and friends.
|
||||
* Collected set of doclint options.
|
||||
*/
|
||||
public Map<Doclet.Option, String> doclintOpts = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -Xdocrootparent}.
|
||||
*/
|
||||
public String docrootParent = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -doctitle}.
|
||||
*/
|
||||
public String docTitle = "";
|
||||
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -footer}.
|
||||
*/
|
||||
public String footer = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -header}.
|
||||
*/
|
||||
public String header = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -helpfile}.
|
||||
*/
|
||||
public String helpFile = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nodeprecated}.
|
||||
* True if command-line option "-nodeprecated" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean noDeprecatedList = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nohelp}.
|
||||
* True if command-line option "-nohelp" is used. Default value is false.
|
||||
*/
|
||||
public boolean noHelp = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nonavbar}.
|
||||
* True if command-line option "-nonavbar" is used. Default value is false.
|
||||
*/
|
||||
public boolean noNavbar = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nooverview}.
|
||||
* True if command-line option "-nooverview" is used. Default value is
|
||||
* false
|
||||
*/
|
||||
boolean noOverview = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -overview}.
|
||||
* The overview path specified with "-overview" flag.
|
||||
*/
|
||||
public String overviewPath = null;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -packagesheader}.
|
||||
*/
|
||||
public String packagesHeader = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -splitindex}.
|
||||
* True if command-line option "-splitindex" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean splitIndex = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -stylesheetfile}.
|
||||
*/
|
||||
public String stylesheetFile = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -top}.
|
||||
*/
|
||||
public String top = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -windowtitle}.
|
||||
*/
|
||||
public String windowTitle = "";
|
||||
//</editor-fold>
|
||||
|
||||
private HtmlConfiguration config;
|
||||
|
||||
HtmlOptions(HtmlConfiguration config) {
|
||||
super(config);
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<? extends Option> getSupportedOptions() {
|
||||
Resources resources = config.getResources();
|
||||
Reporter reporter = config.getReporter();
|
||||
|
||||
List<Option> options = List.of(
|
||||
new Option(resources, "--add-stylesheet", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
additionalStylesheets.add(args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-bottom", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
bottom = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-charset", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
charset = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-doctitle", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
docTitle = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-footer", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
footer = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-header", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
header = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-helpfile", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
if (noHelp) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-helpfile", "-nohelp"));
|
||||
return false;
|
||||
}
|
||||
if (!helpFile.isEmpty()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_reuse",
|
||||
"-helpfile"));
|
||||
return false;
|
||||
}
|
||||
helpFile = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-html5") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-nohelp") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noHelp = true;
|
||||
if (!helpFile.isEmpty()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-nohelp", "-helpfile"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-nodeprecatedlist") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noDeprecatedList = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-noindex") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
createIndex = false;
|
||||
if (splitIndex) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-noindex", "-splitindex"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-nonavbar") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noNavbar = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "-nooverview") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noOverview = true;
|
||||
if (overviewPath != null) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-nooverview", "-overview"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-notree") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
createTree = false;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-overview", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
overviewPath = args.get(0);
|
||||
if (noOverview) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-overview", "-nooverview"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "-packagesheader", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
packagesHeader = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-splitindex") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
splitIndex = true;
|
||||
if (!createIndex) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_conflict",
|
||||
"-splitindex", "-noindex"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "--main-stylesheet -stylesheetfile", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
stylesheetFile = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-top", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
top = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-use") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
classUse = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-windowtitle", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
windowTitle = args.get(0).replaceAll("<.*?>", "");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new XOption(resources, "-Xdoclint") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
doclintOpts.put(this, DocLint.XMSGS_OPTION);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new XOption(resources, "-Xdocrootparent", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
docrootParent = args.get(0);
|
||||
try {
|
||||
new URL(docrootParent);
|
||||
} catch (MalformedURLException e) {
|
||||
reporter.print(ERROR, resources.getText("doclet.MalformedURL", docrootParent));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new XOption(resources, "doclet.usage.xdoclint-extended", "-Xdoclint:", 0) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
String dopt = opt.replace("-Xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX);
|
||||
doclintOpts.put(this, dopt);
|
||||
if (dopt.contains("/")) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_doclint_no_qualifiers"));
|
||||
return false;
|
||||
}
|
||||
if (!DocLint.isValidOption(dopt)) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_doclint_invalid_arg"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new XOption(resources, "doclet.usage.xdoclint-package", "-Xdoclint/package:", 0) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
String dopt = opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE);
|
||||
doclintOpts.put(this, dopt);
|
||||
if (!DocLint.isValidOption(dopt)) {
|
||||
reporter.print(ERROR, resources.getText("doclet.Option_doclint_package_invalid_arg"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new XOption(resources, "--no-frames") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
reporter.print(WARNING, resources.getText("doclet.NoFrames_specified"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
Set<BaseOptions.Option> allOptions = new TreeSet<>();
|
||||
allOptions.addAll(options);
|
||||
allOptions.addAll(super.getSupportedOptions());
|
||||
return allOptions;
|
||||
}
|
||||
|
||||
protected boolean validateOptions() {
|
||||
// check shared options
|
||||
if (!generalValidOptions()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Resources resources = config.getResources();
|
||||
Reporter reporter = config.getReporter();
|
||||
|
||||
// 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));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// check if stylesheetFile exists
|
||||
if (!stylesheetFile.isEmpty()) {
|
||||
DocFile stylesheet = DocFile.createFileForInput(config, stylesheetFile);
|
||||
if (!stylesheet.exists()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.File_not_found", stylesheetFile));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// check if additional stylesheets exists
|
||||
for (String ssheet : additionalStylesheets) {
|
||||
DocFile ssfile = DocFile.createFileForInput(config, ssheet);
|
||||
if (!ssfile.exists()) {
|
||||
reporter.print(ERROR, resources.getText("doclet.File_not_found", ssheet));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// In a more object-oriented world, this would be done by methods on the Option objects.
|
||||
// Note that -windowtitle silently removes any and all HTML elements, and so does not need
|
||||
// to be handled here.
|
||||
Utils utils = config.utils;
|
||||
utils.checkJavaScriptInOption("-header", header);
|
||||
utils.checkJavaScriptInOption("-footer", footer);
|
||||
utils.checkJavaScriptInOption("-top", top);
|
||||
utils.checkJavaScriptInOption("-bottom", bottom);
|
||||
utils.checkJavaScriptInOption("-doctitle", docTitle);
|
||||
utils.checkJavaScriptInOption("-packagesheader", packagesHeader);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
@ -207,7 +207,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @return true if overview details need to be printed
|
||||
*/
|
||||
public boolean shouldPrintOverview(VariableElement field) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
if(!utils.getFullBody(field).isEmpty() ||
|
||||
writer.hasSerializationOverviewTags(field))
|
||||
return true;
|
||||
|
@ -75,18 +75,18 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
|
||||
private void generateIndexFile() throws DocFileIOException {
|
||||
Content htmlComment = contents.newPage;
|
||||
Head head = new Head(path, configuration.docletVersion, configuration.startTime)
|
||||
.setTimestamp(!configuration.notimestamp)
|
||||
.setTimestamp(!options.noTimestamp)
|
||||
.setDescription("index redirect")
|
||||
.setGenerator(getGenerator(getClass()))
|
||||
.setStylesheets(configuration.getMainStylesheet(), Collections.emptyList()) // avoid reference to default stylesheet
|
||||
.addDefaultScript(false);
|
||||
|
||||
String title = (configuration.windowtitle.length() > 0)
|
||||
? configuration.windowtitle
|
||||
String title = (options.windowTitle.length() > 0)
|
||||
? options.windowTitle
|
||||
: resources.getText("doclet.Generated_Docs_Untitled");
|
||||
|
||||
head.setTitle(title)
|
||||
.setCharset(configuration.charset)
|
||||
.setCharset(options.charset)
|
||||
.setCanonicalLink(target);
|
||||
|
||||
String targetPath = target.getPath();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -253,7 +253,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.MEMBER, typeElement, false);
|
||||
Content label;
|
||||
if (configuration.summarizeOverriddenMethods) {
|
||||
if (options.summarizeOverriddenMethods) {
|
||||
label = new StringContent(utils.isClass(typeElement)
|
||||
? resources.getText("doclet.Methods_Declared_In_Class")
|
||||
: resources.getText("doclet.Methods_Declared_In_Interface"));
|
||||
@ -285,7 +285,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
*/
|
||||
protected static void addOverridden(HtmlDocletWriter writer,
|
||||
TypeMirror overriddenType, ExecutableElement method, Content dl) {
|
||||
if (writer.configuration.nocomment) {
|
||||
if (writer.options.noComment) {
|
||||
return;
|
||||
}
|
||||
Utils utils = writer.utils;
|
||||
@ -336,7 +336,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
protected static void addImplementsInfo(HtmlDocletWriter writer,
|
||||
ExecutableElement method, Content dl) {
|
||||
Utils utils = writer.utils;
|
||||
if (utils.isStatic(method) || writer.configuration.nocomment) {
|
||||
if (utils.isStatic(method) || writer.options.noComment) {
|
||||
return;
|
||||
}
|
||||
Contents contents = writer.contents;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -31,11 +31,9 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
@ -110,7 +108,7 @@ public class ModuleIndexWriter extends AbstractOverviewIndexWriter {
|
||||
|
||||
for (ModuleElement mdle : modules) {
|
||||
if (!mdle.isUnnamed()) {
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(mdle))) {
|
||||
if (!(options.noDeprecated && utils.isDeprecated(mdle))) {
|
||||
Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()));
|
||||
Content summaryContent = new ContentBuilder();
|
||||
addSummaryComment(mdle, summaryContent);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -188,7 +188,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(mdle.getQualifiedName().toString()));
|
||||
Content headerContent = new ContentBuilder();
|
||||
addTop(headerContent);
|
||||
navBar.setDisplaySummaryModuleDescLink(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment);
|
||||
navBar.setDisplaySummaryModuleDescLink(!utils.getFullBody(mdle).isEmpty() && !options.noComment);
|
||||
navBar.setDisplaySummaryModulesLink(display(requires) || display(indirectModules));
|
||||
navBar.setDisplaySummaryPackagesLink(display(packages) || display(indirectPackages)
|
||||
|| display(indirectOpenPackages));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -122,7 +122,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.MEMBER, typeElement, false);
|
||||
Content label;
|
||||
if (configuration.summarizeOverriddenMethods) {
|
||||
if (options.summarizeOverriddenMethods) {
|
||||
label = new StringContent(utils.isInterface(typeElement)
|
||||
? resources.getText("doclet.Nested_Classes_Interfaces_Declared_In_Interface")
|
||||
: resources.getText("doclet.Nested_Classes_Interfaces_Declared_In_Class"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -33,7 +33,6 @@ import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
@ -110,7 +109,7 @@ public class PackageIndexWriter extends AbstractOverviewIndexWriter {
|
||||
|
||||
for (PackageElement pkg : configuration.packages) {
|
||||
if (!pkg.isUnnamed()) {
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
|
||||
if (!(options.noDeprecated && utils.isDeprecated(pkg))) {
|
||||
Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
|
||||
Content summaryContent = new ContentBuilder();
|
||||
addSummaryComment(pkg, summaryContent);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -213,7 +213,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.MEMBER, typeElement, false);
|
||||
Content label;
|
||||
if (configuration.summarizeOverriddenMethods) {
|
||||
if (options.summarizeOverriddenMethods) {
|
||||
label = new StringContent(utils.isClass(typeElement)
|
||||
? resources.getText("doclet.Properties_Declared_In_Class")
|
||||
: resources.getText("doclet.Properties_Declared_In_Interface"));
|
||||
|
@ -77,6 +77,7 @@ public class SourceToHTMLConverter {
|
||||
private static final String NEW_LINE = DocletConstants.NL;
|
||||
|
||||
private final HtmlConfiguration configuration;
|
||||
private final HtmlOptions options;
|
||||
private final Messages messages;
|
||||
private final Resources resources;
|
||||
private final Utils utils;
|
||||
@ -94,6 +95,7 @@ public class SourceToHTMLConverter {
|
||||
private SourceToHTMLConverter(HtmlConfiguration configuration, DocletEnvironment rd,
|
||||
DocPath outputdir) {
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.messages = configuration.getMessages();
|
||||
this.resources = configuration.resources;
|
||||
this.utils = configuration.utils;
|
||||
@ -122,20 +124,20 @@ public class SourceToHTMLConverter {
|
||||
for (ModuleElement mdl : configuration.getSpecifiedModuleElements()) {
|
||||
// If -nodeprecated option is set and the module is marked as deprecated,
|
||||
// do not convert the module files to HTML.
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(mdl)))
|
||||
if (!(options.noDeprecated && utils.isDeprecated(mdl)))
|
||||
convertModule(mdl, outputdir);
|
||||
}
|
||||
for (PackageElement pkg : configuration.getSpecifiedPackageElements()) {
|
||||
// If -nodeprecated option is set and the package is marked as deprecated,
|
||||
// do not convert the package files to HTML.
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(pkg)))
|
||||
if (!(options.noDeprecated && utils.isDeprecated(pkg)))
|
||||
convertPackage(pkg, outputdir);
|
||||
}
|
||||
for (TypeElement te : configuration.getSpecifiedTypeElements()) {
|
||||
// If -nodeprecated option is set and the class is marked as deprecated
|
||||
// or the containing package is deprecated, do not convert the
|
||||
// package files to HTML.
|
||||
if (!(configuration.nodeprecated &&
|
||||
if (!(options.noDeprecated &&
|
||||
(utils.isDeprecated(te) || utils.isDeprecated(utils.containingPackage(te)))))
|
||||
convertClass(te, outputdir);
|
||||
}
|
||||
@ -159,7 +161,7 @@ public class SourceToHTMLConverter {
|
||||
// do not convert the package files to HTML. We do not check for
|
||||
// containing package deprecation since it is already check in
|
||||
// the calling method above.
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(te)))
|
||||
if (!(options.noDeprecated && utils.isDeprecated(te)))
|
||||
convertClass((TypeElement)te, outputdir);
|
||||
}
|
||||
}
|
||||
@ -179,7 +181,7 @@ public class SourceToHTMLConverter {
|
||||
}
|
||||
for (Element elem : mdl.getEnclosedElements()) {
|
||||
if (elem instanceof PackageElement && configuration.docEnv.isIncluded(elem)
|
||||
&& !(configuration.nodeprecated && utils.isDeprecated(elem))) {
|
||||
&& !(options.noDeprecated && utils.isDeprecated(elem))) {
|
||||
convertPackage((PackageElement) elem, outputdir);
|
||||
}
|
||||
}
|
||||
@ -236,9 +238,9 @@ public class SourceToHTMLConverter {
|
||||
*/
|
||||
private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException {
|
||||
Head head = new Head(path, configuration.docletVersion, configuration.startTime)
|
||||
// .setTimestamp(!configuration.notimestamp) // temporary: compatibility!
|
||||
// .setTimestamp(!options.notimestamp) // temporary: compatibility!
|
||||
.setTitle(resources.getText("doclet.Window_Source_title"))
|
||||
// .setCharset(configuration.charset) // temporary: compatibility!
|
||||
// .setCharset(options.charset) // temporary: compatibility!
|
||||
.setDescription(HtmlDocletWriter.getDescription("source", te))
|
||||
.setGenerator(HtmlDocletWriter.getGenerator(getClass()))
|
||||
.addDefaultScript(false)
|
||||
@ -256,7 +258,7 @@ public class SourceToHTMLConverter {
|
||||
* @param head an HtmlTree to which the stylesheet links will be added
|
||||
*/
|
||||
public void addStyleSheetProperties(Content head) {
|
||||
String filename = configuration.stylesheetfile;
|
||||
String filename = options.stylesheetFile;
|
||||
DocPath stylesheet;
|
||||
if (filename.length() > 0) {
|
||||
DocFile file = DocFile.createFileForInput(configuration, filename);
|
||||
@ -271,7 +273,7 @@ public class SourceToHTMLConverter {
|
||||
}
|
||||
|
||||
protected void addStylesheets(Content tree) {
|
||||
List<String> stylesheets = configuration.additionalStylesheets;
|
||||
List<String> stylesheets = options.additionalStylesheets;
|
||||
if (!stylesheets.isEmpty()) {
|
||||
stylesheets.forEach((ssheet) -> {
|
||||
DocFile file = DocFile.createFileForInput(configuration, ssheet);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -72,6 +72,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
|
||||
private final HtmlDocletWriter htmlWriter;
|
||||
private final HtmlConfiguration configuration;
|
||||
private final HtmlOptions options;
|
||||
private final Utils utils;
|
||||
private final boolean inSummary;
|
||||
private final Resources resources;
|
||||
@ -83,9 +84,10 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence, boolean inSummary) {
|
||||
super(isFirstSentence);
|
||||
this.htmlWriter = htmlWriter;
|
||||
configuration = htmlWriter.configuration;
|
||||
this.utils = configuration.utils;
|
||||
this.inSummary = inSummary;
|
||||
configuration = htmlWriter.configuration;
|
||||
options = configuration.getOptions();
|
||||
utils = configuration.utils;
|
||||
resources = configuration.getResources();
|
||||
}
|
||||
|
||||
@ -438,7 +440,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
anchorName += "-" + count;
|
||||
}
|
||||
result = HtmlTree.SPAN(anchorName, HtmlStyle.searchTagResult, new StringContent(tagText));
|
||||
if (configuration.createindex && !tagText.isEmpty()) {
|
||||
if (options.createIndex && !tagText.isEmpty()) {
|
||||
SearchIndexItem si = new SearchIndexItem();
|
||||
si.setSystemProperty(isSystemProperty);
|
||||
si.setLabel(tagText);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -155,7 +155,7 @@ public class TreeWriter extends AbstractTreeWriter {
|
||||
// is set and the package is marked as deprecated, do not include
|
||||
// the page in the list of package hierarchies.
|
||||
if (pkg.isUnnamed() ||
|
||||
(configuration.nodeprecated && utils.isDeprecated(pkg))) {
|
||||
(options.noDeprecated && utils.isDeprecated(pkg))) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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,7 +25,6 @@
|
||||
package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
@ -39,6 +38,7 @@ import javax.lang.model.element.TypeElement;
|
||||
import jdk.javadoc.internal.doclets.formats.html.AbstractMemberWriter;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Contents;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlOptions;
|
||||
import jdk.javadoc.internal.doclets.formats.html.MarkerComments;
|
||||
import jdk.javadoc.internal.doclets.formats.html.SectionName;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
@ -62,6 +62,7 @@ import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.
|
||||
public class Navigation {
|
||||
|
||||
private final HtmlConfiguration configuration;
|
||||
private final HtmlOptions options;
|
||||
private final Element element;
|
||||
private final Contents contents;
|
||||
private final DocPath path;
|
||||
@ -133,6 +134,7 @@ public class Navigation {
|
||||
*/
|
||||
public Navigation(Element element, HtmlConfiguration configuration, PageMode page, DocPath path) {
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.element = element;
|
||||
this.contents = configuration.contents;
|
||||
this.documentedPage = page;
|
||||
@ -201,11 +203,11 @@ public class Navigation {
|
||||
private void addMainNavLinks(Content tree) {
|
||||
switch (documentedPage) {
|
||||
case OVERVIEW:
|
||||
addActivePageLink(tree, contents.overviewLabel, configuration.createoverview);
|
||||
addActivePageLink(tree, contents.overviewLabel, options.createOverview);
|
||||
addModuleLink(tree);
|
||||
addPackageLink(tree);
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
addPageLabel(tree, contents.useLabel, configuration.classuse);
|
||||
addPageLabel(tree, contents.useLabel, options.classUse);
|
||||
addTreeLink(tree);
|
||||
addDeprecatedLink(tree);
|
||||
addIndexLink(tree);
|
||||
@ -216,7 +218,7 @@ public class Navigation {
|
||||
addActivePageLink(tree, contents.moduleLabel, configuration.showModules);
|
||||
addPackageLink(tree);
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
addPageLabel(tree, contents.useLabel, configuration.classuse);
|
||||
addPageLabel(tree, contents.useLabel, options.classUse);
|
||||
addTreeLink(tree);
|
||||
addDeprecatedLink(tree);
|
||||
addIndexLink(tree);
|
||||
@ -227,11 +229,11 @@ public class Navigation {
|
||||
addModuleOfElementLink(tree);
|
||||
addActivePageLink(tree, contents.packageLabel, true);
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
if (configuration.classuse) {
|
||||
if (options.classUse) {
|
||||
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_USE,
|
||||
contents.useLabel, "", ""));
|
||||
}
|
||||
if (configuration.createtree) {
|
||||
if (options.createTree) {
|
||||
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE,
|
||||
contents.treeLabel, "", ""));
|
||||
}
|
||||
@ -244,11 +246,11 @@ public class Navigation {
|
||||
addModuleOfElementLink(tree);
|
||||
addPackageSummaryLink(tree);
|
||||
addActivePageLink(tree, contents.classLabel, true);
|
||||
if (configuration.classuse) {
|
||||
if (options.classUse) {
|
||||
addContentToTree(tree, links.createLink(DocPaths.CLASS_USE.resolve(path.basename()),
|
||||
contents.useLabel));
|
||||
}
|
||||
if (configuration.createtree) {
|
||||
if (options.createTree) {
|
||||
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE,
|
||||
contents.treeLabel, "", ""));
|
||||
}
|
||||
@ -266,7 +268,7 @@ public class Navigation {
|
||||
addPackageOfElementLink(tree);
|
||||
addContentToTree(tree, navLinkClass);
|
||||
}
|
||||
addActivePageLink(tree, contents.useLabel, configuration.classuse);
|
||||
addActivePageLink(tree, contents.useLabel, options.classUse);
|
||||
if (element instanceof PackageElement) {
|
||||
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel));
|
||||
} else {
|
||||
@ -288,8 +290,8 @@ public class Navigation {
|
||||
addPackageSummaryLink(tree);
|
||||
}
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
addPageLabel(tree, contents.useLabel, configuration.classuse);
|
||||
addActivePageLink(tree, contents.treeLabel, configuration.createtree);
|
||||
addPageLabel(tree, contents.useLabel, options.classUse);
|
||||
addActivePageLink(tree, contents.treeLabel, options.createTree);
|
||||
addDeprecatedLink(tree);
|
||||
addIndexLink(tree);
|
||||
addHelpLink(tree);
|
||||
@ -301,21 +303,21 @@ public class Navigation {
|
||||
addModuleLink(tree);
|
||||
addPackageLink(tree);
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
addPageLabel(tree, contents.useLabel, configuration.classuse);
|
||||
addPageLabel(tree, contents.useLabel, options.classUse);
|
||||
addTreeLink(tree);
|
||||
if (documentedPage == PageMode.DEPRECATED) {
|
||||
addActivePageLink(tree, contents.deprecatedLabel, !(configuration.nodeprecated
|
||||
|| configuration.nodeprecatedlist));
|
||||
addActivePageLink(tree, contents.deprecatedLabel, !(options.noDeprecated
|
||||
|| options.noDeprecatedList));
|
||||
} else {
|
||||
addDeprecatedLink(tree);
|
||||
}
|
||||
if (documentedPage == PageMode.INDEX) {
|
||||
addActivePageLink(tree, contents.indexLabel, configuration.createindex);
|
||||
addActivePageLink(tree, contents.indexLabel, options.createIndex);
|
||||
} else {
|
||||
addIndexLink(tree);
|
||||
}
|
||||
if (documentedPage == PageMode.HELP) {
|
||||
addActivePageLink(tree, contents.helpLabel, !configuration.nohelp);
|
||||
addActivePageLink(tree, contents.helpLabel, !options.noHelp);
|
||||
} else {
|
||||
addHelpLink(tree);
|
||||
}
|
||||
@ -329,7 +331,7 @@ public class Navigation {
|
||||
addModuleLink(tree);
|
||||
addPackageLink(tree);
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
addPageLabel(tree, contents.useLabel, configuration.classuse);
|
||||
addPageLabel(tree, contents.useLabel, options.classUse);
|
||||
addTreeLink(tree);
|
||||
addDeprecatedLink(tree);
|
||||
addIndexLink(tree);
|
||||
@ -340,7 +342,7 @@ public class Navigation {
|
||||
addModuleOfElementLink(tree);
|
||||
addContentToTree(tree, navLinkPackage);
|
||||
addPageLabel(tree, contents.classLabel, true);
|
||||
addPageLabel(tree, contents.useLabel, configuration.classuse);
|
||||
addPageLabel(tree, contents.useLabel, options.classUse);
|
||||
addTreeLink(tree);
|
||||
addDeprecatedLink(tree);
|
||||
addIndexLink(tree);
|
||||
@ -783,7 +785,7 @@ public class Navigation {
|
||||
}
|
||||
|
||||
private void addOverviewLink(Content tree) {
|
||||
if (configuration.createoverview) {
|
||||
if (options.createOverview) {
|
||||
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.INDEX),
|
||||
contents.overviewLabel, "", "")));
|
||||
}
|
||||
@ -849,7 +851,7 @@ public class Navigation {
|
||||
}
|
||||
|
||||
private void addTreeLink(Content tree) {
|
||||
if (configuration.createtree) {
|
||||
if (options.createTree) {
|
||||
List<PackageElement> packages = new ArrayList<>(configuration.getSpecifiedPackageElements());
|
||||
DocPath docPath = packages.size() == 1 && configuration.getSpecifiedTypeElements().isEmpty()
|
||||
? pathToRoot.resolve(configuration.docPaths.forPackage(packages.get(0)).resolve(DocPaths.PACKAGE_TREE))
|
||||
@ -859,16 +861,16 @@ public class Navigation {
|
||||
}
|
||||
|
||||
private void addDeprecatedLink(Content tree) {
|
||||
if (!(configuration.nodeprecated || configuration.nodeprecatedlist)) {
|
||||
if (!(options.noDeprecated || options.noDeprecatedList)) {
|
||||
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
|
||||
contents.deprecatedLabel, "", "")));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIndexLink(Content tree) {
|
||||
if (configuration.createindex) {
|
||||
if (options.createIndex) {
|
||||
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(
|
||||
(configuration.splitindex
|
||||
(options.splitIndex
|
||||
? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
|
||||
: DocPaths.INDEX_ALL)),
|
||||
contents.indexLabel, "", "")));
|
||||
@ -876,8 +878,8 @@ public class Navigation {
|
||||
}
|
||||
|
||||
private void addHelpLink(Content tree) {
|
||||
if (!configuration.nohelp) {
|
||||
String helpfile = configuration.helpfile;
|
||||
if (!options.noHelp) {
|
||||
String helpfile = options.helpFile;
|
||||
DocPath helpfilenm;
|
||||
if (helpfile.isEmpty()) {
|
||||
helpfilenm = DocPaths.HELP_DOC;
|
||||
@ -908,7 +910,7 @@ public class Navigation {
|
||||
* @return the navigation contents
|
||||
*/
|
||||
public Content getContent(boolean top) {
|
||||
if (configuration.nonavbar) {
|
||||
if (options.noNavbar) {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
Content tree = HtmlTree.NAV();
|
||||
@ -953,7 +955,7 @@ public class Navigation {
|
||||
addDetailLinks(ulNavDetail);
|
||||
div.add(ulNavDetail);
|
||||
subDiv.add(div);
|
||||
if (top && configuration.createindex) {
|
||||
if (top && options.createIndex) {
|
||||
addSearch(subDiv);
|
||||
}
|
||||
tree.add(subDiv);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -102,6 +102,7 @@ public abstract class AbstractDoclet implements Doclet {
|
||||
configuration.initConfiguration(docEnv);
|
||||
utils = configuration.utils;
|
||||
messages = configuration.getMessages();
|
||||
BaseOptions options = configuration.getOptions();
|
||||
|
||||
if (!isValidDoclet()) {
|
||||
return false;
|
||||
@ -125,16 +126,16 @@ public abstract class AbstractDoclet implements Doclet {
|
||||
messages.error("doclet.exception.write.file",
|
||||
e.fileName.getPath(), e.getCause());
|
||||
}
|
||||
dumpStack(configuration.dumpOnError, e);
|
||||
dumpStack(options.dumpOnError, e);
|
||||
|
||||
} catch (ResourceIOException e) {
|
||||
messages.error("doclet.exception.read.resource",
|
||||
e.resource.getPath(), e.getCause());
|
||||
dumpStack(configuration.dumpOnError, e);
|
||||
dumpStack(options.dumpOnError, e);
|
||||
|
||||
} catch (SimpleDocletException e) {
|
||||
configuration.reporter.print(ERROR, e.getMessage());
|
||||
dumpStack(configuration.dumpOnError, e);
|
||||
dumpStack(options.dumpOnError, e);
|
||||
|
||||
} catch (InternalException e) {
|
||||
configuration.reporter.print(ERROR, e.getMessage());
|
||||
@ -200,7 +201,7 @@ public abstract class AbstractDoclet implements Doclet {
|
||||
}
|
||||
messages.notice("doclet.build_version",
|
||||
configuration.getDocletVersion());
|
||||
ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
|
||||
ClassTree classtree = new ClassTree(configuration, configuration.getOptions().noDeprecated);
|
||||
|
||||
generateClassFiles(docEnv, classtree);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -26,7 +26,6 @@
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.ref.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
@ -51,7 +50,6 @@ import jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Extern;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Group;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MetaKeywords;
|
||||
@ -100,66 +98,15 @@ public abstract class BaseConfiguration {
|
||||
*/
|
||||
public static final String DEFAULT_BUILDER_XML = "resources/doclet.xml";
|
||||
|
||||
/**
|
||||
* The path to Taglets
|
||||
*/
|
||||
public String tagletpath = null;
|
||||
|
||||
/**
|
||||
* This is true if option "-serialwarn" is used. Default value is false to
|
||||
* suppress excessive warnings about serial tag.
|
||||
*/
|
||||
public boolean serialwarn = false;
|
||||
|
||||
/**
|
||||
* The specified amount of space between tab stops.
|
||||
*/
|
||||
public int sourcetab;
|
||||
|
||||
public String tabSpaces;
|
||||
|
||||
/**
|
||||
* True if we should generate browsable sources.
|
||||
*/
|
||||
public boolean linksource = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-nosince" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean nosince = false;
|
||||
|
||||
/**
|
||||
* True if we should recursively copy the doc-file subdirectories
|
||||
*/
|
||||
public boolean copydocfilesubdirs = false;
|
||||
|
||||
/**
|
||||
* Maintain backward compatibility with previous javadoc version
|
||||
*/
|
||||
public boolean backwardCompatibility = true;
|
||||
|
||||
/**
|
||||
* True if user wants to add member names as meta keywords.
|
||||
* Set to false because meta keywords are ignored in general
|
||||
* by most Internet search engines.
|
||||
*/
|
||||
public boolean keywords = false;
|
||||
|
||||
/**
|
||||
* The meta tag keywords instance.
|
||||
*/
|
||||
public final MetaKeywords metakeywords;
|
||||
|
||||
/**
|
||||
* The set of doc-file subdirectories to exclude
|
||||
*/
|
||||
protected Set<String> excludedDocFileDirs;
|
||||
|
||||
/**
|
||||
* The set of qualifiers to exclude
|
||||
*/
|
||||
protected Set<String> excludedQualifiers;
|
||||
public MetaKeywords metakeywords;
|
||||
|
||||
/**
|
||||
* The doclet environment.
|
||||
@ -176,61 +123,6 @@ public abstract class BaseConfiguration {
|
||||
*/
|
||||
public WorkArounds workArounds;
|
||||
|
||||
/**
|
||||
* Destination directory name, in which doclet will generate the entire
|
||||
* documentation. Default is current directory.
|
||||
*/
|
||||
public String destDirName = "";
|
||||
|
||||
/**
|
||||
* Destination directory name, in which doclet will copy the doc-files to.
|
||||
*/
|
||||
public String docFileDestDirName = "";
|
||||
|
||||
/**
|
||||
* Encoding for this document. Default is default encoding for this
|
||||
* platform.
|
||||
*/
|
||||
public String docencoding = null;
|
||||
|
||||
/**
|
||||
* True if user wants to suppress descriptions and tags.
|
||||
*/
|
||||
public boolean nocomment = false;
|
||||
|
||||
/**
|
||||
* Encoding for this document. Default is default encoding for this
|
||||
* platform.
|
||||
*/
|
||||
public String encoding = null;
|
||||
|
||||
/**
|
||||
* Generate author specific information for all the classes if @author
|
||||
* tag is used in the doc comment and if -author option is used.
|
||||
* <code>showauthor</code> is set to true if -author option is used.
|
||||
* Default is don't show author information.
|
||||
*/
|
||||
public boolean showauthor = false;
|
||||
|
||||
/**
|
||||
* Generate documentation for JavaFX getters and setters automatically
|
||||
* by copying it from the appropriate property definition.
|
||||
*/
|
||||
public boolean javafx = false;
|
||||
|
||||
/**
|
||||
* Generate version specific information for the all the classes
|
||||
* if @version tag is used in the doc comment and if -version option is
|
||||
* used. <code>showversion</code> is set to true if -version option is
|
||||
* used.Default is don't show version information.
|
||||
*/
|
||||
public boolean showversion = false;
|
||||
|
||||
/**
|
||||
* Allow JavaScript in doc comments.
|
||||
*/
|
||||
private boolean allowScriptInComments = false;
|
||||
|
||||
/**
|
||||
* Sourcepath from where to read the source files. Default is classpath.
|
||||
*/
|
||||
@ -241,25 +133,11 @@ public abstract class BaseConfiguration {
|
||||
*/
|
||||
public boolean showModules = false;
|
||||
|
||||
/**
|
||||
* Don't generate deprecated API information at all, if -nodeprecated
|
||||
* option is used. <code>nodeprecated</code> is set to true if
|
||||
* -nodeprecated option is used. Default is generate deprecated API
|
||||
* information.
|
||||
*/
|
||||
public boolean nodeprecated = false;
|
||||
|
||||
/**
|
||||
* The catalog of classes specified on the command-line
|
||||
*/
|
||||
public TypeElementCatalog typeElementCatalog;
|
||||
|
||||
/**
|
||||
* True if user wants to suppress time stamp in output.
|
||||
* Default is false.
|
||||
*/
|
||||
public boolean notimestamp = false;
|
||||
|
||||
/**
|
||||
* The package grouping instance.
|
||||
*/
|
||||
@ -274,28 +152,6 @@ public abstract class BaseConfiguration {
|
||||
|
||||
public Locale locale;
|
||||
|
||||
/**
|
||||
* Suppress all messages
|
||||
*/
|
||||
public boolean quiet = false;
|
||||
|
||||
/**
|
||||
* Specifies whether those methods that override a super-type's method
|
||||
* with no changes to the API contract should be summarized in the
|
||||
* footnote section.
|
||||
*/
|
||||
public boolean summarizeOverriddenMethods = false;
|
||||
|
||||
// A list containing urls
|
||||
private final List<String> linkList = new ArrayList<>();
|
||||
|
||||
// A list of pairs containing urls and package list
|
||||
private final List<Pair<String, String>> linkOfflineList = new ArrayList<>();
|
||||
|
||||
public boolean dumpOnError = false;
|
||||
|
||||
private List<Pair<String, String>> groupPairs;
|
||||
|
||||
public abstract Messages getMessages();
|
||||
|
||||
public abstract Resources getResources();
|
||||
@ -341,18 +197,6 @@ public abstract class BaseConfiguration {
|
||||
protected static final String sharedResourceBundleName =
|
||||
"jdk.javadoc.internal.doclets.toolkit.resources.doclets";
|
||||
|
||||
/**
|
||||
* Primarily used to disable strict checks in the regression
|
||||
* tests allowing those tests to be executed successfully, for
|
||||
* instance, with OpenJDK builds which may not contain FX libraries.
|
||||
*/
|
||||
public boolean disableJavaFxStrictChecks = false;
|
||||
|
||||
/**
|
||||
* Show taglets (internal debug switch)
|
||||
*/
|
||||
public boolean showTaglets = false;
|
||||
|
||||
VisibleMemberCache visibleMemberCache = null;
|
||||
|
||||
public PropertyUtils propertyUtils = null;
|
||||
@ -372,13 +216,10 @@ public abstract class BaseConfiguration {
|
||||
*/
|
||||
public BaseConfiguration(Doclet doclet) {
|
||||
this.doclet = doclet;
|
||||
excludedDocFileDirs = new HashSet<>();
|
||||
excludedQualifiers = new HashSet<>();
|
||||
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
|
||||
metakeywords = new MetaKeywords(this);
|
||||
groupPairs = new ArrayList<>(0);
|
||||
}
|
||||
|
||||
public abstract BaseOptions getOptions();
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
protected void initConfiguration(DocletEnvironment docEnv) {
|
||||
@ -390,11 +231,13 @@ public abstract class BaseConfiguration {
|
||||
// Utils needs docEnv, safe to init now.
|
||||
utils = new Utils(this);
|
||||
|
||||
if (!javafx) {
|
||||
javafx = isJavaFXMode();
|
||||
BaseOptions options = getOptions();
|
||||
if (!options.javafx) {
|
||||
options.javafx = isJavaFXMode();
|
||||
}
|
||||
|
||||
// Once docEnv and Utils have been initialized, others should be safe.
|
||||
metakeywords = new MetaKeywords(this);
|
||||
cmtUtils = new CommentUtils(this);
|
||||
workArounds = new WorkArounds(this);
|
||||
visibleMemberCache = new VisibleMemberCache(this);
|
||||
@ -505,265 +348,23 @@ public abstract class BaseConfiguration {
|
||||
packages.addAll(includedPackageElements);
|
||||
}
|
||||
|
||||
public Set<Doclet.Option> getSupportedOptions() {
|
||||
Resources resources = getResources();
|
||||
Doclet.Option[] options = {
|
||||
new Option(resources, "-author") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
showauthor = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-d", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
destDirName = addTrailingFileSep(args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-docencoding", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
docencoding = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-docfilessubdirs") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
copydocfilesubdirs = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "-encoding", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
encoding = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-excludedocfilessubdir", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
addToSet(excludedDocFileDirs, args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-group", 2) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
groupPairs.add(new Pair<>(args.get(0), args.get(1)));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "--javafx -javafx") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
javafx = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-keywords") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
keywords = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-link", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linkList.add(args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-linksource") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linksource = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-linkoffline", 2) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linkOfflineList.add(new Pair<>(args.get(0), args.get(1)));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nocomment") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nocomment = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nodeprecated") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nodeprecated = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nosince") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
nosince = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-notimestamp") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
notimestamp = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-noqualifier", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
addToSet(excludedQualifiers, args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "--override-methods", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
String o = args.get(0);
|
||||
switch (o) {
|
||||
case "summary":
|
||||
summarizeOverriddenMethods = true;
|
||||
break;
|
||||
case "detail":
|
||||
summarizeOverriddenMethods = false;
|
||||
break;
|
||||
default:
|
||||
reporter.print(ERROR,
|
||||
getResources().getText("doclet.Option_invalid",o, "--override-methods"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "-quiet") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
quiet = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-serialwarn") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
serialwarn = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-sourcetab", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linksource = true;
|
||||
try {
|
||||
setTabWidth(Integer.parseInt(args.get(0)));
|
||||
} catch (NumberFormatException e) {
|
||||
//Set to -1 so that warning will be printed
|
||||
//to indicate what is valid argument.
|
||||
sourcetab = -1;
|
||||
}
|
||||
if (sourcetab <= 0) {
|
||||
getMessages().warning("doclet.sourcetab_warning");
|
||||
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-tag", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(opt);
|
||||
list.add(args.get(0));
|
||||
customTagStrs.add(list);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-taglet", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(opt);
|
||||
list.add(args.get(0));
|
||||
customTagStrs.add(list);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-tagletpath", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
tagletpath = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-version") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
showversion = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "--dump-on-error") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
dumpOnError = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "--allow-script-in-comments") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
allowScriptInComments = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "--disable-javafx-strict-checks") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
disableJavaFxStrictChecks = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "--show-taglets") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
showTaglets = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
Set<Doclet.Option> set = new TreeSet<>();
|
||||
set.addAll(Arrays.asList(options));
|
||||
return set;
|
||||
}
|
||||
|
||||
final LinkedHashSet<List<String>> customTagStrs = new LinkedHashSet<>();
|
||||
|
||||
/*
|
||||
* when this is called all the option have been set, this method,
|
||||
* initializes certain components before anything else is started.
|
||||
*/
|
||||
protected boolean finishOptionSettings0() throws DocletException {
|
||||
BaseOptions options = getOptions();
|
||||
extern = new Extern(this);
|
||||
initDestDirectory();
|
||||
for (String link : linkList) {
|
||||
for (String link : options.linkList) {
|
||||
extern.link(link, reporter);
|
||||
}
|
||||
for (Pair<String, String> linkOfflinePair : linkOfflineList) {
|
||||
for (Pair<String, String> linkOfflinePair : options.linkOfflineList) {
|
||||
extern.link(linkOfflinePair.first, linkOfflinePair.second, reporter);
|
||||
}
|
||||
typeElementCatalog = new TypeElementCatalog(includedTypeElements, this);
|
||||
initTagletManager(customTagStrs);
|
||||
groupPairs.stream().forEach((grp) -> {
|
||||
initTagletManager(options.customTagStrs);
|
||||
options.groupPairs.stream().forEach((grp) -> {
|
||||
if (showModules) {
|
||||
group.checkModuleGroups(grp.first, grp.second);
|
||||
} else {
|
||||
@ -775,7 +376,7 @@ public abstract class BaseConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the command line options supported by this configuration.
|
||||
* Set the command-line options supported by this configuration.
|
||||
*
|
||||
* @return true if the options are set successfully
|
||||
* @throws DocletException if there is a problem while setting the options
|
||||
@ -790,6 +391,7 @@ public abstract class BaseConfiguration {
|
||||
}
|
||||
|
||||
private void initDestDirectory() throws DocletException {
|
||||
String destDirName = getOptions().destDirName;
|
||||
if (!destDirName.isEmpty()) {
|
||||
Resources resources = getResources();
|
||||
DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
|
||||
@ -818,13 +420,11 @@ public abstract class BaseConfiguration {
|
||||
* either -tag or -taglet arguments.
|
||||
*/
|
||||
private void initTagletManager(Set<List<String>> customTagStrs) {
|
||||
tagletManager = tagletManager == null ?
|
||||
new TagletManager(nosince, showversion, showauthor, javafx, this) :
|
||||
tagletManager;
|
||||
tagletManager = tagletManager != null ? tagletManager : new TagletManager(this);
|
||||
JavaFileManager fileManager = getFileManager();
|
||||
Messages messages = getMessages();
|
||||
try {
|
||||
tagletManager.initTagletPath(fileManager, tagletpath);
|
||||
tagletManager.initTagletPath(fileManager);
|
||||
tagletManager.loadTaglets(fileManager);
|
||||
|
||||
for (List<String> args : customTagStrs) {
|
||||
@ -905,81 +505,6 @@ public abstract class BaseConfiguration {
|
||||
return tokens;
|
||||
}
|
||||
|
||||
private void addToSet(Set<String> s, String str) {
|
||||
StringTokenizer st = new StringTokenizer(str, ":");
|
||||
String current;
|
||||
while (st.hasMoreTokens()) {
|
||||
current = st.nextToken();
|
||||
s.add(current);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a trailing file separator, if not found. Remove superfluous
|
||||
* file separators if any. Preserve the front double file separator for
|
||||
* UNC paths.
|
||||
*
|
||||
* @param path Path under consideration.
|
||||
* @return String Properly constructed path string.
|
||||
*/
|
||||
public static String addTrailingFileSep(String path) {
|
||||
String fs = System.getProperty("file.separator");
|
||||
String dblfs = fs + fs;
|
||||
int indexDblfs;
|
||||
while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) {
|
||||
path = path.substring(0, indexDblfs) +
|
||||
path.substring(indexDblfs + fs.length());
|
||||
}
|
||||
if (!path.endsWith(fs))
|
||||
path += fs;
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks for the validity of the options used by the user.
|
||||
* As of this writing, this checks only docencoding.
|
||||
*
|
||||
* @return true if all the options are valid.
|
||||
*/
|
||||
public boolean generalValidOptions() {
|
||||
if (docencoding != null) {
|
||||
if (!checkOutputFileEncoding(docencoding)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (docencoding == null && (encoding != null && !encoding.isEmpty())) {
|
||||
if (!checkOutputFileEncoding(encoding)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the validity of the given Source or Output File encoding on this
|
||||
* platform.
|
||||
*
|
||||
* @param docencoding output file encoding.
|
||||
*/
|
||||
private boolean checkOutputFileEncoding(String docencoding) {
|
||||
OutputStream ost = new ByteArrayOutputStream();
|
||||
OutputStreamWriter osw = null;
|
||||
try {
|
||||
osw = new OutputStreamWriter(ost, docencoding);
|
||||
} catch (UnsupportedEncodingException exc) {
|
||||
reporter.print(ERROR, getResources().getText("doclet.Encoding_not_supported", docencoding));
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (osw != null) {
|
||||
osw.close();
|
||||
}
|
||||
} catch (IOException exc) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given doc-file subdirectory should be excluded and
|
||||
* false otherwise.
|
||||
@ -988,6 +513,7 @@ public abstract class BaseConfiguration {
|
||||
* @return true if the directory is excluded.
|
||||
*/
|
||||
public boolean shouldExcludeDocFileDir(String docfilesubdir) {
|
||||
Set<String> excludedDocFileDirs = getOptions().excludedDocFileDirs;
|
||||
return excludedDocFileDirs.contains(docfilesubdir);
|
||||
}
|
||||
|
||||
@ -998,6 +524,7 @@ public abstract class BaseConfiguration {
|
||||
* @return true if the qualifier should be excluded
|
||||
*/
|
||||
public boolean shouldExcludeQualifier(String qualifier) {
|
||||
Set<String> excludedQualifiers = getOptions().excludedQualifiers;
|
||||
if (excludedQualifiers.contains("all") ||
|
||||
excludedQualifiers.contains(qualifier) ||
|
||||
excludedQualifiers.contains(qualifier + ".*")) {
|
||||
@ -1037,6 +564,7 @@ public abstract class BaseConfiguration {
|
||||
* @return true if it is a generated doc.
|
||||
*/
|
||||
public boolean isGeneratedDoc(TypeElement te) {
|
||||
boolean nodeprecated = getOptions().noDeprecated;
|
||||
if (!nodeprecated) {
|
||||
return true;
|
||||
}
|
||||
@ -1083,138 +611,10 @@ public abstract class BaseConfiguration {
|
||||
*/
|
||||
public abstract JavaFileManager getFileManager();
|
||||
|
||||
private void setTabWidth(int n) {
|
||||
sourcetab = n;
|
||||
tabSpaces = String.format("%" + n + "s", "");
|
||||
}
|
||||
|
||||
public abstract boolean showMessage(DocTreePath path, String key);
|
||||
|
||||
public abstract boolean showMessage(Element e, String key);
|
||||
|
||||
public abstract static class Option implements Doclet.Option, Comparable<Option> {
|
||||
private final String[] names;
|
||||
private final String parameters;
|
||||
private final String description;
|
||||
private final int argCount;
|
||||
|
||||
protected Option(Resources resources, String name, int argCount) {
|
||||
this(resources, null, name, argCount);
|
||||
}
|
||||
|
||||
protected Option(Resources resources, String keyBase, String name, int argCount) {
|
||||
this.names = name.trim().split("\\s+");
|
||||
if (keyBase == null) {
|
||||
keyBase = "doclet.usage." + names[0].toLowerCase().replaceAll("^-+", "");
|
||||
}
|
||||
String desc = getOptionsMessage(resources, keyBase + ".description");
|
||||
if (desc.isEmpty()) {
|
||||
this.description = "<MISSING KEY>";
|
||||
this.parameters = "<MISSING KEY>";
|
||||
} else {
|
||||
this.description = desc;
|
||||
this.parameters = getOptionsMessage(resources, keyBase + ".parameters");
|
||||
}
|
||||
this.argCount = argCount;
|
||||
}
|
||||
|
||||
protected Option(Resources resources, String name) {
|
||||
this(resources, name, 0);
|
||||
}
|
||||
|
||||
private String getOptionsMessage(Resources resources, String key) {
|
||||
try {
|
||||
return resources.getText(key);
|
||||
} catch (MissingResourceException ignore) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option.Kind getKind() {
|
||||
return Doclet.Option.Kind.STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNames() {
|
||||
return Arrays.asList(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Arrays.toString(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArgumentCount() {
|
||||
return argCount;
|
||||
}
|
||||
|
||||
public boolean matches(String option) {
|
||||
for (String name : names) {
|
||||
boolean matchCase = name.startsWith("--");
|
||||
if (option.startsWith("--") && option.contains("=")) {
|
||||
return name.equals(option.substring(option.indexOf("=") + 1));
|
||||
} else if (matchCase) {
|
||||
return name.equals(option);
|
||||
}
|
||||
return name.toLowerCase().equals(option.toLowerCase());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Option that) {
|
||||
return this.getNames().get(0).compareTo(that.getNames().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class XOption extends Option {
|
||||
|
||||
public XOption(Resources resources, String prefix, String name, int argCount) {
|
||||
super(resources, prefix, name, argCount);
|
||||
}
|
||||
|
||||
public XOption(Resources resources, String name, int argCount) {
|
||||
super(resources, name, argCount);
|
||||
}
|
||||
|
||||
public XOption(Resources resources, String name) {
|
||||
this(resources, name, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option.Kind getKind() {
|
||||
return Doclet.Option.Kind.EXTENDED;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Hidden extends Option {
|
||||
|
||||
public Hidden(Resources resources, String name, int argCount) {
|
||||
super(resources, name, argCount);
|
||||
}
|
||||
|
||||
public Hidden(Resources resources, String name) {
|
||||
this(resources, name, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option.Kind getKind() {
|
||||
return Doclet.Option.Kind.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Splits the elements in a collection to its individual
|
||||
* collection.
|
||||
@ -1268,12 +668,12 @@ public abstract class BaseConfiguration {
|
||||
|
||||
/**
|
||||
* Returns whether or not to allow JavaScript in comments.
|
||||
* Default is off; can be set true from a command line option.
|
||||
* Default is off; can be set true from a command-line option.
|
||||
*
|
||||
* @return the allowScriptInComments
|
||||
*/
|
||||
public boolean isAllowScriptInComments() {
|
||||
return allowScriptInComments;
|
||||
return getOptions().allowScriptInComments;
|
||||
}
|
||||
|
||||
public synchronized VisibleMemberTable getVisibleMemberTable(TypeElement te) {
|
||||
|
@ -0,0 +1,734 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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.toolkit;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import jdk.javadoc.doclet.Doclet;
|
||||
import jdk.javadoc.doclet.Reporter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
import static javax.tools.Diagnostic.Kind.ERROR;
|
||||
|
||||
/**
|
||||
* Storage for the format-independent options supported by the toolkit.
|
||||
* The objects to handle command-line options, and to initialize this
|
||||
* object, are all subtypes of {@link BaseOptions.Option},
|
||||
* returned by {@link BaseOptions#getSupportedOptions()}.
|
||||
*/
|
||||
public abstract class BaseOptions {
|
||||
|
||||
//<editor-fold desc="Option values">
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code --allow-script-in-comments}.
|
||||
* Allow JavaScript in doc comments.
|
||||
*/
|
||||
public boolean allowScriptInComments = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -docfilessubdirs}.
|
||||
* True if we should recursively copy the doc-file subdirectories
|
||||
*/
|
||||
public boolean copyDocfileSubdirs = false;
|
||||
|
||||
/**
|
||||
* Arguments for command-line option {@code -tag} and {@code -taglet}.
|
||||
*/
|
||||
final LinkedHashSet<List<String>> customTagStrs = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -d}.
|
||||
* Destination directory name, in which doclet will generate the entire
|
||||
* documentation. Default is current directory.
|
||||
*/
|
||||
public String destDirName = "";
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code --disable-javafx-strict-checks}.
|
||||
* Primarily used to disable strict checks in the regression
|
||||
* tests allowing those tests to be executed successfully, for
|
||||
* instance, with OpenJDK builds which may not contain FX libraries.
|
||||
*/
|
||||
public boolean disableJavaFxStrictChecks = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -docencoding}.
|
||||
* Encoding for this document. Default is default encoding for this
|
||||
* platform.
|
||||
*/
|
||||
public String docEncoding = null;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code ???}.
|
||||
* Destination directory name, in which doclet will copy the doc-files to.
|
||||
*/
|
||||
public String docFileDestDirName = "";
|
||||
|
||||
/**
|
||||
* Argument for hidden command-line option {@code --dump-on-error}.
|
||||
*/
|
||||
public boolean dumpOnError = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -encoding}.
|
||||
* Encoding for this document. Default is default encoding for this
|
||||
* platform.
|
||||
*/
|
||||
public String encoding = null;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -excludedocfilessubdir}.
|
||||
* The set of doc-file subdirectories to exclude.
|
||||
*/
|
||||
protected Set<String> excludedDocFileDirs;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -noqualifier}.
|
||||
* The set of qualifiers to exclude.
|
||||
*/
|
||||
protected Set<String> excludedQualifiers;
|
||||
|
||||
/**
|
||||
* Arguments for command-line option {@code -group}
|
||||
*/
|
||||
List<Utils.Pair<String, String>> groupPairs;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code --javafx} or {@code -javafx}.
|
||||
* Generate documentation for JavaFX getters and setters automatically
|
||||
* by copying it from the appropriate property definition.
|
||||
*/
|
||||
public boolean javafx = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -keywords}.
|
||||
* True if user wants to add member names as meta keywords.
|
||||
* Set to false because meta keywords are ignored in general
|
||||
* by most Internet search engines.
|
||||
*/
|
||||
public boolean keywords = false;
|
||||
|
||||
/**
|
||||
* Arguments for command-line option {@code -link}.
|
||||
*/
|
||||
// A list containing urls
|
||||
final List<String> linkList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Arguments for command-line option {@code -linkoffline}.
|
||||
*/
|
||||
// A list of pairs containing urls and package list
|
||||
final List<Utils.Pair<String, String>> linkOfflineList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -linksource}.
|
||||
* True if we should generate browsable sources.
|
||||
*/
|
||||
public boolean linkSource = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nocomment}.
|
||||
* True if user wants to suppress descriptions and tags.
|
||||
*/
|
||||
public boolean noComment = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nodeprecated}.
|
||||
* Don't generate deprecated API information at all, if -nodeprecated
|
||||
* option is used. <code>nodeprecated</code> is set to true if
|
||||
* -nodeprecated option is used. Default is generate deprecated API
|
||||
* information.
|
||||
*/
|
||||
public boolean noDeprecated = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -nosince}.
|
||||
* True if command-line option "-nosince" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean noSince = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -notimestamp}.
|
||||
* True if user wants to suppress time stamp in output.
|
||||
* Default is false.
|
||||
*/
|
||||
public boolean noTimestamp = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -quiet}.
|
||||
* Suppress all messages
|
||||
*/
|
||||
public boolean quiet = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -serialwarn}.
|
||||
* This is true if option "-serialwarn" is used. Default value is false to
|
||||
* suppress excessive warnings about serial tag.
|
||||
*/
|
||||
public boolean serialWarn = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -author}.
|
||||
* Generate author specific information for all the classes if @author
|
||||
* tag is used in the doc comment and if -author option is used.
|
||||
* <code>showauthor</code> is set to true if -author option is used.
|
||||
* Default is don't show author information.
|
||||
*/
|
||||
public boolean showAuthor = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code --show-taglets}.
|
||||
* Show taglets (internal debug switch)
|
||||
*/
|
||||
public boolean showTaglets = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -version}.
|
||||
* Generate version specific information for the all the classes
|
||||
* if @version tag is used in the doc comment and if -version option is
|
||||
* used. {@code showVersion} is set to true if -version option is
|
||||
* used. Default is don't show version information.
|
||||
*/
|
||||
public boolean showVersion = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -sourcetab}.
|
||||
* The specified amount of space between tab stops.
|
||||
*/
|
||||
public int sourceTabSize;
|
||||
|
||||
/**
|
||||
* Value for command-line option {@code --override-methods summary}
|
||||
* or {@code --override-methods detail}.
|
||||
* Specifies whether those methods that override a super-type's method
|
||||
* with no changes to the API contract should be summarized in the
|
||||
* footnote section.
|
||||
*/
|
||||
public boolean summarizeOverriddenMethods = false;
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -tagletpath}.
|
||||
* The path to Taglets
|
||||
*/
|
||||
public String tagletPath = null;
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
private final BaseConfiguration config;
|
||||
|
||||
protected BaseOptions(BaseConfiguration config) {
|
||||
this.config = config;
|
||||
|
||||
excludedDocFileDirs = new HashSet<>();
|
||||
excludedQualifiers = new HashSet<>();
|
||||
sourceTabSize = DocletConstants.DEFAULT_TAB_STOP_LENGTH;
|
||||
groupPairs = new ArrayList<>(0);
|
||||
}
|
||||
|
||||
public Set<? extends Option> getSupportedOptions() {
|
||||
Resources resources = config.getResources();
|
||||
Messages messages = config.getMessages();
|
||||
Reporter reporter = config.getReporter();
|
||||
|
||||
List<Option> options = List.of(
|
||||
new Option(resources, "-author") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
showAuthor = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-d", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
destDirName = addTrailingFileSep(args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-docencoding", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
docEncoding = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-docfilessubdirs") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
copyDocfileSubdirs = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "-encoding", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
encoding = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-excludedocfilessubdir", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
addToSet(excludedDocFileDirs, args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-group", 2) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
groupPairs.add(new Utils.Pair<>(args.get(0), args.get(1)));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "--javafx -javafx") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
javafx = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-keywords") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
keywords = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-link", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linkList.add(args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-linksource") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linkSource = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-linkoffline", 2) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linkOfflineList.add(new Utils.Pair<>(args.get(0), args.get(1)));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "-nocomment") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noComment = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-nodeprecated") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noDeprecated = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-nosince") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noSince = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-notimestamp") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
noTimestamp = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-noqualifier", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
addToSet(excludedQualifiers, args.get(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "--override-methods", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
String o = args.get(0);
|
||||
switch (o) {
|
||||
case "summary":
|
||||
summarizeOverriddenMethods = true;
|
||||
break;
|
||||
case "detail":
|
||||
summarizeOverriddenMethods = false;
|
||||
break;
|
||||
default:
|
||||
reporter.print(ERROR,
|
||||
resources.getText("doclet.Option_invalid",o, "--override-methods"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "-quiet") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
quiet = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-serialwarn") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
serialWarn = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-sourcetab", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
linkSource = true;
|
||||
try {
|
||||
sourceTabSize = Integer.parseInt(args.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
//Set to -1 so that warning will be printed
|
||||
//to indicate what is valid argument.
|
||||
sourceTabSize = -1;
|
||||
}
|
||||
if (sourceTabSize <= 0) {
|
||||
messages.warning("doclet.sourcetab_warning");
|
||||
sourceTabSize = DocletConstants.DEFAULT_TAB_STOP_LENGTH;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-tag", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(opt);
|
||||
list.add(args.get(0));
|
||||
customTagStrs.add(list);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-taglet", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(opt);
|
||||
list.add(args.get(0));
|
||||
customTagStrs.add(list);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-tagletpath", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
tagletPath = args.get(0);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "-version") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
showVersion = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "--dump-on-error") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
dumpOnError = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Option(resources, "--allow-script-in-comments") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
allowScriptInComments = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "--disable-javafx-strict-checks") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
disableJavaFxStrictChecks = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
new Hidden(resources, "--show-taglets") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
showTaglets = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
return new TreeSet<>(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks for the validity of the options used by the user.
|
||||
* As of this writing, this checks only docencoding.
|
||||
*
|
||||
* @return true if all the options are valid.
|
||||
*/
|
||||
protected boolean generalValidOptions() {
|
||||
if (docEncoding != null) {
|
||||
if (!checkOutputFileEncoding(docEncoding)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (docEncoding == null && (encoding != null && !encoding.isEmpty())) {
|
||||
if (!checkOutputFileEncoding(encoding)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the validity of the given Source or Output File encoding on this
|
||||
* platform.
|
||||
*
|
||||
* @param docencoding output file encoding.
|
||||
*/
|
||||
private boolean checkOutputFileEncoding(String docencoding) {
|
||||
OutputStream ost = new ByteArrayOutputStream();
|
||||
OutputStreamWriter osw = null;
|
||||
try {
|
||||
osw = new OutputStreamWriter(ost, docencoding);
|
||||
} catch (UnsupportedEncodingException exc) {
|
||||
config.reporter.print(ERROR,
|
||||
config.getResources().getText("doclet.Encoding_not_supported", docencoding));
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (osw != null) {
|
||||
osw.close();
|
||||
}
|
||||
} catch (IOException exc) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addToSet(Set<String> s, String str) {
|
||||
StringTokenizer st = new StringTokenizer(str, ":");
|
||||
String current;
|
||||
while (st.hasMoreTokens()) {
|
||||
current = st.nextToken();
|
||||
s.add(current);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a trailing file separator, if not found. Remove superfluous
|
||||
* file separators if any. Preserve the front double file separator for
|
||||
* UNC paths.
|
||||
*
|
||||
* @param path Path under consideration.
|
||||
* @return String Properly constructed path string.
|
||||
*/
|
||||
protected static String addTrailingFileSep(String path) {
|
||||
String fs = System.getProperty("file.separator");
|
||||
String dblfs = fs + fs;
|
||||
int indexDblfs;
|
||||
while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) {
|
||||
path = path.substring(0, indexDblfs) +
|
||||
path.substring(indexDblfs + fs.length());
|
||||
}
|
||||
if (!path.endsWith(fs))
|
||||
path += fs;
|
||||
return path;
|
||||
}
|
||||
|
||||
protected abstract static class Option implements Doclet.Option, Comparable<Option> {
|
||||
private final String[] names;
|
||||
private final String parameters;
|
||||
private final String description;
|
||||
private final int argCount;
|
||||
|
||||
protected Option(Resources resources, String name, int argCount) {
|
||||
this(resources, null, name, argCount);
|
||||
}
|
||||
|
||||
protected Option(Resources resources, String keyBase, String name, int argCount) {
|
||||
this.names = name.trim().split("\\s+");
|
||||
if (keyBase == null) {
|
||||
keyBase = "doclet.usage." + names[0].toLowerCase().replaceAll("^-+", "");
|
||||
}
|
||||
String desc = getOptionsMessage(resources, keyBase + ".description");
|
||||
if (desc.isEmpty()) {
|
||||
this.description = "<MISSING KEY>";
|
||||
this.parameters = "<MISSING KEY>";
|
||||
} else {
|
||||
this.description = desc;
|
||||
this.parameters = getOptionsMessage(resources, keyBase + ".parameters");
|
||||
}
|
||||
this.argCount = argCount;
|
||||
}
|
||||
|
||||
protected Option(Resources resources, String name) {
|
||||
this(resources, name, 0);
|
||||
}
|
||||
|
||||
private String getOptionsMessage(Resources resources, String key) {
|
||||
try {
|
||||
return resources.getText(key);
|
||||
} catch (MissingResourceException ignore) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Kind getKind() {
|
||||
return Kind.STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNames() {
|
||||
return Arrays.asList(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Arrays.toString(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArgumentCount() {
|
||||
return argCount;
|
||||
}
|
||||
|
||||
public boolean matches(String option) {
|
||||
for (String name : names) {
|
||||
boolean matchCase = name.startsWith("--");
|
||||
if (option.startsWith("--") && option.contains("=")) {
|
||||
return name.equals(option.substring(option.indexOf("=") + 1));
|
||||
} else if (matchCase) {
|
||||
return name.equals(option);
|
||||
}
|
||||
return name.toLowerCase().equals(option.toLowerCase());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Option that) {
|
||||
return this.getNames().get(0).compareTo(that.getNames().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract static class XOption extends Option {
|
||||
|
||||
public XOption(Resources resources, String prefix, String name, int argCount) {
|
||||
super(resources, prefix, name, argCount);
|
||||
}
|
||||
|
||||
public XOption(Resources resources, String name, int argCount) {
|
||||
super(resources, name, argCount);
|
||||
}
|
||||
|
||||
public XOption(Resources resources, String name) {
|
||||
this(resources, name, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option.Kind getKind() {
|
||||
return Kind.EXTENDED;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract static class Hidden extends Option {
|
||||
|
||||
public Hidden(Resources resources, String name, int argCount) {
|
||||
super(resources, name, argCount);
|
||||
}
|
||||
|
||||
public Hidden(Resources resources, String name) {
|
||||
this(resources, name, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option.Kind getKind() {
|
||||
return Kind.OTHER;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -132,7 +132,7 @@ public class Messages {
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void notice(String key, Object... args) {
|
||||
if (!configuration.quiet) {
|
||||
if (!configuration.getOptions().quiet) {
|
||||
report(NOTE, resources.getText(key, args));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
@ -31,6 +31,8 @@ import javax.lang.model.type.TypeKind;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.Types;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlOptions;
|
||||
|
||||
/**
|
||||
* This class provides basic JavaFX property related utility methods.
|
||||
* Refer to the JavaFX conventions in the VisibleMemberTable comments.
|
||||
@ -46,13 +48,13 @@ public class PropertyUtils {
|
||||
final Types typeUtils;
|
||||
|
||||
PropertyUtils(BaseConfiguration configuration) {
|
||||
|
||||
javafx = configuration.javafx;
|
||||
BaseOptions options = configuration.getOptions();
|
||||
javafx = options.javafx;
|
||||
|
||||
typeUtils = configuration.docEnv.getTypeUtils();
|
||||
|
||||
// Disable strict check for JDK's without FX.
|
||||
TypeMirror jboType = configuration.disableJavaFxStrictChecks
|
||||
TypeMirror jboType = options.disableJavaFxStrictChecks
|
||||
? null
|
||||
: configuration.utils.getSymbol("javafx.beans.Observable");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -30,6 +30,7 @@ import java.util.*;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
@ -76,6 +77,7 @@ public abstract class AbstractBuilder {
|
||||
* The configuration used in this run of the doclet.
|
||||
*/
|
||||
protected final BaseConfiguration configuration;
|
||||
protected final BaseOptions options;
|
||||
|
||||
protected final BuilderFactory builderFactory;
|
||||
protected final Messages messages;
|
||||
@ -95,6 +97,7 @@ public abstract class AbstractBuilder {
|
||||
*/
|
||||
public AbstractBuilder(Context c) {
|
||||
this.configuration = c.configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.builderFactory = configuration.getBuilderFactory();
|
||||
this.messages = configuration.getMessages();
|
||||
this.resources = configuration.getResources();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
@ -176,12 +176,12 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the member. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildMemberComments(Content annotationDocTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
writer.addComments(currentMember, annotationDocTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
@ -181,12 +181,12 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the member. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildMemberComments(Content annotationDocTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
writer.addComments(currentMember, annotationDocTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ConstructorWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
@ -171,12 +171,12 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the constructor. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param constructorDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildConstructorComments(Content constructorDocTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
writer.addComments(currentConstructor, constructorDocTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter;
|
||||
@ -161,12 +161,12 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the enum constant. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param enumConstantsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildEnumConstantComments(Content enumConstantsTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
writer.addComments(currentElement, enumConstantsTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
|
||||
@ -161,12 +161,12 @@ public class FieldBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the field. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param fieldDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildFieldComments(Content fieldDocTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
writer.addComments(currentElement, fieldDocTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -32,7 +32,7 @@ import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MethodWriter;
|
||||
@ -161,12 +161,12 @@ public class MethodBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the method. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param methodDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildMethodComments(Content methodDocTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
ExecutableElement method = currentMethod;
|
||||
if (utils.getFullBody(currentMethod).isEmpty()) {
|
||||
DocFinder.Output docs = DocFinder.search(configuration,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -180,7 +180,7 @@ public class ModuleSummaryBuilder extends AbstractBuilder {
|
||||
* be added
|
||||
*/
|
||||
protected void buildModuleDescription(Content moduleContentTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
moduleWriter.addModuleDescription(moduleContentTree);
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ public class ModuleSummaryBuilder extends AbstractBuilder {
|
||||
* @param moduleContentTree the tree to which the module tags will be added
|
||||
*/
|
||||
protected void buildModuleTags(Content moduleContentTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
moduleWriter.addModuleTags(moduleContentTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -166,7 +166,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
SortedSet<TypeElement> ilist = utils.isSpecified(packageElement)
|
||||
? utils.getTypeElementsAsSortedSet(utils.getInterfaces(packageElement))
|
||||
: configuration.typeElementCatalog.interfaces(packageElement);
|
||||
SortedSet<TypeElement> interfaces = utils.filterOutPrivateClasses(ilist, configuration.javafx);
|
||||
SortedSet<TypeElement> interfaces = utils.filterOutPrivateClasses(ilist, options.javafx);
|
||||
if (!interfaces.isEmpty()) {
|
||||
packageWriter.addInterfaceSummary(interfaces, summaryContentTree);
|
||||
}
|
||||
@ -182,7 +182,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
SortedSet<TypeElement> clist = utils.isSpecified(packageElement)
|
||||
? utils.getTypeElementsAsSortedSet(utils.getOrdinaryClasses(packageElement))
|
||||
: configuration.typeElementCatalog.ordinaryClasses(packageElement);
|
||||
SortedSet<TypeElement> classes = utils.filterOutPrivateClasses(clist, configuration.javafx);
|
||||
SortedSet<TypeElement> classes = utils.filterOutPrivateClasses(clist, options.javafx);
|
||||
if (!classes.isEmpty()) {
|
||||
packageWriter.addClassSummary(classes, summaryContentTree);
|
||||
}
|
||||
@ -198,7 +198,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
SortedSet<TypeElement> elist = utils.isSpecified(packageElement)
|
||||
? utils.getTypeElementsAsSortedSet(utils.getEnums(packageElement))
|
||||
: configuration.typeElementCatalog.enums(packageElement);
|
||||
SortedSet<TypeElement> enums = utils.filterOutPrivateClasses(elist, configuration.javafx);
|
||||
SortedSet<TypeElement> enums = utils.filterOutPrivateClasses(elist, options.javafx);
|
||||
if (!enums.isEmpty()) {
|
||||
packageWriter.addEnumSummary(enums, summaryContentTree);
|
||||
}
|
||||
@ -214,7 +214,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
SortedSet<TypeElement> rlist = utils.isSpecified(packageElement)
|
||||
? utils.getTypeElementsAsSortedSet(utils.getRecords(packageElement))
|
||||
: configuration.typeElementCatalog.records(packageElement);
|
||||
SortedSet<TypeElement> records = utils.filterOutPrivateClasses(rlist, configuration.javafx);
|
||||
SortedSet<TypeElement> records = utils.filterOutPrivateClasses(rlist, options.javafx);
|
||||
if (!records.isEmpty()) {
|
||||
packageWriter.addRecordSummary(records, summaryContentTree);
|
||||
}
|
||||
@ -232,7 +232,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
? utils.getTypeElementsAsSortedSet(utils.getExceptions(packageElement))
|
||||
: configuration.typeElementCatalog.exceptions(packageElement);
|
||||
SortedSet<TypeElement> exceptions = utils.filterOutPrivateClasses(iexceptions,
|
||||
configuration.javafx);
|
||||
options.javafx);
|
||||
if (!exceptions.isEmpty()) {
|
||||
packageWriter.addExceptionSummary(exceptions, summaryContentTree);
|
||||
}
|
||||
@ -249,7 +249,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
utils.isSpecified(packageElement)
|
||||
? utils.getTypeElementsAsSortedSet(utils.getErrors(packageElement))
|
||||
: configuration.typeElementCatalog.errors(packageElement);
|
||||
SortedSet<TypeElement> errors = utils.filterOutPrivateClasses(ierrors, configuration.javafx);
|
||||
SortedSet<TypeElement> errors = utils.filterOutPrivateClasses(ierrors, options.javafx);
|
||||
if (!errors.isEmpty()) {
|
||||
packageWriter.addErrorSummary(errors, summaryContentTree);
|
||||
}
|
||||
@ -267,7 +267,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
? utils.getTypeElementsAsSortedSet(utils.getAnnotationTypes(packageElement))
|
||||
: configuration.typeElementCatalog.annotationTypes(packageElement);
|
||||
SortedSet<TypeElement> annotationTypes = utils.filterOutPrivateClasses(iannotationTypes,
|
||||
configuration.javafx);
|
||||
options.javafx);
|
||||
if (!annotationTypes.isEmpty()) {
|
||||
packageWriter.addAnnotationTypeSummary(annotationTypes, summaryContentTree);
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
* be added
|
||||
*/
|
||||
protected void buildPackageDescription(Content packageContentTree) {
|
||||
if (configuration.nocomment) {
|
||||
if (options.noComment) {
|
||||
return;
|
||||
}
|
||||
packageWriter.addPackageDescription(packageContentTree);
|
||||
@ -292,7 +292,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
|
||||
* @param packageContentTree the tree to which the package tags will be added
|
||||
*/
|
||||
protected void buildPackageTags(Content packageContentTree) {
|
||||
if (configuration.nocomment) {
|
||||
if (options.noComment) {
|
||||
return;
|
||||
}
|
||||
packageWriter.addPackageTags(packageContentTree);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
|
||||
@ -160,12 +160,12 @@ public class PropertyBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* Build the comments for the property. Do nothing if
|
||||
* {@link BaseConfiguration#nocomment} is set to true.
|
||||
* {@link BaseOptions#noComment} is set to true.
|
||||
*
|
||||
* @param propertyDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildPropertyComments(Content propertyDocTree) {
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
writer.addComments(currentProperty, propertyDocTree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -324,7 +324,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
protected void buildMethodInfo(Content methodsContentTree) throws DocletException {
|
||||
if (configuration.nocomment) {
|
||||
if (options.noComment) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
ExecutableElement method = (ExecutableElement)currentMember;
|
||||
if (method.getSimpleName().toString().compareTo("writeExternal") == 0
|
||||
&& utils.getSerialDataTrees(method).isEmpty()) {
|
||||
if (configuration.serialwarn) {
|
||||
if (options.serialWarn) {
|
||||
TypeElement encl = (TypeElement) method.getEnclosingElement();
|
||||
messages.warning(currentMember,
|
||||
"doclet.MissingSerialDataTag", encl.getQualifiedName().toString(),
|
||||
@ -386,7 +386,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
|
||||
Content fieldsOverviewContentTree = fieldWriter.getFieldsContentHeader(true);
|
||||
fieldWriter.addMemberDeprecatedInfo(ve, fieldsOverviewContentTree);
|
||||
if (!configuration.nocomment) {
|
||||
if (!options.noComment) {
|
||||
fieldWriter.addMemberDescription(ve, fieldsOverviewContentTree);
|
||||
fieldWriter.addMemberTags(ve, fieldsOverviewContentTree);
|
||||
}
|
||||
@ -462,7 +462,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @param serializableFieldsTree content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
|
||||
if (configuration.nocomment) {
|
||||
if (options.noComment) {
|
||||
return;
|
||||
}
|
||||
VariableElement field = (VariableElement)currentMember;
|
||||
@ -509,14 +509,14 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @param fieldsContentTree content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildFieldInfo(Content fieldsContentTree) {
|
||||
if (configuration.nocomment) {
|
||||
if (options.noComment) {
|
||||
return;
|
||||
}
|
||||
VariableElement field = (VariableElement)currentMember;
|
||||
TypeElement te = utils.getEnclosingTypeElement(currentMember);
|
||||
// Process default Serializable field.
|
||||
if ((utils.getSerialTrees(field).isEmpty()) /*&& !field.isSynthetic()*/
|
||||
&& configuration.serialwarn) {
|
||||
&& options.serialWarn) {
|
||||
messages.warning(field,
|
||||
"doclet.MissingSerialTag", utils.getFullyQualifiedName(te),
|
||||
utils.getSimpleName(field));
|
||||
|
@ -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
|
||||
@ -58,6 +58,7 @@ import jdk.javadoc.doclet.Doclet;
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.doclet.Taglet.Location;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
@ -177,33 +178,31 @@ public class TagletManager {
|
||||
*/
|
||||
private final boolean showTaglets;
|
||||
|
||||
private final String tagletPath;
|
||||
|
||||
/**
|
||||
* Construct a new {@code TagletManager}.
|
||||
* @param nosince true if we do not want to use @since tags.
|
||||
* @param showversion true if we want to use @version tags.
|
||||
* @param showauthor true if we want to use @author tags.
|
||||
* @param javafx indicates whether javafx is active.
|
||||
* @param configuration the configuration for this taglet manager
|
||||
*/
|
||||
public TagletManager(boolean nosince, boolean showversion,
|
||||
boolean showauthor, boolean javafx,
|
||||
BaseConfiguration configuration) {
|
||||
public TagletManager(BaseConfiguration configuration) {
|
||||
overriddenStandardTags = new HashSet<>();
|
||||
potentiallyConflictingTags = new HashSet<>();
|
||||
standardTags = new HashSet<>();
|
||||
standardTagsLowercase = new HashSet<>();
|
||||
unseenCustomTags = new HashSet<>();
|
||||
allTaglets = new LinkedHashMap<>();
|
||||
this.nosince = nosince;
|
||||
this.showversion = showversion;
|
||||
this.showauthor = showauthor;
|
||||
this.javafx = javafx;
|
||||
BaseOptions options = configuration.getOptions();
|
||||
this.nosince = options.noSince;
|
||||
this.showversion = options.showVersion;
|
||||
this.showauthor = options.showAuthor;
|
||||
this.javafx = options.javafx;
|
||||
this.docEnv = configuration.docEnv;
|
||||
this.doclet = configuration.doclet;
|
||||
this.messages = configuration.getMessages();
|
||||
this.resources = configuration.getResources();
|
||||
this.showTaglets = configuration.showTaglets;
|
||||
this.showTaglets = options.showTaglets;
|
||||
this.utils = configuration.utils;
|
||||
this.tagletPath = options.tagletPath;
|
||||
initStandardTaglets();
|
||||
}
|
||||
|
||||
@ -230,10 +229,9 @@ public class TagletManager {
|
||||
/**
|
||||
* Initializes the location TAGLET_PATH which is used to locate the custom taglets.
|
||||
* @param fileManager the file manager to load classes and resources.
|
||||
* @param tagletPath the path to the custom taglet.
|
||||
* @throws IOException if an error occurs while setting the location.
|
||||
*/
|
||||
public void initTagletPath(JavaFileManager fileManager, String tagletPath) throws IOException {
|
||||
public void initTagletPath(JavaFileManager fileManager) throws IOException {
|
||||
if (fileManager instanceof StandardJavaFileManager) {
|
||||
StandardJavaFileManager sfm = (StandardJavaFileManager)fileManager;
|
||||
if (tagletPath != null) {
|
||||
|
@ -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
|
||||
@ -166,7 +166,7 @@ public class ClassTree {
|
||||
// In the tree page (e.g overview-tree.html) do not include
|
||||
// information of classes which are deprecated or are a part of a
|
||||
// deprecated package.
|
||||
if (configuration.nodeprecated &&
|
||||
if (configuration.getOptions().noDeprecated &&
|
||||
(utils.isDeprecated(aClass) ||
|
||||
utils.isDeprecated(utils.containingPackage(aClass)))) {
|
||||
continue;
|
||||
|
@ -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
|
||||
@ -32,6 +32,7 @@ import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
|
||||
|
||||
/**
|
||||
@ -45,6 +46,7 @@ import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
public class ElementListWriter {
|
||||
|
||||
private final BaseConfiguration configuration;
|
||||
private final BaseOptions options;
|
||||
private final Utils utils;
|
||||
private final DocFile file;
|
||||
|
||||
@ -56,6 +58,7 @@ public class ElementListWriter {
|
||||
public ElementListWriter(BaseConfiguration configuration) {
|
||||
file = DocFile.createFileForOutput(configuration, DocPaths.ELEMENT_LIST);
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.utils = configuration.utils;
|
||||
}
|
||||
|
||||
@ -74,7 +77,7 @@ public class ElementListWriter {
|
||||
try (BufferedWriter out = new BufferedWriter(file.openWriter())) {
|
||||
if (configuration.showModules) {
|
||||
for (ModuleElement mdle : configuration.modulePackages.keySet()) {
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(mdle))) {
|
||||
if (!(options.noDeprecated && utils.isDeprecated(mdle))) {
|
||||
out.write(DocletConstants.MODULE_PREFIX + mdle.toString());
|
||||
out.newLine();
|
||||
for (PackageElement pkg : configuration.modulePackages.get(mdle)) {
|
||||
@ -87,7 +90,7 @@ public class ElementListWriter {
|
||||
for (PackageElement pkg : configuration.packages) {
|
||||
// if the -nodeprecated option is set and the package is marked as
|
||||
// deprecated, do not include it in the packages list.
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
|
||||
if (!(options.noDeprecated && utils.isDeprecated(pkg))) {
|
||||
out.write(pkg.toString());
|
||||
out.newLine();
|
||||
}
|
||||
|
@ -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
|
||||
@ -111,7 +111,7 @@ public class IndexBuilder {
|
||||
|
||||
this.noDeprecated = noDeprecated;
|
||||
this.classesOnly = classesOnly;
|
||||
this.javafx = configuration.javafx;
|
||||
this.javafx = configuration.getOptions().javafx;
|
||||
this.indexmap = new TreeMap<>();
|
||||
comparator = classesOnly
|
||||
? utils.makeAllClassesComparator()
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -33,6 +33,8 @@ import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
|
||||
/**
|
||||
* Provides methods for creating an array of class, method and
|
||||
@ -47,16 +49,17 @@ import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
*/
|
||||
public class MetaKeywords {
|
||||
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
*/
|
||||
private final BaseConfiguration config;
|
||||
private final BaseOptions options;
|
||||
private final Resources resources;
|
||||
private final Utils utils;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public MetaKeywords(BaseConfiguration configuration) {
|
||||
config = configuration;
|
||||
options = configuration.getOptions();
|
||||
resources = configuration.getResources();
|
||||
utils = configuration.utils;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,10 +78,10 @@ public class MetaKeywords {
|
||||
ArrayList<String> results = new ArrayList<>();
|
||||
|
||||
// Add field and method keywords only if -keywords option is used
|
||||
if (config.keywords) {
|
||||
if (options.keywords) {
|
||||
results.addAll(getClassKeyword(typeElement));
|
||||
results.addAll(getMemberKeywords(config.utils.getFields(typeElement)));
|
||||
results.addAll(getMemberKeywords(config.utils.getMethods(typeElement)));
|
||||
results.addAll(getMemberKeywords(utils.getFields(typeElement)));
|
||||
results.addAll(getMemberKeywords(utils.getMethods(typeElement)));
|
||||
}
|
||||
((ArrayList)results).trimToSize();
|
||||
return results;
|
||||
@ -90,8 +93,8 @@ public class MetaKeywords {
|
||||
*/
|
||||
protected List<String> getClassKeyword(TypeElement typeElement) {
|
||||
ArrayList<String> metakeywords = new ArrayList<>(1);
|
||||
String cltypelower = config.utils.isInterface(typeElement) ? "interface" : "class";
|
||||
metakeywords.add(config.utils.getFullyQualifiedName(typeElement) + " " + cltypelower);
|
||||
String cltypelower = utils.isInterface(typeElement) ? "interface" : "class";
|
||||
metakeywords.add(utils.getFullyQualifiedName(typeElement) + " " + cltypelower);
|
||||
return metakeywords;
|
||||
}
|
||||
|
||||
@ -100,8 +103,8 @@ public class MetaKeywords {
|
||||
*/
|
||||
public List<String> getMetaKeywords(PackageElement packageElement) {
|
||||
List<String> result = new ArrayList<>(1);
|
||||
if (config.keywords) {
|
||||
String pkgName = config.utils.getPackageName(packageElement);
|
||||
if (options.keywords) {
|
||||
String pkgName = utils.getPackageName(packageElement);
|
||||
result.add(pkgName + " " + "package");
|
||||
}
|
||||
return result;
|
||||
@ -113,7 +116,7 @@ public class MetaKeywords {
|
||||
* @param mdle the module being documented
|
||||
*/
|
||||
public List<String> getMetaKeywordsForModule(ModuleElement mdle) {
|
||||
if (config.keywords) {
|
||||
if (options.keywords) {
|
||||
return Arrays.asList(mdle.getQualifiedName() + " " + "module");
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
@ -125,8 +128,8 @@ public class MetaKeywords {
|
||||
*/
|
||||
public List<String> getOverviewMetaKeywords(String title, String docTitle) {
|
||||
List<String> result = new ArrayList<>(1);
|
||||
if (config.keywords) {
|
||||
String windowOverview = config.getResources().getText(title);
|
||||
if (options.keywords) {
|
||||
String windowOverview = resources.getText(title);
|
||||
if (docTitle.length() > 0) {
|
||||
result.add(windowOverview + ", " + docTitle);
|
||||
} else {
|
||||
@ -148,9 +151,9 @@ public class MetaKeywords {
|
||||
protected List<String> getMemberKeywords(List<? extends Element> members) {
|
||||
ArrayList<String> results = new ArrayList<>();
|
||||
for (Element member : members) {
|
||||
String membername = config.utils.isMethod(member)
|
||||
? config.utils.getSimpleName(member) + "()"
|
||||
: config.utils.getSimpleName(member);
|
||||
String membername = utils.isMethod(member)
|
||||
? utils.getSimpleName(member) + "()"
|
||||
: utils.getSimpleName(member);
|
||||
if (!results.contains(membername)) {
|
||||
results.add(membername);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2017, 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
|
||||
@ -207,7 +207,8 @@ class StandardDocFileFactory extends DocFileFactory {
|
||||
|
||||
try {
|
||||
OutputStream out = getFileObjectForOutput(path).openOutputStream();
|
||||
return new BufferedWriter(new OutputStreamWriter(out, configuration.docencoding));
|
||||
String docencoding = configuration.getOptions().docEncoding;
|
||||
return new BufferedWriter(new OutputStreamWriter(out, docencoding));
|
||||
} catch (IOException e) {
|
||||
throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
|
||||
}
|
||||
@ -328,7 +329,7 @@ class StandardDocFileFactory extends DocFileFactory {
|
||||
/**
|
||||
* Resolve a relative file against the given output location.
|
||||
* @param locn Currently, only
|
||||
* {@link DocumentationTool.Location.DOCUMENTATION_OUTPUT} is supported.
|
||||
* {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} is supported.
|
||||
*/
|
||||
@Override
|
||||
public DocFile resolveAgainst(Location locn) {
|
||||
|
@ -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
|
||||
@ -162,7 +162,7 @@ public class TypeElementCatalog {
|
||||
private void addTypeElement(TypeElement typeElement, Map<PackageElement, SortedSet<TypeElement>> map) {
|
||||
|
||||
PackageElement pkg = utils.containingPackage(typeElement);
|
||||
if (utils.isSpecified(pkg) || configuration.nodeprecated && utils.isDeprecated(pkg)) {
|
||||
if (utils.isSpecified(pkg) || configuration.getOptions().noDeprecated && utils.isDeprecated(pkg)) {
|
||||
// No need to catalog this class if it's package is
|
||||
// specified on the command line or if -nodeprecated option is set
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -87,6 +87,7 @@ import com.sun.source.util.TreePath;
|
||||
import com.sun.tools.javac.model.JavacTypes;
|
||||
import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
@ -112,15 +113,17 @@ import static jdk.javadoc.internal.doclets.toolkit.builders.ConstantsSummaryBuil
|
||||
*/
|
||||
public class Utils {
|
||||
public final BaseConfiguration configuration;
|
||||
public final Messages messages;
|
||||
public final Resources resources;
|
||||
private final BaseOptions options;
|
||||
private final Messages messages;
|
||||
private final Resources resources;
|
||||
public final DocTrees docTrees;
|
||||
public final Elements elementUtils;
|
||||
public final Types typeUtils;
|
||||
public final JavaScriptScanner javaScriptScanner;
|
||||
private final JavaScriptScanner javaScriptScanner;
|
||||
|
||||
public Utils(BaseConfiguration c) {
|
||||
configuration = c;
|
||||
options = configuration.getOptions();
|
||||
messages = configuration.getMessages();
|
||||
resources = configuration.getResources();
|
||||
elementUtils = c.docEnv.getElementUtils();
|
||||
@ -390,7 +393,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public boolean isProperty(String name) {
|
||||
return configuration.javafx && name.endsWith("Property");
|
||||
return options.javafx && name.endsWith("Property");
|
||||
}
|
||||
|
||||
public String getPropertyName(String name) {
|
||||
@ -1387,8 +1390,8 @@ public class Utils {
|
||||
if (!text.contains("\t"))
|
||||
return text;
|
||||
|
||||
final int tabLength = configuration.sourcetab;
|
||||
final String whitespace = configuration.tabSpaces;
|
||||
final int tabLength = options.sourceTabSize;
|
||||
final String whitespace = " ".repeat(tabLength);
|
||||
final int textLength = text.length();
|
||||
StringBuilder result = new StringBuilder(textLength);
|
||||
int pos = 0;
|
||||
@ -1520,7 +1523,7 @@ public class Utils {
|
||||
if (!isIncluded(e)) {
|
||||
return false;
|
||||
}
|
||||
if (configuration.javafx &&
|
||||
if (options.javafx &&
|
||||
hasBlockTag(e, DocTree.Kind.UNKNOWN_BLOCK_TAG, "treatAsPrivate")) {
|
||||
return true;
|
||||
}
|
||||
@ -1533,7 +1536,7 @@ public class Utils {
|
||||
* @return true if there are no comments, false otherwise
|
||||
*/
|
||||
public boolean isSimpleOverride(ExecutableElement m) {
|
||||
if (!configuration.summarizeOverriddenMethods ||
|
||||
if (!options.summarizeOverriddenMethods ||
|
||||
!isIncluded(m)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
@ -48,6 +48,7 @@ import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.PropertyUtils;
|
||||
|
||||
/**
|
||||
@ -106,6 +107,7 @@ public class VisibleMemberTable {
|
||||
final TypeElement parent;
|
||||
|
||||
final BaseConfiguration config;
|
||||
final BaseOptions options;
|
||||
final Utils utils;
|
||||
final VisibleMemberCache mcache;
|
||||
|
||||
@ -126,6 +128,7 @@ public class VisibleMemberTable {
|
||||
VisibleMemberCache mcache) {
|
||||
config = configuration;
|
||||
utils = configuration.utils;
|
||||
options = configuration.getOptions();
|
||||
te = typeElement;
|
||||
parent = utils.getSuperClass(te);
|
||||
this.mcache = mcache;
|
||||
@ -658,7 +661,7 @@ public class VisibleMemberTable {
|
||||
|
||||
List<? extends Element> elements = te.getEnclosedElements();
|
||||
for (Element e : elements) {
|
||||
if (config.nodeprecated && utils.isDeprecated(e)) {
|
||||
if (options.noDeprecated && utils.isDeprecated(e)) {
|
||||
continue;
|
||||
}
|
||||
switch (e.getKind()) {
|
||||
@ -800,7 +803,7 @@ public class VisibleMemberTable {
|
||||
* {@code boolean isFoo()}
|
||||
*/
|
||||
private void computeVisibleProperties(LocalMemberTable lmt) {
|
||||
if (!config.javafx)
|
||||
if (!options.javafx)
|
||||
return;
|
||||
|
||||
PropertyUtils pUtils = config.propertyUtils;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 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
|
||||
@ -91,7 +91,7 @@ main.opt.expand.requires.desc=\
|
||||
all dependencies of those modules.
|
||||
|
||||
main.opt.help.desc=\
|
||||
Display command line options and exit
|
||||
Display command-line options and exit
|
||||
|
||||
main.opt.module.arg=\
|
||||
<module>(,<module>)*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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,15 +25,16 @@
|
||||
* @test
|
||||
* @bug 4696488
|
||||
* @summary javadoc doesn't handle UNC paths for destination directory
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.doclets.toolkit
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.doclets.toolkit:+open
|
||||
* @run main T4696488 T4696488.java
|
||||
*/
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import java.lang.reflect.Method;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
|
||||
public class T4696488 {
|
||||
|
||||
public static void main(String... args) {
|
||||
public static void main(String... args) throws Exception {
|
||||
System.setProperty("file.separator", "/");
|
||||
assertAddTrailingFileSep("/path/to/dir", "/path/to/dir/");
|
||||
assertAddTrailingFileSep("/path/to/dir/", "/path/to/dir/");
|
||||
@ -47,8 +48,11 @@ public class T4696488 {
|
||||
assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir\\\\", "\\\\server\\share\\path\\to\\dir\\");
|
||||
}
|
||||
|
||||
private static void assertAddTrailingFileSep(String input, String expectedOutput) {
|
||||
String output = BaseConfiguration.addTrailingFileSep(input);
|
||||
private static void assertAddTrailingFileSep(String input, String expectedOutput) throws Exception {
|
||||
//String output = BaseOptions.addTrailingFileSep(input);
|
||||
Method m = BaseOptions.class.getDeclaredMethod("addTrailingFileSep", String.class);
|
||||
m.setAccessible(true);
|
||||
String output = (String) m.invoke(null, input);
|
||||
if (!expectedOutput.equals(output)) {
|
||||
throw new Error("expected " + expectedOutput + " but was " + output);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user