# HG changeset patch # User bpatel # Date 1481660758 28800 # Node ID 3638773ff1b05609df253a8ffc1549c08b405549 # Parent 050370edaade4488f86622704004e2820474b3ac 8162674: change javadoc output text and style emitted by for-removal deprecations Reviewed-by: jjg diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Tue Dec 13 12:25:58 2016 -0800 @@ -360,7 +360,7 @@ */ protected void addComment(Element element, Content contentTree) { List tags; - Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element)); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.block); if (utils.isDeprecated(element)) { diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Tue Dec 13 12:25:58 2016 -0800 @@ -405,46 +405,6 @@ } /** - * Add deprecated information to the documentation tree - * - * @param deprmembers list of deprecated members - * @param headingKey the caption for the deprecated members table - * @param tableSummary the summary for the deprecated members table - * @param tableHeader table headers for the deprecated members table - * @param contentTree the content tree to which the deprecated members table will be added - */ - protected void addDeprecatedAPI(Collection deprmembers, String headingKey, - String tableSummary, List tableHeader, Content contentTree) { - if (deprmembers.size() > 0) { - Content caption = writer.getTableCaption(configuration.getContent(headingKey)); - Content table = (configuration.isOutputHtml5()) - ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption) - : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption); - table.addContent(writer.getSummaryTableHeader(tableHeader, "col")); - Content tbody = new HtmlTree(HtmlTag.TBODY); - boolean altColor = true; - for (Element member : deprmembers) { - HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getDeprecatedLink(member)); - HtmlTree tr = HtmlTree.TR(thRow); - HtmlTree td = new HtmlTree(HtmlTag.TD); - td.addStyle(HtmlStyle.colLast); - List deprTrees = utils.getBlockTags(member, DocTree.Kind.DEPRECATED); - if (!deprTrees.isEmpty()) { - writer.addInlineDeprecatedComment(member, deprTrees.get(0), td); - } - tr.addContent(td); - tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); - altColor = !altColor; - tbody.addContent(tr); - } - table.addContent(tbody); - Content li = HtmlTree.LI(HtmlStyle.blockList, table); - Content ul = HtmlTree.UL(HtmlStyle.blockList, li); - contentTree.addContent(ul); - } - } - - /** * Add use information to the documentation tree. * * @param mems list of program elements for which the use information will be added diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Dec 13 12:25:58 2016 -0800 @@ -317,7 +317,7 @@ List deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED); if (utils.isDeprecated(annotationType)) { CommentHelper ch = utils.getCommentHelper(annotationType); - Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(annotationType)); Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); if (!deprs.isEmpty()) { diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Dec 13 12:25:58 2016 -0800 @@ -610,7 +610,7 @@ classInfoTree.addContent(hr); List deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED); if (utils.isDeprecated(typeElement)) { - Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement)); Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); if (!deprs.isEmpty()) { CommentHelper ch = utils.getCommentHelper(typeElement); diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Tue Dec 13 12:25:58 2016 -0800 @@ -73,6 +73,7 @@ public final Content deprecatedAPI; public final Content deprecatedLabel; public final Content deprecatedPhrase; + public final Content deprecatedForRemovalPhrase; public final Content descfrmClassLabel; public final Content descfrmInterfaceLabel; public final Content descriptionLabel; @@ -186,6 +187,7 @@ deprecatedAPI = getContent("doclet.Deprecated_API"); deprecatedLabel = getContent("doclet.navDeprecated"); deprecatedPhrase = getContent("doclet.Deprecated"); + deprecatedForRemovalPhrase = getContent("doclet.DeprecatedForRemoval"); descfrmClassLabel = getContent("doclet.Description_From_Class"); descfrmInterfaceLabel = getContent("doclet.Description_From_Interface"); descriptionLabel = getContent("doclet.Description"); diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Tue Dec 13 12:25:58 2016 -0800 @@ -64,6 +64,8 @@ private String getAnchorName(DeprElementKind kind) { switch (kind) { + case REMOVAL: + return "forRemoval"; case MODULE: return "module"; case PACKAGE: @@ -97,6 +99,8 @@ private String getHeadingKey(DeprElementKind kind) { switch (kind) { + case REMOVAL: + return "doclet.Deprecated_For_Removal"; case MODULE: return "doclet.Deprecated_Modules"; case PACKAGE: @@ -130,6 +134,8 @@ private String getSummaryKey(DeprElementKind kind) { switch (kind) { + case REMOVAL: + return "doclet.deprecated_for_removal"; case MODULE: return "doclet.deprecated_modules"; case PACKAGE: @@ -163,6 +169,8 @@ private String getHeaderKey(DeprElementKind kind) { switch (kind) { + case REMOVAL: + return "doclet.Element"; case MODULE: return "doclet.Module"; case PACKAGE: @@ -212,6 +220,7 @@ writerMap = new EnumMap<>(DeprElementKind.class); for (DeprElementKind kind : DeprElementKind.values()) { switch (kind) { + case REMOVAL: case MODULE: case PACKAGE: case INTERFACE: @@ -284,16 +293,8 @@ List memberTableHeader = new ArrayList<>(); memberTableHeader.add(resources.getText(getHeaderKey(kind))); memberTableHeader.add(resources.getText("doclet.Description")); - if (kind == DeprElementKind.MODULE) { - addModuleDeprecatedAPI(deprapi.getSet(kind), + addDeprecatedAPI(deprapi.getSet(kind), getHeadingKey(kind), memberTableSummary, memberTableHeader, div); - } else if (kind == DeprElementKind.PACKAGE) { - addPackageDeprecatedAPI(deprapi.getSet(kind), - getHeadingKey(kind), memberTableSummary, memberTableHeader, div); - } else { - writerMap.get(kind).addDeprecatedAPI(deprapi.getSet(kind), - getHeadingKey(kind), memberTableSummary, memberTableHeader, div); - } } } if (configuration.allowTag(HtmlTag.MAIN)) { @@ -395,17 +396,17 @@ } /** - * Add module deprecation information to the documentation tree + * Add deprecated information to the documentation tree * - * @param deprMdles list of deprecated modules - * @param headingKey the caption for the deprecated module table - * @param tableSummary the summary for the deprecated module table - * @param tableHeader table headers for the deprecated module table - * @param contentTree the content tree to which the deprecated module table will be added + * @param deprList list of deprecated API elements + * @param headingKey the caption for the deprecated table + * @param tableSummary the summary for the deprecated table + * @param tableHeader table headers for the deprecated table + * @param contentTree the content tree to which the deprecated table will be added */ - protected void addModuleDeprecatedAPI(SortedSet deprMdles, String headingKey, + protected void addDeprecatedAPI(SortedSet deprList, String headingKey, String tableSummary, List tableHeader, Content contentTree) { - if (deprMdles.size() > 0) { + if (deprList.size() > 0) { Content caption = getTableCaption(configuration.getContent(headingKey)); Content table = (configuration.isOutputHtml5()) ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption) @@ -413,16 +414,28 @@ table.addContent(getSummaryTableHeader(tableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); boolean altColor = true; - for (Element e : deprMdles) { - ModuleElement mdle = (ModuleElement) e; - HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, - getModuleLink(mdle, new StringContent(mdle.getQualifiedName()))); + for (Element e : deprList) { + HtmlTree thRow; + switch (e.getKind()) { + case MODULE: + ModuleElement m = (ModuleElement)e; + thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, + getModuleLink(m, new StringContent(m.getQualifiedName()))); + break; + case PACKAGE: + PackageElement pkg = (PackageElement)e; + thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, + getPackageLink(pkg, getPackageName(pkg))); + break; + default: + thRow = getDeprecatedLink(e); + } HtmlTree tr = HtmlTree.TR(thRow); HtmlTree tdDesc = new HtmlTree(HtmlTag.TD); tdDesc.addStyle(HtmlStyle.colLast); - List tags = utils.getDeprecatedTrees(mdle); + List tags = utils.getDeprecatedTrees(e); if (!tags.isEmpty()) { - addInlineDeprecatedComment(mdle, tags.get(0), tdDesc); + addInlineDeprecatedComment(e, tags.get(0), tdDesc); } tr.addContent(tdDesc); tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); @@ -436,45 +449,30 @@ } } - /** - * Add package deprecation information to the documentation tree - * - * @param deprPkgs list of deprecated packages - * @param headingKey the caption for the deprecated package table - * @param tableSummary the summary for the deprecated package table - * @param tableHeader table headers for the deprecated package table - * @param contentTree the content tree to which the deprecated package table will be added - */ - protected void addPackageDeprecatedAPI(SortedSet deprPkgs, String headingKey, - String tableSummary, List tableHeader, Content contentTree) { - if (deprPkgs.size() > 0) { - Content caption = getTableCaption(configuration.getContent(headingKey)); - Content table = (configuration.isOutputHtml5()) - ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption) - : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption); - table.addContent(getSummaryTableHeader(tableHeader, "col")); - Content tbody = new HtmlTree(HtmlTag.TBODY); - boolean altColor = true; - for (Element e : deprPkgs) { - PackageElement pkg = (PackageElement) e; - HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, - getPackageLink(pkg, getPackageName(pkg))); - HtmlTree tr = HtmlTree.TR(thRow); - HtmlTree tdDesc = new HtmlTree(HtmlTag.TD); - tdDesc.addStyle(HtmlStyle.colLast); - List tags = utils.getDeprecatedTrees(pkg); - if (!tags.isEmpty()) { - addInlineDeprecatedComment(pkg, tags.get(0), tdDesc); - } - tr.addContent(tdDesc); - tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); - altColor = !altColor; - tbody.addContent(tr); - } - table.addContent(tbody); - Content li = HtmlTree.LI(HtmlStyle.blockList, table); - Content ul = HtmlTree.UL(HtmlStyle.blockList, li); - contentTree.addContent(ul); + protected HtmlTree getDeprecatedLink(Element e) { + AbstractMemberWriter writer; + switch (e.getKind()) { + case INTERFACE: + case CLASS: + case ENUM: + case ANNOTATION_TYPE: + writer = new NestedClassWriterImpl(this); + break; + case FIELD: + writer = new FieldWriterImpl(this); + break; + case METHOD: + writer = new MethodWriterImpl(this); + break; + case CONSTRUCTOR: + writer = new ConstructorWriterImpl(this); + break; + case ENUM_CONSTANT: + writer = new EnumConstantWriterImpl(this); + break; + default: + writer = new AnnotationTypeOptionalMemberWriterImpl(this, null); } + return HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, writer.getDeprecatedLink(e)); } } diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Dec 13 12:25:58 2016 -0800 @@ -412,7 +412,7 @@ HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD); tdClassDescription.addStyle(HtmlStyle.colLast); if (utils.isDeprecated(te)) { - tdClassDescription.addContent(contents.deprecatedLabel); + tdClassDescription.addContent(getDeprecatedPhrase(te)); List tags = utils.getDeprecatedTrees(te); if (!tags.isEmpty()) { addSummaryDeprecatedComment(te, tags.get(0), tdClassDescription); @@ -1617,6 +1617,18 @@ } /** + * Get the deprecated phrase as content. + * + * @param e the Element for which the inline deprecated comment will be added + * @return a content tree for the deprecated phrase. + */ + public Content getDeprecatedPhrase(Element e) { + return (utils.isDeprecatedForRemoval(e)) + ? contents.deprecatedForRemovalPhrase + : contents.deprecatedPhrase; + } + + /** * Add the inline deprecated comment. * * @param e the Element for which the inline deprecated comment will be added diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Dec 13 12:25:58 2016 -0800 @@ -506,7 +506,7 @@ CommentHelper ch = utils.getCommentHelper(mdle); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); - Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle)); deprDiv.addContent(deprPhrase); if (!deprs.isEmpty()) { List commentTags = ch.getDescription(configuration, deprs.get(0)); @@ -648,7 +648,7 @@ deprs = utils.getDeprecatedTrees(pkg); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); - Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg)); deprDiv.addContent(deprPhrase); if (!deprs.isEmpty()) { CommentHelper ch = utils.getCommentHelper(pkg); diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Dec 13 12:25:58 2016 -0800 @@ -172,7 +172,7 @@ CommentHelper ch = utils.getCommentHelper(packageElement); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); - Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement)); deprDiv.addContent(deprPhrase); if (!deprs.isEmpty()) { List commentTags = ch.getDescription(configuration, deprs.get(0)); @@ -223,7 +223,7 @@ HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD); tdClassDescription.addStyle(HtmlStyle.colLast); if (utils.isDeprecated(klass)) { - tdClassDescription.addContent(contents.deprecatedLabel); + tdClassDescription.addContent(getDeprecatedPhrase(klass)); List tags = utils.getDeprecatedTrees(klass); if (!tags.isEmpty()) { addSummaryDeprecatedComment(klass, tags.get(0), tdClassDescription); diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java Tue Dec 13 12:25:58 2016 -0800 @@ -187,7 +187,7 @@ List deprs = utils.getBlockTags(member, DocTree.Kind.DEPRECATED); Content div; if (utils.isDeprecated(member)) { - Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(member)); div = HtmlTree.DIV(HtmlStyle.block, deprLabel); div.addContent(Contents.SPACE); if (!deprs.isEmpty()) { @@ -198,7 +198,7 @@ } else { Element te = member.getEnclosingElement(); if (te != null && utils.isTypeElement(te) && utils.isDeprecated(te)) { - Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(te)); div = HtmlTree.DIV(HtmlStyle.block, deprLabel); div.addContent(Contents.SPACE); tdSummary.addContent(div); diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Tue Dec 13 12:25:58 2016 -0800 @@ -178,7 +178,7 @@ if (utils.isTypeElement(element)) { if (utils.isDeprecated(element)) { result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel, - new StringContent(configuration.getText("doclet.Deprecated")))); + htmlWriter.getDeprecatedPhrase(element))); result.addContent(RawHtml.nbsp); if (!deprs.isEmpty()) { List commentTags = ch.getDescription(configuration, deprs.get(0)); @@ -190,7 +190,7 @@ } else { if (utils.isDeprecated(element)) { result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel, - new StringContent(configuration.getText("doclet.Deprecated")))); + htmlWriter.getDeprecatedPhrase(element))); result.addContent(RawHtml.nbsp); if (!deprs.isEmpty()) { List bodyTags = ch.getBody(configuration, deprs.get(0)); @@ -199,9 +199,10 @@ result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body)); } } else { - if (utils.isDeprecated(utils.getEnclosingTypeElement(element))) { + Element ee = utils.getEnclosingTypeElement(element); + if (utils.isDeprecated(ee)) { result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel, - new StringContent(configuration.getText("doclet.Deprecated")))); + htmlWriter.getDeprecatedPhrase(ee))); result.addContent(RawHtml.nbsp); } } diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Tue Dec 13 12:25:58 2016 -0800 @@ -3,6 +3,7 @@ doclet.Overview=Overview doclet.Window_Overview=Overview List doclet.Window_Overview_Summary=Overview +doclet.Element=Element doclet.Package=Package doclet.Module=Module doclet.All_Packages=All Packages @@ -71,6 +72,7 @@ doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1} doclet.tag.invalid_usage=invalid usage of tag {0} doclet.Deprecated_API=Deprecated API +doclet.Deprecated_For_Removal=Deprecated For Removal doclet.Deprecated_Modules=Deprecated Modules doclet.Deprecated_Packages=Deprecated Packages doclet.Deprecated_Classes=Deprecated Classes @@ -84,6 +86,7 @@ doclet.Deprecated_Methods=Deprecated Methods doclet.Deprecated_Enum_Constants=Deprecated Enum Constants doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements +doclet.deprecated_for_removal=deprecated for removal doclet.deprecated_modules=deprecated modules doclet.deprecated_packages=deprecated packages doclet.deprecated_classes=deprecated classes diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Tue Dec 13 12:25:58 2016 -0800 @@ -150,6 +150,7 @@ doclet.Method_Detail=Method Detail doclet.Constructor_Detail=Constructor Detail doclet.Deprecated=Deprecated. +doclet.DeprecatedForRemoval=Deprecated, for removal: This API element is subject to removal in a future version. doclet.Hidden=Hidden doclet.Groupname_already_used=In -group option, groupname already used: {0} doclet.value_tag_invalid_reference={0} (referenced by @value tag) is an unknown reference. diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java Tue Dec 13 12:25:58 2016 -0800 @@ -52,6 +52,7 @@ private final Configuration configuration; private final Utils utils; public static enum DeprElementKind { + REMOVAL, MODULE, PACKAGE, INTERFACE, @@ -90,9 +91,13 @@ * @param configuration the current configuration of the doclet. */ private void buildDeprecatedAPIInfo() { + SortedSet rset = deprecatedMap.get(DeprElementKind.REMOVAL); SortedSet modules = configuration.modules; SortedSet mset = deprecatedMap.get(DeprElementKind.MODULE); for (Element me : modules) { + if (utils.isDeprecatedForRemoval(me)) { + rset.add(me); + } if (utils.isDeprecated(me)) { mset.add(me); } @@ -100,6 +105,9 @@ SortedSet packages = configuration.packages; SortedSet pset = deprecatedMap.get(DeprElementKind.PACKAGE); for (Element pe : packages) { + if (utils.isDeprecatedForRemoval(pe)) { + rset.add(pe); + } if (utils.isDeprecated(pe)) { pset.add(pe); } @@ -107,6 +115,9 @@ for (Element e : configuration.getIncludedTypeElements()) { TypeElement te = (TypeElement)e; SortedSet eset; + if (utils.isDeprecatedForRemoval(e)) { + rset.add(e); + } if (utils.isDeprecated(e)) { switch (e.getKind()) { case ANNOTATION_TYPE: @@ -133,18 +144,18 @@ break; } } - composeDeprecatedList(deprecatedMap.get(DeprElementKind.FIELD), + composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.FIELD), utils.getFields(te)); - composeDeprecatedList(deprecatedMap.get(DeprElementKind.METHOD), + composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.METHOD), utils.getMethods(te)); - composeDeprecatedList(deprecatedMap.get(DeprElementKind.CONSTRUCTOR), + composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.CONSTRUCTOR), utils.getConstructors(te)); if (utils.isEnum(e)) { - composeDeprecatedList(deprecatedMap.get(DeprElementKind.ENUM_CONSTANT), + composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ENUM_CONSTANT), utils.getEnumConstants(te)); } if (utils.isAnnotationType(e)) { - composeDeprecatedList(deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE_MEMBER), + composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE_MEMBER), utils.getAnnotationMembers(te)); } @@ -154,11 +165,16 @@ /** * Add the members into a single list of deprecated members. * + * @param rset set of elements deprecated for removal. + * @param sset set of deprecated elements. * @param list List of all the particular deprecated members, e.g. methods. * @param members members to be added in the list. */ - private void composeDeprecatedList(SortedSet sset, List members) { + private void composeDeprecatedList(SortedSet rset, SortedSet sset, List members) { for (Element member : members) { + if (utils.isDeprecatedForRemoval(member)) { + rset.add(member); + } if (utils.isDeprecated(member)) { sset.add(member); } diff -r 050370edaade -r 3638773ff1b0 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Tue Dec 13 12:25:58 2016 -0800 @@ -36,6 +36,7 @@ import javax.lang.model.SourceVersion; import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; @@ -74,10 +75,12 @@ import com.sun.source.util.DocSourcePositions; import com.sun.source.util.DocTrees; import com.sun.source.util.TreePath; +import com.sun.tools.javac.model.JavacTypes; import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo; import jdk.javadoc.internal.doclets.toolkit.Configuration; import jdk.javadoc.internal.doclets.toolkit.Messages; import jdk.javadoc.internal.doclets.toolkit.WorkArounds; +import jdk.javadoc.internal.tool.DocEnvImpl; import static javax.lang.model.element.ElementKind.*; import static javax.lang.model.element.Modifier.*; @@ -1477,6 +1480,30 @@ } /** + * Return true if the given Element is deprecated for removal. + * + * @param e the Element to check. + * @return true if the given Element is deprecated for removal. + */ + public boolean isDeprecatedForRemoval(Element e) { + List annotationList = e.getAnnotationMirrors(); + JavacTypes jctypes = ((DocEnvImpl) configuration.docEnv).toolEnv.typeutils; + for (AnnotationMirror anno : annotationList) { + if (jctypes.isSameType(anno.getAnnotationType().asElement().asType(), getDeprecatedType())) { + Map pairs = anno.getElementValues(); + if (!pairs.isEmpty()) { + for (ExecutableElement element : pairs.keySet()) { + if (element.getSimpleName().contentEquals("forRemoval")) { + return Boolean.parseBoolean((pairs.get(element)).toString()); + } + } + } + } + } + return false; + } + + /** * A convenience method to get property name from the name of the * getter or setter method. * @param e the input method. diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Tue Dec 13 12:25:58 2016 -0800 @@ -23,7 +23,7 @@ /* * @test - * @bug 4927552 8026567 8071982 + * @bug 4927552 8026567 8071982 8162674 * @summary * @author jamieh * @library ../lib @@ -79,14 +79,138 @@ "
@Deprecated\n"
                 + "public class DeprecatedClassByAnnotation\n"
                 + "extends java.lang.Object
", - "
@Deprecated\n"
+                "
@Deprecated(forRemoval=true)\n"
                 + "public int field
\n" - + "
Deprecated. 
", - "
@Deprecated\n"
+                + "
Deprecated, for removal: This API element is subject to removal in a future version.  
", + "
@Deprecated(forRemoval=true)\n"
                 + "public DeprecatedClassByAnnotation()
\n" - + "
Deprecated. 
", + + "
Deprecated, for removal: This API element is subject to removal in a future version.  
", "
@Deprecated\n"
                 + "public void method()
\n" + "
Deprecated. 
"); + + checkOutput("pkg/TestAnnotationType.html", true, + "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + + "
annotation_test1 passes.
\n" + + "
\n" + + "
\n" + + "
@Deprecated(forRemoval=true)\n"
+                + "@Documented\n"
+                + "public @interface TestAnnotationType
", + "
@Deprecated(forRemoval=true)\n"
+                + "static final int field
\n" + + "
Deprecated, for removal: This " + + "API element is subject to removal in a future version.  annotation_test4 passes.
", + "
@Deprecated(forRemoval=true)\n"
+                + "int required
\n" + + "
Deprecated, for removal: This API element is subject to removal in a future version.  " + + "annotation_test3 passes.
", + "
java.lang.String optional
\n" + + "
Deprecated. annotation_test2 passes.
"); + + checkOutput("pkg/TestClass.html", true, + "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + + "
class_test1 passes.
\n" + + "
\n" + + "
\n" + + "
@Deprecated(forRemoval=true)\n"
+                + "public class TestClass\n"
+                + "extends java.lang.Object
", + "
@Deprecated(forRemoval=true)\n"
+                + "public TestClass()
\n" + + "
Deprecated, for removal: This API element is subject to removal in a future version.  " + + "class_test3 passes.
"); + + checkOutput("pkg/TestEnum.html", true, + "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + + "
enum_test1 passes.
\n" + + "
\n" + + "
\n" + + "
@Deprecated(forRemoval=true)\n"
+                + "public enum TestEnum\n"
+                + "extends java.lang.Enum<TestEnum>
", + "
@Deprecated(forRemoval=true)\n"
+                + "public static final TestEnum FOR_REMOVAL
\n" + + "
Deprecated, for removal: This API element is subject to removal in a future version.  " + + "enum_test3 passes.
"); + + checkOutput("pkg/TestError.html", true, + "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + + "
error_test1 passes.
\n" + + "
\n" + + "
\n" + + "
@Deprecated(forRemoval=true)\n"
+                + "public class TestError\n"
+                + "extends java.lang.Error
"); + + checkOutput("pkg/TestException.html", true, + "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + + "
exception_test1 passes.
\n" + + "
\n" + + "
\n" + + "
@Deprecated(forRemoval=true)\n"
+                + "public class TestException\n"
+                + "extends java.lang.Exception
"); + + checkOutput("pkg/TestInterface.html", true, + "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + + "
interface_test1 passes.
\n" + + "
\n" + + "
\n" + + "
@Deprecated(forRemoval=true)\n"
+                + "public class TestInterface\n"
+                + "extends java.lang.Object
"); + + checkOutput("deprecated-list.html", true, + "", + "", + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "", + "
Deprecated For Removal 
ElementDescription
\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
Deprecated Enums 
EnumDescription
pkg.TestEnum\n" + + "
enum_test1 passes.
\n" + + "
", + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
Deprecated Exceptions 
ExceptionsDescription
pkg.TestException\n" + + "
exception_test1 passes.
\n" + + "
"); } } diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/DeprecatedClassByAnnotation.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/DeprecatedClassByAnnotation.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/DeprecatedClassByAnnotation.java Tue Dec 13 12:25:58 2016 -0800 @@ -26,10 +26,10 @@ @Deprecated() public class DeprecatedClassByAnnotation { - @Deprecated() + @Deprecated(forRemoval=true) public int field; - @Deprecated() + @Deprecated(forRemoval=true) public DeprecatedClassByAnnotation() {} @Deprecated() diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestAnnotationType.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestAnnotationType.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestAnnotationType.java Tue Dec 13 12:25:58 2016 -0800 @@ -28,6 +28,7 @@ /** * @deprecated annotation_test1 passes. */ +@Deprecated(forRemoval=true) @Documented public @interface TestAnnotationType { /** @@ -38,10 +39,12 @@ /** * @deprecated annotation_test3 passes. */ + @Deprecated(forRemoval=true) int required(); /** * @deprecated annotation_test4 passes. */ + @Deprecated(forRemoval=true) int field = 0; } diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java Tue Dec 13 12:25:58 2016 -0800 @@ -26,6 +26,7 @@ /** * @deprecated class_test1 passes. */ +@Deprecated(forRemoval=true) public class TestClass { /** @@ -36,6 +37,7 @@ /** * @deprecated class_test3 passes. */ + @Deprecated(forRemoval=true) public TestClass() {} /** diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestEnum.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestEnum.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestEnum.java Tue Dec 13 12:25:58 2016 -0800 @@ -26,10 +26,17 @@ /** * @deprecated enum_test1 passes. */ +@Deprecated(forRemoval=true) public enum TestEnum { /** * @deprecated enum_test2 passes. */ - ONE, TWO, THREE; + ONE, TWO, THREE, + + /** + * @deprecated enum_test3 passes. + */ + @Deprecated(forRemoval=true) + FOR_REMOVAL; } diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestError.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestError.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestError.java Tue Dec 13 12:25:58 2016 -0800 @@ -26,6 +26,7 @@ /** * @deprecated error_test1 passes. */ +@Deprecated(forRemoval=true) public class TestError extends Error { /** diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestException.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestException.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestException.java Tue Dec 13 12:25:58 2016 -0800 @@ -26,6 +26,7 @@ /** * @deprecated exception_test1 passes. */ +@Deprecated(forRemoval=true) public class TestException extends Exception { /** diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestInterface.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestInterface.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestInterface.java Tue Dec 13 12:25:58 2016 -0800 @@ -30,6 +30,7 @@ /** * @deprecated interface_test1 passes. */ +@Deprecated(forRemoval=true) public class TestInterface { /** diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testModules/TestModules.java --- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Tue Dec 13 12:25:58 2016 -0800 @@ -23,7 +23,7 @@ /* * @test - * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 + * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -253,7 +253,8 @@ void checkHtml5Description(boolean found) { checkOutput("module1-summary.html", found, "
\n" - + "
Deprecated.\n" + + "
Deprecated, for removal:" + + " This API element is subject to removal in a future version. \n" + "
This module is deprecated.
\n" + "
\n" + "\n" @@ -597,11 +598,13 @@ void checkModuleDeprecation(boolean found) { checkOutput("module1-summary.html", found, - "
Deprecated.\n" + "
Deprecated, for removal:" + + " This API element is subject to removal in a future version. \n" + "
This module is deprecated.
\n" + "
"); checkOutput("deprecated-list.html", found, "
", "\n" diff -r 050370edaade -r 3638773ff1b0 langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java --- a/langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java Tue Dec 13 10:49:28 2016 +0100 +++ b/langtools/test/jdk/javadoc/doclet/testModules/module1/module-info.java Tue Dec 13 12:25:58 2016 -0800 @@ -28,7 +28,7 @@ * * @deprecated This module is deprecated. */ -@Deprecated +@Deprecated(forRemoval=true) module module1 { requires module2;