Mon, 02 May 2011 02:13:02 -0700
6492694: @deprecated tag doesn't work in package-info files.
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Sat Apr 30 16:57:18 2011 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Mon May 02 02:13:02 2011 -0700 1.3 @@ -149,11 +149,20 @@ 1.4 ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree); 1.5 ClassDoc[] classes = configuration.root.classes(); 1.6 for (int i = 0; i < classes.length; i++) { 1.7 - ClassUseWriter.generate(configuration, mapper, classes[i]); 1.8 + // If -nodeprecated option is set and the containing package is marked 1.9 + // as deprecated, do not generate the class-use page. We will still generate 1.10 + // the class-use page if the class is marked as deprecated but the containing 1.11 + // package is not since it could still be linked from that package-use page. 1.12 + if (!(configuration.nodeprecated && 1.13 + Util.isDeprecated(classes[i].containingPackage()))) 1.14 + ClassUseWriter.generate(configuration, mapper, classes[i]); 1.15 } 1.16 PackageDoc[] pkgs = configuration.packages; 1.17 for (int i = 0; i < pkgs.length; i++) { 1.18 - PackageUseWriter.generate(configuration, mapper, pkgs[i]); 1.19 + // If -nodeprecated option is set and the package is marked 1.20 + // as deprecated, do not generate the package-use page. 1.21 + if (!(configuration.nodeprecated && Util.isDeprecated(pkgs[i]))) 1.22 + PackageUseWriter.generate(configuration, mapper, pkgs[i]); 1.23 } 1.24 } 1.25
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Sat Apr 30 16:57:18 2011 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Mon May 02 02:13:02 2011 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -42,15 +42,15 @@ 2.11 public class DeprecatedListWriter extends SubWriterHolderWriter { 2.12 2.13 private static final String[] ANCHORS = new String[] { 2.14 - "interface", "class", "enum", "exception", "error", "annotation_type", 2.15 - "field", "method", "constructor", "enum_constant", 2.16 + "package", "interface", "class", "enum", "exception", "error", 2.17 + "annotation_type", "field", "method", "constructor", "enum_constant", 2.18 "annotation_type_member" 2.19 }; 2.20 2.21 private static final String[] HEADING_KEYS = new String[] { 2.22 - "doclet.Deprecated_Interfaces", "doclet.Deprecated_Classes", 2.23 - "doclet.Deprecated_Enums", "doclet.Deprecated_Exceptions", 2.24 - "doclet.Deprecated_Errors", 2.25 + "doclet.Deprecated_Packages", "doclet.Deprecated_Interfaces", 2.26 + "doclet.Deprecated_Classes", "doclet.Deprecated_Enums", 2.27 + "doclet.Deprecated_Exceptions", "doclet.Deprecated_Errors", 2.28 "doclet.Deprecated_Annotation_Types", 2.29 "doclet.Deprecated_Fields", 2.30 "doclet.Deprecated_Methods", "doclet.Deprecated_Constructors", 2.31 @@ -59,9 +59,9 @@ 2.32 }; 2.33 2.34 private static final String[] SUMMARY_KEYS = new String[] { 2.35 - "doclet.deprecated_interfaces", "doclet.deprecated_classes", 2.36 - "doclet.deprecated_enums", "doclet.deprecated_exceptions", 2.37 - "doclet.deprecated_errors", 2.38 + "doclet.deprecated_packages", "doclet.deprecated_interfaces", 2.39 + "doclet.deprecated_classes", "doclet.deprecated_enums", 2.40 + "doclet.deprecated_exceptions", "doclet.deprecated_errors", 2.41 "doclet.deprecated_annotation_types", 2.42 "doclet.deprecated_fields", 2.43 "doclet.deprecated_methods", "doclet.deprecated_constructors", 2.44 @@ -70,7 +70,7 @@ 2.45 }; 2.46 2.47 private static final String[] HEADER_KEYS = new String[] { 2.48 - "doclet.Interface", "doclet.Class", 2.49 + "doclet.Package", "doclet.Interface", "doclet.Class", 2.50 "doclet.Enum", "doclet.Exceptions", 2.51 "doclet.Errors", 2.52 "doclet.AnnotationType", 2.53 @@ -116,7 +116,7 @@ 2.54 DeprecatedListWriter depr = 2.55 new DeprecatedListWriter(configuration, filename); 2.56 depr.generateDeprecatedListFile( 2.57 - new DeprecatedAPIListBuilder(configuration.root)); 2.58 + new DeprecatedAPIListBuilder(configuration)); 2.59 depr.close(); 2.60 } catch (IOException exc) { 2.61 configuration.standardmessage.error( 2.62 @@ -149,8 +149,14 @@ 2.63 memberTableHeader[0] = configuration.getText("doclet.0_and_1", 2.64 configuration.getText(HEADER_KEYS[i]), 2.65 configuration.getText("doclet.Description")); 2.66 - writers[i].addDeprecatedAPI(deprapi.getList(i), 2.67 - HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); 2.68 + // DeprecatedAPIListBuilder.PACKAGE == 0, so if i == 0, it is 2.69 + // a PackageDoc. 2.70 + if (i == DeprecatedAPIListBuilder.PACKAGE) 2.71 + addPackageDeprecatedAPI(deprapi.getList(i), 2.72 + HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); 2.73 + else 2.74 + writers[i - 1].addDeprecatedAPI(deprapi.getList(i), 2.75 + HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); 2.76 } 2.77 } 2.78 body.addContent(div);
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Sat Apr 30 16:57:18 2011 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Mon May 02 02:13:02 2011 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -198,23 +198,27 @@ 3.11 PackageIndexFrameWriter.generate(configuration); 3.12 } 3.13 PackageDoc prev = null, next; 3.14 - for(int i = 0; i < packages.length; i++) { 3.15 - PackageFrameWriter.generate(configuration, packages[i]); 3.16 - next = (i + 1 < packages.length && packages[i+1].name().length() > 0) ? 3.17 - packages[i+1] : null; 3.18 - //If the next package is unnamed package, skip 2 ahead if possible 3.19 - next = (i + 2 < packages.length && next == null) ? 3.20 - packages[i+2]: next; 3.21 - AbstractBuilder packageSummaryBuilder = configuration. 3.22 - getBuilderFactory().getPackageSummaryBuilder( 3.23 - packages[i], prev, next); 3.24 - packageSummaryBuilder.build(); 3.25 - if (configuration.createtree) { 3.26 - PackageTreeWriter.generate(configuration, 3.27 - packages[i], prev, next, 3.28 - configuration.nodeprecated); 3.29 + for (int i = 0; i < packages.length; i++) { 3.30 + // if -nodeprecated option is set and the package is marked as 3.31 + // deprecated, do not generate the package-summary.html, package-frame.html 3.32 + // and package-tree.html pages for that package. 3.33 + if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) { 3.34 + PackageFrameWriter.generate(configuration, packages[i]); 3.35 + next = (i + 1 < packages.length && 3.36 + packages[i + 1].name().length() > 0) ? packages[i + 1] : null; 3.37 + //If the next package is unnamed package, skip 2 ahead if possible 3.38 + next = (i + 2 < packages.length && next == null) ? packages[i + 2] : next; 3.39 + AbstractBuilder packageSummaryBuilder = 3.40 + configuration.getBuilderFactory().getPackageSummaryBuilder( 3.41 + packages[i], prev, next); 3.42 + packageSummaryBuilder.build(); 3.43 + if (configuration.createtree) { 3.44 + PackageTreeWriter.generate(configuration, 3.45 + packages[i], prev, next, 3.46 + configuration.nodeprecated); 3.47 + } 3.48 + prev = packages[i]; 3.49 } 3.50 - prev = packages[i]; 3.51 } 3.52 } 3.53
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Sat Apr 30 16:57:18 2011 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon May 02 02:13:02 2011 -0700 4.3 @@ -1395,6 +1395,44 @@ 4.4 } 4.5 4.6 /** 4.7 + * Add package deprecation information to the documentation tree 4.8 + * 4.9 + * @param deprPkgs list of deprecated packages 4.10 + * @param headingKey the caption for the deprecated package table 4.11 + * @param tableSummary the summary for the deprecated package table 4.12 + * @param tableHeader table headers for the deprecated package table 4.13 + * @param contentTree the content tree to which the deprecated package table will be added 4.14 + */ 4.15 + protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey, 4.16 + String tableSummary, String[] tableHeader, Content contentTree) { 4.17 + if (deprPkgs.size() > 0) { 4.18 + Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, 4.19 + getTableCaption(configuration().getText(headingKey))); 4.20 + table.addContent(getSummaryTableHeader(tableHeader, "col")); 4.21 + Content tbody = new HtmlTree(HtmlTag.TBODY); 4.22 + for (int i = 0; i < deprPkgs.size(); i++) { 4.23 + PackageDoc pkg = (PackageDoc) deprPkgs.get(i); 4.24 + HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, 4.25 + getPackageLink(pkg, getPackageName(pkg))); 4.26 + if (pkg.tags("deprecated").length > 0) { 4.27 + addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td); 4.28 + } 4.29 + HtmlTree tr = HtmlTree.TR(td); 4.30 + if (i % 2 == 0) { 4.31 + tr.addStyle(HtmlStyle.altColor); 4.32 + } else { 4.33 + tr.addStyle(HtmlStyle.rowColor); 4.34 + } 4.35 + tbody.addContent(tr); 4.36 + } 4.37 + table.addContent(tbody); 4.38 + Content li = HtmlTree.LI(HtmlStyle.blockList, table); 4.39 + Content ul = HtmlTree.UL(HtmlStyle.blockList, li); 4.40 + contentTree.addContent(ul); 4.41 + } 4.42 + } 4.43 + 4.44 + /** 4.45 * Prine table header information about color, column span and the font. 4.46 * 4.47 * @param color Background color.
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Sat Apr 30 16:57:18 2011 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Mon May 02 02:13:02 2011 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -93,7 +93,7 @@ 5.11 packgen = new PackageFrameWriter(configuration, packageDoc); 5.12 String pkgName = Util.getPackageName(packageDoc); 5.13 Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); 5.14 - Content pkgNameContent = new StringContent(pkgName); 5.15 + Content pkgNameContent = new RawHtml(pkgName); 5.16 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, 5.17 packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent)); 5.18 body.addContent(heading);
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Sat Apr 30 16:57:18 2011 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Mon May 02 02:13:02 2011 -0700 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -80,7 +80,10 @@ 6.11 HtmlTree ul = new HtmlTree(HtmlTag.UL); 6.12 ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString()); 6.13 for(int i = 0; i < packages.length; i++) { 6.14 - if (packages[i] != null) { 6.15 + // Do not list the package if -nodeprecated option is set and the 6.16 + // package is marked as deprecated. 6.17 + if (packages[i] != null && 6.18 + (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) { 6.19 ul.addContent(getPackage(packages[i])); 6.20 } 6.21 }
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Sat Apr 30 16:57:18 2011 -0700 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Mon May 02 02:13:02 2011 -0700 7.3 @@ -137,6 +137,8 @@ 7.4 protected void addPackagesList(PackageDoc[] packages, Content tbody) { 7.5 for (int i = 0; i < packages.length; i++) { 7.6 if (packages[i] != null && packages[i].name().length() > 0) { 7.7 + if (configuration.nodeprecated && Util.isDeprecated(packages[i])) 7.8 + continue; 7.9 Content packageLinkContent = getPackageLink(packages[i], 7.10 getPackageName(packages[i])); 7.11 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Sat Apr 30 16:57:18 2011 -0700 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Mon May 02 02:13:02 2011 -0700 8.3 @@ -242,11 +242,16 @@ 8.4 */ 8.5 protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException { 8.6 Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst, 8.7 - getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg)))); 8.8 + getHyperLink("", Util.getPackageName(pkg), 8.9 + new RawHtml(Util.getPackageName(pkg)))); 8.10 contentTree.addContent(tdFirst); 8.11 HtmlTree tdLast = new HtmlTree(HtmlTag.TD); 8.12 tdLast.addStyle(HtmlStyle.colLast); 8.13 - addSummaryComment(pkg, tdLast); 8.14 + if (pkg != null && pkg.name().length() != 0) { 8.15 + addSummaryComment(pkg, tdLast); 8.16 + } else { 8.17 + tdLast.addContent(getSpace()); 8.18 + } 8.19 contentTree.addContent(tdLast); 8.20 } 8.21
9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Sat Apr 30 16:57:18 2011 -0700 9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Mon May 02 02:13:02 2011 -0700 9.3 @@ -114,11 +114,12 @@ 9.4 Content packageHead = new RawHtml(heading); 9.5 tHeading.addContent(packageHead); 9.6 div.addContent(tHeading); 9.7 + addDeprecationInfo(div); 9.8 if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) { 9.9 - HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV); 9.10 - subTitleDiv.addStyle(HtmlStyle.subTitle); 9.11 - addSummaryComment(packageDoc, subTitleDiv); 9.12 - div.addContent(subTitleDiv); 9.13 + HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV); 9.14 + docSummaryDiv.addStyle(HtmlStyle.docSummary); 9.15 + addSummaryComment(packageDoc, docSummaryDiv); 9.16 + div.addContent(docSummaryDiv); 9.17 Content space = getSpace(); 9.18 Content descLink = getHyperLink("", "package_description", 9.19 descriptionLabel, "", ""); 9.20 @@ -139,6 +140,28 @@ 9.21 } 9.22 9.23 /** 9.24 + * Add the package deprecation information to the documentation tree. 9.25 + * 9.26 + * @param div the content tree to which the deprecation information will be added 9.27 + */ 9.28 + public void addDeprecationInfo(Content div) { 9.29 + Tag[] deprs = packageDoc.tags("deprecated"); 9.30 + if (Util.isDeprecated(packageDoc)) { 9.31 + HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); 9.32 + deprDiv.addStyle(HtmlStyle.deprecatedContent); 9.33 + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); 9.34 + deprDiv.addContent(deprPhrase); 9.35 + if (deprs.length > 0) { 9.36 + Tag[] commentTags = deprs[0].inlineTags(); 9.37 + if (commentTags.length > 0) { 9.38 + addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv); 9.39 + } 9.40 + } 9.41 + div.addContent(deprDiv); 9.42 + } 9.43 + } 9.44 + 9.45 + /** 9.46 * {@inheritDoc} 9.47 */ 9.48 public Content getSummaryHeader() {
10.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Sat Apr 30 16:57:18 2011 -0700 10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Mon May 02 02:13:02 2011 -0700 10.3 @@ -82,12 +82,20 @@ 10.4 } 10.5 PackageDoc[] pds = rd.specifiedPackages(); 10.6 for (int i = 0; i < pds.length; i++) { 10.7 - convertPackage(configuration, pds[i], outputdir); 10.8 + // If -nodeprecated option is set and the package is marked as deprecated, 10.9 + // do not convert the package files to HTML. 10.10 + if (!(configuration.nodeprecated && Util.isDeprecated(pds[i]))) 10.11 + convertPackage(configuration, pds[i], outputdir); 10.12 } 10.13 ClassDoc[] cds = rd.specifiedClasses(); 10.14 for (int i = 0; i < cds.length; i++) { 10.15 - convertClass(configuration, cds[i], 10.16 - getPackageOutputDir(outputdir, cds[i].containingPackage())); 10.17 + // If -nodeprecated option is set and the class is marked as deprecated 10.18 + // or the containing package is deprecated, do not convert the 10.19 + // package files to HTML. 10.20 + if (!(configuration.nodeprecated && 10.21 + (Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage())))) 10.22 + convertClass(configuration, cds[i], 10.23 + getPackageOutputDir(outputdir, cds[i].containingPackage())); 10.24 } 10.25 } 10.26 10.27 @@ -106,7 +114,12 @@ 10.28 String classOutputdir = getPackageOutputDir(outputdir, pd); 10.29 ClassDoc[] cds = pd.allClasses(); 10.30 for (int i = 0; i < cds.length; i++) { 10.31 - convertClass(configuration, cds[i], classOutputdir); 10.32 + // If -nodeprecated option is set and the class is marked as deprecated, 10.33 + // do not convert the package files to HTML. We do not check for 10.34 + // containing package deprecation since it is already check in 10.35 + // the calling method above. 10.36 + if (!(configuration.nodeprecated && Util.isDeprecated(cds[i]))) 10.37 + convertClass(configuration, cds[i], classOutputdir); 10.38 } 10.39 } 10.40
11.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Sat Apr 30 16:57:18 2011 -0700 11.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Mon May 02 02:13:02 2011 -0700 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -132,7 +132,11 @@ 11.11 HtmlTree ul = new HtmlTree(HtmlTag.UL); 11.12 ul.addStyle(HtmlStyle.horizontal); 11.13 for (int i = 0; i < packages.length; i++) { 11.14 - if (packages[i].name().length() == 0) { 11.15 + // If the package name length is 0 or if -nodeprecated option 11.16 + // is set and the package is marked as deprecated, do not include 11.17 + // the page in the list of package hierarchies. 11.18 + if (packages[i].name().length() == 0 || 11.19 + (configuration.nodeprecated && Util.isDeprecated(packages[i]))) { 11.20 continue; 11.21 } 11.22 String link = pathString(packages[i], "package-tree.html");
12.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Sat Apr 30 16:57:18 2011 -0700 12.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Mon May 02 02:13:02 2011 -0700 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -46,6 +46,7 @@ 12.11 contentContainer, 12.12 description, 12.13 details, 12.14 + docSummary, 12.15 header, 12.16 horizontal, 12.17 footer, 12.18 @@ -67,6 +68,7 @@ 12.19 subNavList, 12.20 subTitle, 12.21 summary, 12.22 + deprecatedContent, 12.23 tabEnd, 12.24 title, 12.25 topNav;
13.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Sat Apr 30 16:57:18 2011 -0700 13.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Mon May 02 02:13:02 2011 -0700 13.3 @@ -68,6 +68,7 @@ 13.4 doclet.see.malformed_tag=Tag {0}: Malformed: {1} 13.5 doclet.Inherited_API_Summary=Inherited API Summary 13.6 doclet.Deprecated_API=Deprecated API 13.7 +doclet.Deprecated_Packages=Deprecated Packages 13.8 doclet.Deprecated_Classes=Deprecated Classes 13.9 doclet.Deprecated_Enums=Deprecated Enums 13.10 doclet.Deprecated_Interfaces=Deprecated Interfaces 13.11 @@ -79,6 +80,7 @@ 13.12 doclet.Deprecated_Methods=Deprecated Methods 13.13 doclet.Deprecated_Enum_Constants=Deprecated Enum Constants 13.14 doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements 13.15 +doclet.deprecated_packages=deprecated packages 13.16 doclet.deprecated_classes=deprecated classes 13.17 doclet.deprecated_enums=deprecated enums 13.18 doclet.deprecated_interfaces=deprecated interfaces
14.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Sat Apr 30 16:57:18 2011 -0700 14.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Mon May 02 02:13:02 2011 -0700 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -419,7 +419,7 @@ 14.11 docencoding = encoding; 14.12 } 14.13 14.14 - classDocCatalog = new ClassDocCatalog(root.specifiedClasses()); 14.15 + classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this); 14.16 initTagletManager(customTagStrs); 14.17 } 14.18 14.19 @@ -677,15 +677,18 @@ 14.20 } 14.21 14.22 /** 14.23 - * Return true if the doc element is getting documented, depending upon 14.24 - * -nodeprecated option and @deprecated tag used. Return true if 14.25 - * -nodeprecated is not used or @deprecated tag is not used. 14.26 + * Return true if the ClassDoc element is getting documented, depending upon 14.27 + * -nodeprecated option and the deprecation information. Return true if 14.28 + * -nodeprecated is not used. Return false if -nodeprecated is used and if 14.29 + * either ClassDoc element is deprecated or the containing package is deprecated. 14.30 + * 14.31 + * @param cd the ClassDoc for which the page generation is checked 14.32 */ 14.33 - public boolean isGeneratedDoc(Doc doc) { 14.34 + public boolean isGeneratedDoc(ClassDoc cd) { 14.35 if (!nodeprecated) { 14.36 return true; 14.37 } 14.38 - return (doc.tags("deprecated")).length == 0; 14.39 + return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage())); 14.40 } 14.41 14.42 /**
15.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Sat Apr 30 16:57:18 2011 -0700 15.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Mon May 02 02:13:02 2011 -0700 15.3 @@ -159,6 +159,16 @@ 15.4 padding-top:10px; 15.5 } 15.6 /* 15.7 +Content styles 15.8 +*/ 15.9 +.deprecatedContent { 15.10 + margin:0; 15.11 + padding:10px 0; 15.12 +} 15.13 +.docSummary { 15.14 + padding-top:10px; 15.15 +} 15.16 +/* 15.17 Page layout container styles 15.18 */ 15.19 .contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer,
16.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java Sat Apr 30 16:57:18 2011 -0700 16.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java Mon May 02 02:13:02 2011 -0700 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -47,13 +47,6 @@ 16.11 /** 16.12 * {@inheritDoc} 16.13 */ 16.14 - public boolean inPackage() { 16.15 - return false; 16.16 - } 16.17 - 16.18 - /** 16.19 - * {@inheritDoc} 16.20 - */ 16.21 public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) { 16.22 return writer.deprecatedTagOutput(holder); 16.23 }
17.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java Sat Apr 30 16:57:18 2011 -0700 17.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java Mon May 02 02:13:02 2011 -0700 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -25,8 +25,9 @@ 17.11 17.12 package com.sun.tools.doclets.internal.toolkit.util; 17.13 17.14 +import java.util.*; 17.15 import com.sun.javadoc.*; 17.16 -import java.util.*; 17.17 +import com.sun.tools.doclets.internal.toolkit.Configuration; 17.18 17.19 /** 17.20 * This class acts as an artificial PackageDoc for classes specified 17.21 @@ -88,13 +89,16 @@ 17.22 */ 17.23 private Map<String,Set<ClassDoc>> interfaces; 17.24 17.25 + private Configuration configuration; 17.26 + 17.27 /** 17.28 * Construct a new ClassDocCatalog. 17.29 * 17.30 * @param classdocs the array of ClassDocs to catalog 17.31 */ 17.32 - public ClassDocCatalog (ClassDoc[] classdocs) { 17.33 + public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) { 17.34 init(); 17.35 + this.configuration = config; 17.36 for (int i = 0; i < classdocs.length; i++) { 17.37 addClassDoc(classdocs[i]); 17.38 } 17.39 @@ -151,9 +155,10 @@ 17.40 private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) { 17.41 17.42 PackageDoc pkg = classdoc.containingPackage(); 17.43 - if (pkg.isIncluded()) { 17.44 - //No need to catalog this class since it's package is 17.45 - //included on the command line 17.46 + if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) { 17.47 + //No need to catalog this class if it's package is 17.48 + //included on the command line or if -nodeprecated option is set 17.49 + // and the containing package is marked as deprecated. 17.50 return; 17.51 } 17.52 String key = Util.getPackageName(pkg);
18.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java Sat Apr 30 16:57:18 2011 -0700 18.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java Mon May 02 02:13:02 2011 -0700 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -122,8 +122,12 @@ 18.11 */ 18.12 private void buildTree(ClassDoc[] classes, Configuration configuration) { 18.13 for (int i = 0; i < classes.length; i++) { 18.14 + // In the tree page (e.g overview-tree.html) do not include 18.15 + // information of classes which are deprecated or are a part of a 18.16 + // deprecated package. 18.17 if (configuration.nodeprecated && 18.18 - classes[i].tags("deprecated").length > 0) { 18.19 + (Util.isDeprecated(classes[i]) || 18.20 + Util.isDeprecated(classes[i].containingPackage()))) { 18.21 continue; 18.22 } 18.23 if (classes[i].isEnum()) {
19.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java Sat Apr 30 16:57:18 2011 -0700 19.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java Mon May 02 02:13:02 2011 -0700 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 19.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -27,27 +27,29 @@ 19.11 19.12 import com.sun.javadoc.*; 19.13 import java.util.*; 19.14 +import com.sun.tools.doclets.internal.toolkit.Configuration; 19.15 19.16 /** 19.17 - * Build list of all the deprecated classes, constructors, fields and methods. 19.18 + * Build list of all the deprecated packages, classes, constructors, fields and methods. 19.19 * 19.20 * @author Atul M Dambalkar 19.21 */ 19.22 public class DeprecatedAPIListBuilder { 19.23 19.24 - public static final int NUM_TYPES = 11; 19.25 + public static final int NUM_TYPES = 12; 19.26 19.27 - public static final int INTERFACE = 0; 19.28 - public static final int CLASS = 1; 19.29 - public static final int ENUM = 2; 19.30 - public static final int EXCEPTION = 3; 19.31 - public static final int ERROR = 4; 19.32 - public static final int ANNOTATION_TYPE = 5; 19.33 - public static final int FIELD = 6; 19.34 - public static final int METHOD = 7; 19.35 - public static final int CONSTRUCTOR = 8; 19.36 - public static final int ENUM_CONSTANT = 9; 19.37 - public static final int ANNOTATION_TYPE_MEMBER = 10; 19.38 + public static final int PACKAGE = 0; 19.39 + public static final int INTERFACE = 1; 19.40 + public static final int CLASS = 2; 19.41 + public static final int ENUM = 3; 19.42 + public static final int EXCEPTION = 4; 19.43 + public static final int ERROR = 5; 19.44 + public static final int ANNOTATION_TYPE = 6; 19.45 + public static final int FIELD = 7; 19.46 + public static final int METHOD = 8; 19.47 + public static final int CONSTRUCTOR = 9; 19.48 + public static final int ENUM_CONSTANT = 10; 19.49 + public static final int ANNOTATION_TYPE_MEMBER = 11; 19.50 19.51 /** 19.52 * List of deprecated type Lists. 19.53 @@ -58,25 +60,33 @@ 19.54 /** 19.55 * Constructor. 19.56 * 19.57 - * @param root Root of the tree. 19.58 + * @param configuration the current configuration of the doclet 19.59 */ 19.60 - public DeprecatedAPIListBuilder(RootDoc root) { 19.61 + public DeprecatedAPIListBuilder(Configuration configuration) { 19.62 deprecatedLists = new ArrayList<List<Doc>>(); 19.63 for (int i = 0; i < NUM_TYPES; i++) { 19.64 deprecatedLists.add(i, new ArrayList<Doc>()); 19.65 } 19.66 - buildDeprecatedAPIInfo(root); 19.67 + buildDeprecatedAPIInfo(configuration); 19.68 } 19.69 19.70 /** 19.71 * Build the sorted list of all the deprecated APIs in this run. 19.72 - * Build separate lists for deprecated classes, constructors, methods and 19.73 - * fields. 19.74 + * Build separate lists for deprecated packages, classes, constructors, 19.75 + * methods and fields. 19.76 * 19.77 - * @param root Root of the tree. 19.78 + * @param configuration the current configuration of the doclet. 19.79 */ 19.80 - private void buildDeprecatedAPIInfo(RootDoc root) { 19.81 - ClassDoc[] classes = root.classes(); 19.82 + private void buildDeprecatedAPIInfo(Configuration configuration) { 19.83 + PackageDoc[] packages = configuration.packages; 19.84 + PackageDoc pkg; 19.85 + for (int c = 0; c < packages.length; c++) { 19.86 + pkg = packages[c]; 19.87 + if (Util.isDeprecated(pkg)) { 19.88 + getList(PACKAGE).add(pkg); 19.89 + } 19.90 + } 19.91 + ClassDoc[] classes = configuration.root.classes(); 19.92 for (int i = 0; i < classes.length; i++) { 19.93 ClassDoc cd = classes[i]; 19.94 if (Util.isDeprecated(cd)) { 19.95 @@ -90,7 +100,7 @@ 19.96 getList(ENUM).add(cd); 19.97 } else if (cd.isError()) { 19.98 getList(ERROR).add(cd); 19.99 - }else if (cd.isAnnotationType()) { 19.100 + } else if (cd.isAnnotationType()) { 19.101 getList(ANNOTATION_TYPE).add(cd); 19.102 } 19.103 } 19.104 @@ -102,7 +112,7 @@ 19.105 } 19.106 if (cd.isAnnotationType()) { 19.107 composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER), 19.108 - ((AnnotationTypeDoc) cd).elements()); 19.109 + ((AnnotationTypeDoc) cd).elements()); 19.110 } 19.111 } 19.112 sortDeprecatedLists();
20.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java Sat Apr 30 16:57:18 2011 -0700 20.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java Mon May 02 02:13:02 2011 -0700 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -207,7 +207,17 @@ 20.11 * Should this doc element be added to the index map? 20.12 */ 20.13 protected boolean shouldAddToIndexMap(Doc element) { 20.14 - return !(noDeprecated && element.tags("deprecated").length > 0); 20.15 + if (element instanceof PackageDoc) 20.16 + // Do not add to index map if -nodeprecated option is set and the 20.17 + // package is marked as deprecated. 20.18 + return !(noDeprecated && Util.isDeprecated(element)); 20.19 + else 20.20 + // Do not add to index map if -nodeprecated option is set and if the 20.21 + // Doc is marked as deprecated or the containing package is marked as 20.22 + // deprecated. 20.23 + return !(noDeprecated && 20.24 + (Util.isDeprecated(element) || 20.25 + Util.isDeprecated(((ProgramElementDoc)element).containingPackage()))); 20.26 } 20.27 20.28 /**
21.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Sat Apr 30 16:57:18 2011 -0700 21.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Mon May 02 02:13:02 2011 -0700 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -76,13 +76,16 @@ 21.11 21.12 protected void generatePackageListFile(RootDoc root) { 21.13 PackageDoc[] packages = configuration.packages; 21.14 - String[] names = new String[packages.length]; 21.15 + ArrayList<String> names = new ArrayList<String>(); 21.16 for (int i = 0; i < packages.length; i++) { 21.17 - names[i] = packages[i].name(); 21.18 + // if the -nodeprecated option is set and the package is marked as 21.19 + // deprecated, do not include it in the packages list. 21.20 + if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) 21.21 + names.add(packages[i].name()); 21.22 } 21.23 - Arrays.sort(names); 21.24 - for (int i = 0; i < packages.length; i++) { 21.25 - println(names[i]); 21.26 + Collections.sort(names); 21.27 + for (int i = 0; i < names.size(); i++) { 21.28 + println(names.get(i)); 21.29 } 21.30 } 21.31 }
22.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Sat Apr 30 16:57:18 2011 -0700 22.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Mon May 02 02:13:02 2011 -0700 22.3 @@ -861,11 +861,15 @@ 22.4 * @param doc the Doc to check. 22.5 * @return true if the given Doc is deprecated. 22.6 */ 22.7 - public static boolean isDeprecated(ProgramElementDoc doc) { 22.8 + public static boolean isDeprecated(Doc doc) { 22.9 if (doc.tags("deprecated").length > 0) { 22.10 return true; 22.11 } 22.12 - AnnotationDesc[] annotationDescList = doc.annotations(); 22.13 + AnnotationDesc[] annotationDescList; 22.14 + if (doc instanceof PackageDoc) 22.15 + annotationDescList = ((PackageDoc)doc).annotations(); 22.16 + else 22.17 + annotationDescList = ((ProgramElementDoc)doc).annotations(); 22.18 for (int i = 0; i < annotationDescList.length; i++) { 22.19 if (annotationDescList[i].annotationType().qualifiedName().equals( 22.20 java.lang.Deprecated.class.getName())){
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/C2.java Mon May 02 02:13:02 2011 -0700 23.3 @@ -0,0 +1,55 @@ 23.4 +/* 23.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 + * or visit www.oracle.com if you need additional information or have any 23.24 + * questions. 23.25 + */ 23.26 + 23.27 +/** 23.28 + * Another test class. 23.29 + * 23.30 + * @author Bhavesh Patel 23.31 + */ 23.32 +public class C2 { 23.33 + 23.34 + public static enum ModalExclusionType { 23.35 + /** 23.36 + * Test comment. 23.37 + */ 23.38 + NO_EXCLUDE, 23.39 + /** 23.40 + * Another comment. 23.41 + */ 23.42 + APPLICATION_EXCLUDE 23.43 + }; 23.44 + 23.45 + /** 23.46 + * A string constant. 23.47 + */ 23.48 + public static final String CONSTANT1 = "C2"; 23.49 + 23.50 + /** 23.51 + * A sample method. 23.52 + * 23.53 + * @param param some parameter. 23.54 + */ 23.55 + public void method(String param) { 23.56 + 23.57 + } 23.58 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/FooDepr.java Mon May 02 02:13:02 2011 -0700 24.3 @@ -0,0 +1,34 @@ 24.4 +/* 24.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 + * 24.8 + * This code is free software; you can redistribute it and/or modify it 24.9 + * under the terms of the GNU General Public License version 2 only, as 24.10 + * published by the Free Software Foundation. 24.11 + * 24.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 24.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.15 + * version 2 for more details (a copy is included in the LICENSE file that 24.16 + * accompanied this code). 24.17 + * 24.18 + * You should have received a copy of the GNU General Public License version 24.19 + * 2 along with this work; if not, write to the Free Software Foundation, 24.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.21 + * 24.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24.23 + * or visit www.oracle.com if you need additional information or have any 24.24 + * questions. 24.25 + */ 24.26 + 24.27 +import java.util.*; 24.28 + 24.29 +/** 24.30 +* Test Deprecated class 24.31 +* @deprecated This class is Deprecated. 24.32 +*/ 24.33 +public class FooDepr { 24.34 + 24.35 + public void method(Vector<Object> o){} 24.36 + 24.37 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java Mon May 02 02:13:02 2011 -0700 25.3 @@ -0,0 +1,103 @@ 25.4 +/* 25.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. 25.11 + * 25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.15 + * version 2 for more details (a copy is included in the LICENSE file that 25.16 + * accompanied this code). 25.17 + * 25.18 + * You should have received a copy of the GNU General Public License version 25.19 + * 2 along with this work; if not, write to the Free Software Foundation, 25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.21 + * 25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.23 + * or visit www.oracle.com if you need additional information or have any 25.24 + * questions. 25.25 + */ 25.26 + 25.27 +/* 25.28 + * @test 25.29 + * @bug 6492694 25.30 + * @summary Test package deprecation. 25.31 + * @author bpatel 25.32 + * @library ../lib/ 25.33 + * @build JavadocTester TestPackageDeprecation 25.34 + * @run main TestPackageDeprecation 25.35 + */ 25.36 + 25.37 +public class TestPackageDeprecation extends JavadocTester { 25.38 + 25.39 + //Test information. 25.40 + private static final String BUG_ID = "6492694"; 25.41 + 25.42 + //Javadoc arguments. 25.43 + private static final String[] ARGS1 = new String[]{ 25.44 + "-d", BUG_ID + "-1", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1", 25.45 + SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" 25.46 + }; 25.47 + private static final String[] ARGS2 = new String[]{ 25.48 + "-d", BUG_ID + "-2", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "-nodeprecated", 25.49 + "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" 25.50 + }; 25.51 + 25.52 + //Input for string search tests. 25.53 + private static final String[][] TEST1 = { 25.54 + {BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html", 25.55 + "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>" + NL + 25.56 + "<div class=\"block\"><i>This package is Deprecated.</i></div>" 25.57 + }, 25.58 + {BUG_ID + "-1" + FS + "deprecated-list.html", 25.59 + "<li><a href=\"#package\">Deprecated Packages</a></li>" 25.60 + } 25.61 + }; 25.62 + private static final String[][] TEST2 = NO_TEST; 25.63 + private static final String[][] NEGATED_TEST1 = NO_TEST; 25.64 + private static final String[][] NEGATED_TEST2 = { 25.65 + {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"}, 25.66 + {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"} 25.67 + }; 25.68 + 25.69 + /** 25.70 + * The entry point of the test. 25.71 + * @param args the array of command line arguments. 25.72 + */ 25.73 + public static void main(String[] args) { 25.74 + TestPackageDeprecation tester = new TestPackageDeprecation(); 25.75 + run(tester, ARGS1, TEST1, NEGATED_TEST1); 25.76 + run(tester, ARGS2, TEST2, NEGATED_TEST2); 25.77 + if ((new java.io.File(BUG_ID + "-2" + FS + "pkg1" + FS + 25.78 + "package-summary.html")).exists()) { 25.79 + throw new Error("Test Fails: packages summary should not be" + 25.80 + "generated for deprecated package."); 25.81 + } else { 25.82 + System.out.println("Test passes: package-summary.html not found."); 25.83 + } 25.84 + if ((new java.io.File(BUG_ID + "-2" + FS + "FooDepr.html")).exists()) { 25.85 + throw new Error("Test Fails: FooDepr should not be" + 25.86 + "generated as it is deprecated."); 25.87 + } else { 25.88 + System.out.println("Test passes: FooDepr.html not found."); 25.89 + } 25.90 + tester.printSummary(); 25.91 + } 25.92 + 25.93 + /** 25.94 + * {@inheritDoc} 25.95 + */ 25.96 + public String getBugId() { 25.97 + return BUG_ID; 25.98 + } 25.99 + 25.100 + /** 25.101 + * {@inheritDoc} 25.102 + */ 25.103 + public String getBugName() { 25.104 + return getClass().getName(); 25.105 + } 25.106 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg/A.java Mon May 02 02:13:02 2011 -0700 26.3 @@ -0,0 +1,35 @@ 26.4 +/* 26.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 + * or visit www.oracle.com if you need additional information or have any 26.24 + * questions. 26.25 + */ 26.26 + 26.27 +package pkg; 26.28 + 26.29 +public class A { 26.30 + /** Test constant. */ 26.31 + public static final String DEMO= "y"; 26.32 + public static final String THIS_IS_OK= "(x)"; 26.33 + 26.34 + public String DEMO_STRING = "<Hello World>"; 26.35 + 26.36 + public A() { 26.37 + } 26.38 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/ClassUseTest1.java Mon May 02 02:13:02 2011 -0700 27.3 @@ -0,0 +1,31 @@ 27.4 +/* 27.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 + * 27.8 + * This code is free software; you can redistribute it and/or modify it 27.9 + * under the terms of the GNU General Public License version 2 only, as 27.10 + * published by the Free Software Foundation. 27.11 + * 27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 + * version 2 for more details (a copy is included in the LICENSE file that 27.16 + * accompanied this code). 27.17 + * 27.18 + * You should have received a copy of the GNU General Public License version 27.19 + * 2 along with this work; if not, write to the Free Software Foundation, 27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 + * 27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 27.23 + * or visit www.oracle.com if you need additional information or have any 27.24 + * questions. 27.25 + */ 27.26 + 27.27 +package pkg1; 27.28 + 27.29 +public class ClassUseTest1 <T extends Foo & Foo2> { 27.30 + 27.31 + public <T extends Foo & Foo2> T method(T t) { 27.32 + return null; 27.33 + } 27.34 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/Foo.java Mon May 02 02:13:02 2011 -0700 28.3 @@ -0,0 +1,36 @@ 28.4 +/* 28.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.7 + * 28.8 + * This code is free software; you can redistribute it and/or modify it 28.9 + * under the terms of the GNU General Public License version 2 only, as 28.10 + * published by the Free Software Foundation. 28.11 + * 28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.15 + * version 2 for more details (a copy is included in the LICENSE file that 28.16 + * accompanied this code). 28.17 + * 28.18 + * You should have received a copy of the GNU General Public License version 28.19 + * 2 along with this work; if not, write to the Free Software Foundation, 28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.21 + * 28.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 28.23 + * or visit www.oracle.com if you need additional information or have any 28.24 + * questions. 28.25 + */ 28.26 + 28.27 +package pkg1; 28.28 + 28.29 +import java.util.*; 28.30 + 28.31 +/** 28.32 +* Test Deprecated class 28.33 +* @deprecated This class is Deprecated. 28.34 +*/ 28.35 +public class Foo { 28.36 + 28.37 + public void method(Vector<Object> o){} 28.38 + 28.39 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/Foo2.java Mon May 02 02:13:02 2011 -0700 29.3 @@ -0,0 +1,26 @@ 29.4 +/* 29.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 29.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.7 + * 29.8 + * This code is free software; you can redistribute it and/or modify it 29.9 + * under the terms of the GNU General Public License version 2 only, as 29.10 + * published by the Free Software Foundation. 29.11 + * 29.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 29.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.15 + * version 2 for more details (a copy is included in the LICENSE file that 29.16 + * accompanied this code). 29.17 + * 29.18 + * You should have received a copy of the GNU General Public License version 29.19 + * 2 along with this work; if not, write to the Free Software Foundation, 29.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.21 + * 29.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 29.23 + * or visit www.oracle.com if you need additional information or have any 29.24 + * questions. 29.25 + */ 29.26 + 29.27 +package pkg1; 29.28 + 29.29 +public interface Foo2 {}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/package-info.java Mon May 02 02:13:02 2011 -0700 30.3 @@ -0,0 +1,28 @@ 30.4 +/* 30.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 + * 30.8 + * This code is free software; you can redistribute it and/or modify it 30.9 + * under the terms of the GNU General Public License version 2 only, as 30.10 + * published by the Free Software Foundation. 30.11 + * 30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.15 + * version 2 for more details (a copy is included in the LICENSE file that 30.16 + * accompanied this code). 30.17 + * 30.18 + * You should have received a copy of the GNU General Public License version 30.19 + * 2 along with this work; if not, write to the Free Software Foundation, 30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.21 + * 30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.23 + * or visit www.oracle.com if you need additional information or have any 30.24 + * questions. 30.25 + */ 30.26 + 30.27 +/** 30.28 + * Test pkg1 used. 30.29 + * @deprecated This package is Deprecated. 30.30 + */ 30.31 +package pkg1;
31.1 --- a/test/com/sun/javadoc/testSubTitle/TestSubTitle.java Sat Apr 30 16:57:18 2011 -0700 31.2 +++ b/test/com/sun/javadoc/testSubTitle/TestSubTitle.java Mon May 02 02:13:02 2011 -0700 31.3 @@ -37,8 +37,7 @@ 31.4 private static final String BUG_ID = "7010342"; 31.5 private static final String[][] TEST = { 31.6 {BUG_ID + FS + "pkg" + FS + "package-summary.html", 31.7 - "<div class=\"subTitle\">" + NL + "<div class=\"block\">This is the " + 31.8 - "description of package pkg.</div>" + NL + "</div>" 31.9 + "<div class=\"block\">This is the description of package pkg.</div>" 31.10 }, 31.11 {BUG_ID + FS + "pkg" + FS + "C.html", 31.12 "<div class=\"subTitle\">pkg</div>"