Skip to content
Permalink
Browse files

8237492: Reorganize impl of doclet options

8237726: Fix signature of StandardDoclet.getSupportedOptions

Reviewed-by: prappo, hannesw, ksrini
  • Loading branch information
jonathan-gibbons committed Jan 23, 2020
1 parent c6c828f commit 9e4830fc30106ae768ae587fa38d77af0ef9fe43
Showing with 1,609 additions and 1,326 deletions.
  1. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Doclet.java
  2. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java
  3. +5 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
  4. +5 −4 ....javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java
  5. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java
  6. +4 −4 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
  7. +7 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
  8. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
  9. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
  10. +4 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java
  11. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java
  12. +7 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
  13. +26 −429 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
  14. +23 −21 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
  15. +21 −18 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
  16. +519 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlOptions.java
  17. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java
  18. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java
  19. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
  20. +2 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
  21. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
  22. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java
  23. +2 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
  24. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java
  25. +11 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
  26. +6 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java
  27. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java
  28. +30 −28 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java
  29. +6 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java
  30. +22 −622 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java
  31. +734 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java
  32. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java
  33. +6 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PropertyUtils.java
  34. +4 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java
  35. +4 −4 ...vadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java
  36. +4 −4 ...re/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
  37. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java
  38. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java
  39. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java
  40. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java
  41. +3 −3 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
  42. +10 −10 ...dk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
  43. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java
  44. +7 −7 ...dk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
  45. +13 −15 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java
  46. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
  47. +6 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ElementListWriter.java
  48. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java
  49. +22 −19 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MetaKeywords.java
  50. +4 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java
  51. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TypeElementCatalog.java
  52. +12 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
  53. +6 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java
  54. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties
  55. +10 −6 test/langtools/jdk/javadoc/tool/T4696488.java
@@ -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 @@
* 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 String getName() {
}

@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,21 +73,19 @@
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;
protected final Resources resources;
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 @@ protected void addUseInfo(List<? extends Element> mems, Content heading, Content
}

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 @@ Content toContent() {
// 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 @@ protected void buildOverviewIndexFile(String title, String description)
.setFooter(footer)
.toContent());
printHtmlDocument(
configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
configuration.metakeywords.getOverviewMetaKeywords(title, configuration.getOptions().docTitle),
description, body);
}

@@ -158,8 +158,9 @@ protected void buildOverviewIndexFile(String title, String description)
* @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 @@ protected void addPackages(Content content) {
.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 void addAnnotationTypeSignature(String modifiers, Content annotationInfoT
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 void addAnnotationTypeSignature(String modifiers, Content annotationInfoT
*/
@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 void addAnnotationTypeDescription(Content annotationInfoTree) {
*/
@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.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 ClassUseWriter(HtmlConfiguration configuration,
*/
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 void addClassSignature(String modifiers, Content classInfoTree) {
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 @@ private Content getRecordComponents(TypeElement typeElem) {
*/
@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 void addClassDescription(Content classInfoTree) {
*/
@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 DeprecatedListWriter(HtmlConfiguration configuration, DocPath filename) {

/**
* 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 final Location location;
public final DocPath source;
public final HtmlConfiguration configuration;
private final HtmlOptions options;
private Navigation navBar;

/**
@@ -75,6 +76,7 @@
*/
public DocFilesHandlerImpl(HtmlConfiguration configuration, Element element) {
this.configuration = configuration;
this.options = configuration.getOptions();
this.element = element;

switch (element.getKind()) {
@@ -160,7 +162,7 @@ private void copyDirectory(DocFile srcdir, final DocPath dstDocPath,
}
}
} 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 void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedT
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 @@ protected void addHelpFileContents(Content contentTree) {
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 @@ protected void addHelpFileContents(Content contentTree) {
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 @@ protected void addHelpFileContents(Content contentTree) {
}

// 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 @@ protected void addHelpFileContents(Content contentTree) {
}

// 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 @@ protected void addHelpFileContents(Content contentTree) {
}

// 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 {

0 comments on commit 9e4830f

Please sign in to comment.