Merge

Thu, 21 Feb 2013 17:49:56 -0800

author
lana
date
Thu, 21 Feb 2013 17:49:56 -0800
changeset 1603
6118072811e5
parent 1602
dabb36173c63
parent 1571
af8417e590f4
child 1604
8e82e4f225e4

Merge

src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Flags.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Symtab.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Check.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Feb 21 12:23:27 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Feb 21 17:49:56 2013 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -150,7 +150,20 @@
    1.11              String tableSummary, Content body) {
    1.12          if (packages.length > 0) {
    1.13              Arrays.sort(packages);
    1.14 -            addAllClassesLink(body);
    1.15 +            HtmlTree div = new HtmlTree(HtmlTag.DIV);
    1.16 +            div.addStyle(HtmlStyle.indexHeader);
    1.17 +            addAllClassesLink(div);
    1.18 +            if (configuration.showProfiles) {
    1.19 +                addAllProfilesLink(div);
    1.20 +            }
    1.21 +            body.addContent(div);
    1.22 +            if (configuration.showProfiles) {
    1.23 +                String profileSummary = configuration.getText("doclet.Profiles");
    1.24 +                String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary",
    1.25 +                configuration.getText("doclet.Profile_Summary"),
    1.26 +                configuration.getText("doclet.profiles"));
    1.27 +                addProfilesList(profileSummary, profilesTableSummary, body);
    1.28 +            }
    1.29              addPackagesList(packages, text, tableSummary, body);
    1.30          }
    1.31      }
    1.32 @@ -182,10 +195,29 @@
    1.33      }
    1.34  
    1.35      /**
    1.36 -     * Do nothing. This will be overridden in PackageIndexFrameWriter.
    1.37 +     * Do nothing. This will be overridden.
    1.38       *
    1.39 -     * @param body the document tree to which the all classes link will be added
    1.40 +     * @param div the document tree to which the all classes link will be added
    1.41       */
    1.42 -    protected void addAllClassesLink(Content body) {
    1.43 +    protected void addAllClassesLink(Content div) {
    1.44 +    }
    1.45 +
    1.46 +    /**
    1.47 +     * Do nothing. This will be overridden.
    1.48 +     *
    1.49 +     * @param div the document tree to which the all profiles link will be added
    1.50 +     */
    1.51 +    protected void addAllProfilesLink(Content div) {
    1.52 +    }
    1.53 +
    1.54 +    /**
    1.55 +     * Do nothing. This will be overridden.
    1.56 +     *
    1.57 +     * @param profileSummary the profile summary heading
    1.58 +     * @param profilesTableSummary the profiles table summary information
    1.59 +     * @param body the content tree to which the profiles list will be added
    1.60 +     */
    1.61 +    protected void addProfilesList(String profileSummary, String profilesTableSummary,
    1.62 +            Content body) {
    1.63      }
    1.64  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java	Thu Feb 21 17:49:56 2013 -0800
     2.3 @@ -0,0 +1,276 @@
     2.4 +/*
     2.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package com.sun.tools.doclets.formats.html;
    2.30 +
    2.31 +import java.io.*;
    2.32 +
    2.33 +import com.sun.tools.javac.sym.Profiles;
    2.34 +import com.sun.tools.doclets.formats.html.markup.*;
    2.35 +import com.sun.tools.doclets.internal.toolkit.*;
    2.36 +import com.sun.tools.doclets.internal.toolkit.util.DocPath;
    2.37 +
    2.38 +/**
    2.39 + * Abstract class to generate the profile overview files in
    2.40 + * Frame and Non-Frame format. This will be sub-classed to
    2.41 + * generate profile-overview-frame.html as well as profile-overview-summary.html.
    2.42 + *
    2.43 + *  <p><b>This is NOT part of any supported API.
    2.44 + *  If you write code that depends on this, you do so at your own risk.
    2.45 + *  This code and its internal interfaces are subject to change or
    2.46 + *  deletion without notice.</b>
    2.47 + *
    2.48 + * @author Bhavesh Patel
    2.49 + */
    2.50 +public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
    2.51 +
    2.52 +    /**
    2.53 +     * Profiles to be documented.
    2.54 +     */
    2.55 +    protected Profiles profiles;
    2.56 +
    2.57 +    /**
    2.58 +     * Constructor. Also initializes the profiles variable.
    2.59 +     *
    2.60 +     * @param configuration  The current configuration
    2.61 +     * @param filename Name of the profile index file to be generated.
    2.62 +     */
    2.63 +    public AbstractProfileIndexWriter(ConfigurationImpl configuration,
    2.64 +                                      DocPath filename) throws IOException {
    2.65 +        super(configuration, filename);
    2.66 +        profiles = configuration.profiles;
    2.67 +    }
    2.68 +
    2.69 +    /**
    2.70 +     * Adds the navigation bar header to the documentation tree.
    2.71 +     *
    2.72 +     * @param body the document tree to which the navigation bar header will be added
    2.73 +     */
    2.74 +    protected abstract void addNavigationBarHeader(Content body);
    2.75 +
    2.76 +    /**
    2.77 +     * Adds the navigation bar footer to the documentation tree.
    2.78 +     *
    2.79 +     * @param body the document tree to which the navigation bar footer will be added
    2.80 +     */
    2.81 +    protected abstract void addNavigationBarFooter(Content body);
    2.82 +
    2.83 +    /**
    2.84 +     * Adds the overview header to the documentation tree.
    2.85 +     *
    2.86 +     * @param body the document tree to which the overview header will be added
    2.87 +     */
    2.88 +    protected abstract void addOverviewHeader(Content body);
    2.89 +
    2.90 +    /**
    2.91 +     * Adds the profiles list to the documentation tree.
    2.92 +     *
    2.93 +     * @param profiles profiles object
    2.94 +     * @param text caption for the table
    2.95 +     * @param tableSummary summary for the table
    2.96 +     * @param body the document tree to which the profiles list will be added
    2.97 +     */
    2.98 +    protected abstract void addProfilesList(Profiles profiles, String text,
    2.99 +            String tableSummary, Content body);
   2.100 +
   2.101 +    /**
   2.102 +     * Adds the profile packages list to the documentation tree.
   2.103 +     *
   2.104 +     * @param profiles profiles object
   2.105 +     * @param text caption for the table
   2.106 +     * @param tableSummary summary for the table
   2.107 +     * @param body the document tree to which the profiles list will be added
   2.108 +     * @param profileName the name for the profile being documented
   2.109 +     */
   2.110 +    protected abstract void addProfilePackagesList(Profiles profiles, String text,
   2.111 +            String tableSummary, Content body, String profileName);
   2.112 +
   2.113 +    /**
   2.114 +     * Generate and prints the contents in the profile index file. Call appropriate
   2.115 +     * methods from the sub-class in order to generate Frame or Non
   2.116 +     * Frame format.
   2.117 +     *
   2.118 +     * @param title the title of the window.
   2.119 +     * @param includeScript boolean set true if windowtitle script is to be included
   2.120 +     */
   2.121 +    protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
   2.122 +        String windowOverview = configuration.getText(title);
   2.123 +        Content body = getBody(includeScript, getWindowTitle(windowOverview));
   2.124 +        addNavigationBarHeader(body);
   2.125 +        addOverviewHeader(body);
   2.126 +        addIndex(body);
   2.127 +        addOverview(body);
   2.128 +        addNavigationBarFooter(body);
   2.129 +        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
   2.130 +                configuration.doctitle), includeScript, body);
   2.131 +    }
   2.132 +
   2.133 +    /**
   2.134 +     * Generate and prints the contents in the profile packages index file. Call appropriate
   2.135 +     * methods from the sub-class in order to generate Frame or Non
   2.136 +     * Frame format.
   2.137 +     *
   2.138 +     * @param title the title of the window.
   2.139 +     * @param includeScript boolean set true if windowtitle script is to be included
   2.140 +     * @param profileName the name of the profile being documented
   2.141 +     */
   2.142 +    protected void buildProfilePackagesIndexFile(String title,
   2.143 +            boolean includeScript, String profileName) throws IOException {
   2.144 +        String windowOverview = configuration.getText(title);
   2.145 +        Content body = getBody(includeScript, getWindowTitle(windowOverview));
   2.146 +        addNavigationBarHeader(body);
   2.147 +        addOverviewHeader(body);
   2.148 +        addProfilePackagesIndex(body, profileName);
   2.149 +        addOverview(body);
   2.150 +        addNavigationBarFooter(body);
   2.151 +        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
   2.152 +                configuration.doctitle), includeScript, body);
   2.153 +    }
   2.154 +
   2.155 +    /**
   2.156 +     * Default to no overview, override to add overview.
   2.157 +     *
   2.158 +     * @param body the document tree to which the overview will be added
   2.159 +     */
   2.160 +    protected void addOverview(Content body) throws IOException {
   2.161 +    }
   2.162 +
   2.163 +    /**
   2.164 +     * Adds the frame or non-frame profile index to the documentation tree.
   2.165 +     *
   2.166 +     * @param body the document tree to which the index will be added
   2.167 +     */
   2.168 +    protected void addIndex(Content body) {
   2.169 +        addIndexContents(profiles, "doclet.Profile_Summary",
   2.170 +                configuration.getText("doclet.Member_Table_Summary",
   2.171 +                configuration.getText("doclet.Profile_Summary"),
   2.172 +                configuration.getText("doclet.profiles")), body);
   2.173 +    }
   2.174 +
   2.175 +    /**
   2.176 +     * Adds the frame or non-frame profile packages index to the documentation tree.
   2.177 +     *
   2.178 +     * @param body the document tree to which the index will be added
   2.179 +     * @param profileName  the name of the profile being documented
   2.180 +     */
   2.181 +    protected void addProfilePackagesIndex(Content body, String profileName) {
   2.182 +        addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
   2.183 +                configuration.getText("doclet.Member_Table_Summary",
   2.184 +                configuration.getText("doclet.Profile_Summary"),
   2.185 +                configuration.getText("doclet.profiles")), body, profileName);
   2.186 +    }
   2.187 +
   2.188 +    /**
   2.189 +     * Adds profile index contents. Call appropriate methods from
   2.190 +     * the sub-classes. Adds it to the body HtmlTree
   2.191 +     *
   2.192 +     * @param profiles profiles to be documented
   2.193 +     * @param text string which will be used as the heading
   2.194 +     * @param tableSummary summary for the table
   2.195 +     * @param body the document tree to which the index contents will be added
   2.196 +     */
   2.197 +    protected void addIndexContents(Profiles profiles, String text,
   2.198 +            String tableSummary, Content body) {
   2.199 +        if (profiles.getProfileCount() > 0) {
   2.200 +            HtmlTree div = new HtmlTree(HtmlTag.DIV);
   2.201 +            div.addStyle(HtmlStyle.indexHeader);
   2.202 +            addAllClassesLink(div);
   2.203 +            addAllPackagesLink(div);
   2.204 +            body.addContent(div);
   2.205 +            addProfilesList(profiles, text, tableSummary, body);
   2.206 +        }
   2.207 +    }
   2.208 +
   2.209 +    /**
   2.210 +     * Adds profile packages index contents. Call appropriate methods from
   2.211 +     * the sub-classes. Adds it to the body HtmlTree
   2.212 +     *
   2.213 +     * @param profiles profiles to be documented
   2.214 +     * @param text string which will be used as the heading
   2.215 +     * @param tableSummary summary for the table
   2.216 +     * @param body the document tree to which the index contents will be added
   2.217 +     * @param profileName the name of the profile being documented
   2.218 +     */
   2.219 +    protected void addProfilePackagesIndexContents(Profiles profiles, String text,
   2.220 +            String tableSummary, Content body, String profileName) {
   2.221 +        HtmlTree div = new HtmlTree(HtmlTag.DIV);
   2.222 +        div.addStyle(HtmlStyle.indexHeader);
   2.223 +        addAllClassesLink(div);
   2.224 +        addAllPackagesLink(div);
   2.225 +        addAllProfilesLink(div);
   2.226 +        body.addContent(div);
   2.227 +        addProfilePackagesList(profiles, text, tableSummary, body, profileName);
   2.228 +    }
   2.229 +
   2.230 +    /**
   2.231 +     * Adds the doctitle to the documentation tree, if it is specified on the command line.
   2.232 +     *
   2.233 +     * @param body the document tree to which the title will be added
   2.234 +     */
   2.235 +    protected void addConfigurationTitle(Content body) {
   2.236 +        if (configuration.doctitle.length() > 0) {
   2.237 +            Content title = new RawHtml(configuration.doctitle);
   2.238 +            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
   2.239 +                    HtmlStyle.title, title);
   2.240 +            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
   2.241 +            body.addContent(div);
   2.242 +        }
   2.243 +    }
   2.244 +
   2.245 +    /**
   2.246 +     * Returns highlighted "Overview", in the navigation bar as this is the
   2.247 +     * overview page.
   2.248 +     *
   2.249 +     * @return a Content object to be added to the documentation tree
   2.250 +     */
   2.251 +    protected Content getNavLinkContents() {
   2.252 +        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
   2.253 +        return li;
   2.254 +    }
   2.255 +
   2.256 +    /**
   2.257 +     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
   2.258 +     *
   2.259 +     * @param div the document tree to which the all classes link will be added
   2.260 +     */
   2.261 +    protected void addAllClassesLink(Content div) {
   2.262 +    }
   2.263 +
   2.264 +    /**
   2.265 +     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
   2.266 +     *
   2.267 +     * @param div the document tree to which the all packages link will be added
   2.268 +     */
   2.269 +    protected void addAllPackagesLink(Content div) {
   2.270 +    }
   2.271 +
   2.272 +    /**
   2.273 +     * Do nothing. This will be overridden in ProfilePackageIndexFrameWriter.
   2.274 +     *
   2.275 +     * @param div the document tree to which the all profiles link will be added
   2.276 +     */
   2.277 +    protected void addAllProfilesLink(Content div) {
   2.278 +    }
   2.279 +}
     3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Feb 21 12:23:27 2013 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Feb 21 17:49:56 2013 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 1997, 2013, 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 @@ -25,10 +25,10 @@
    3.11  
    3.12  package com.sun.tools.doclets.formats.html;
    3.13  
    3.14 -import java.io.IOException;
    3.15  import java.util.*;
    3.16  
    3.17  import com.sun.javadoc.*;
    3.18 +import com.sun.tools.javac.jvm.Profile;
    3.19  import com.sun.tools.doclets.formats.html.markup.*;
    3.20  import com.sun.tools.doclets.internal.toolkit.*;
    3.21  import com.sun.tools.doclets.internal.toolkit.builders.*;
    3.22 @@ -165,6 +165,20 @@
    3.23          bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
    3.24          HtmlTree div = new HtmlTree(HtmlTag.DIV);
    3.25          div.addStyle(HtmlStyle.header);
    3.26 +        if (configuration.showProfiles) {
    3.27 +            String sep = "";
    3.28 +            int profile = configuration.profiles.getProfile(getTypeNameForProfile(classDoc));
    3.29 +            if (profile > 0) {
    3.30 +                Content profNameContent = new StringContent();
    3.31 +                for (int i = profile; i < configuration.profiles.getProfileCount(); i++) {
    3.32 +                    profNameContent.addContent(sep);
    3.33 +                    profNameContent.addContent(Profile.lookup(i).name);
    3.34 +                    sep = ", ";
    3.35 +                }
    3.36 +                Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profNameContent);
    3.37 +                div.addContent(profileNameDiv);
    3.38 +            }
    3.39 +        }
    3.40          if (pkgname.length() > 0) {
    3.41              Content pkgNameContent = new StringContent(pkgname);
    3.42              Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
     4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Feb 21 12:23:27 2013 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Feb 21 17:49:56 2013 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -65,7 +65,7 @@
    4.11      public FrameOutputWriter(ConfigurationImpl configuration,
    4.12                               DocPath filename) throws IOException {
    4.13          super(configuration, filename);
    4.14 -    noOfPackages = configuration.packages.length;
    4.15 +        noOfPackages = configuration.packages.length;
    4.16      }
    4.17  
    4.18      /**
    4.19 @@ -135,7 +135,13 @@
    4.20      protected Content getFrameDetails() {
    4.21          HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
    4.22                  "top.loadFrames()");
    4.23 -        if (noOfPackages <= 1) {
    4.24 +        if (configuration.showProfiles) {
    4.25 +            HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
    4.26 +                "top.loadFrames()");
    4.27 +            addAllProfilesFrameTag(leftFrameset);
    4.28 +            addAllClassesFrameTag(leftFrameset);
    4.29 +            frameset.addContent(leftFrameset);
    4.30 +        } else if (noOfPackages <= 1) {
    4.31              addAllClassesFrameTag(frameset);
    4.32          } else if (noOfPackages > 1) {
    4.33              HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
    4.34 @@ -150,6 +156,17 @@
    4.35      }
    4.36  
    4.37      /**
    4.38 +     * Add the FRAME tag for the frame that lists all profiles.
    4.39 +     *
    4.40 +     * @param contentTree the content tree to which the information will be added
    4.41 +     */
    4.42 +    private void addAllProfilesFrameTag(Content contentTree) {
    4.43 +        HtmlTree frame = HtmlTree.FRAME(DocPaths.PROFILE_OVERVIEW_FRAME.getPath(),
    4.44 +                "profileListFrame", configuration.getText("doclet.All_Profiles"));
    4.45 +        contentTree.addContent(frame);
    4.46 +    }
    4.47 +
    4.48 +    /**
    4.49       * Add the FRAME tag for the frame that lists all packages.
    4.50       *
    4.51       * @param contentTree the content tree to which the information will be added
     5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Feb 21 12:23:27 2013 -0800
     5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Feb 21 17:49:56 2013 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 1997, 2013, 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 @@ -28,6 +28,8 @@
    5.11  import java.util.*;
    5.12  
    5.13  import com.sun.javadoc.*;
    5.14 +import com.sun.tools.javac.sym.Profiles;
    5.15 +import com.sun.tools.javac.jvm.Profile;
    5.16  import com.sun.tools.doclets.internal.toolkit.*;
    5.17  import com.sun.tools.doclets.internal.toolkit.builders.*;
    5.18  import com.sun.tools.doclets.internal.toolkit.util.*;
    5.19 @@ -202,6 +204,44 @@
    5.20      /**
    5.21       * {@inheritDoc}
    5.22       */
    5.23 +    protected void generateProfileFiles() throws Exception {
    5.24 +        if (configuration.showProfiles) {
    5.25 +            ProfileIndexFrameWriter.generate(configuration);
    5.26 +            Profile prevProfile = null, nextProfile;
    5.27 +            for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
    5.28 +                ProfilePackageIndexFrameWriter.generate(configuration, Profile.lookup(i).name);
    5.29 +                PackageDoc[] packages = configuration.profilePackages.get(
    5.30 +                        Profile.lookup(i).name);
    5.31 +                PackageDoc prev = null, next;
    5.32 +                for (int j = 0; j < packages.length; j++) {
    5.33 +                    // if -nodeprecated option is set and the package is marked as
    5.34 +                    // deprecated, do not generate the profilename-package-summary.html
    5.35 +                    // and profilename-package-frame.html pages for that package.
    5.36 +                    if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) {
    5.37 +                        ProfilePackageFrameWriter.generate(configuration, packages[j], i);
    5.38 +                        next = (j + 1 < packages.length
    5.39 +                                && packages[j + 1].name().length() > 0) ? packages[j + 1] : null;
    5.40 +                        AbstractBuilder profilePackageSummaryBuilder =
    5.41 +                                configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
    5.42 +                                packages[j], prev, next, Profile.lookup(i));
    5.43 +                        profilePackageSummaryBuilder.build();
    5.44 +                        prev = packages[j];
    5.45 +                    }
    5.46 +                }
    5.47 +                nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
    5.48 +                        Profile.lookup(i + 1) : null;
    5.49 +                AbstractBuilder profileSummaryBuilder =
    5.50 +                        configuration.getBuilderFactory().getProfileSummaryBuilder(
    5.51 +                        Profile.lookup(i), prevProfile, nextProfile);
    5.52 +                profileSummaryBuilder.build();
    5.53 +                prevProfile = Profile.lookup(i);
    5.54 +            }
    5.55 +        }
    5.56 +    }
    5.57 +
    5.58 +    /**
    5.59 +     * {@inheritDoc}
    5.60 +     */
    5.61      protected void generatePackageFiles(ClassTree classtree) throws Exception {
    5.62          PackageDoc[] packages = configuration.packages;
    5.63          if (packages.length > 1) {
     6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 21 12:23:27 2013 -0800
     6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 21 17:49:56 2013 -0800
     6.3 @@ -301,6 +301,107 @@
     6.4      }
     6.5  
     6.6      /**
     6.7 +     * Get Profile Package link, with target frame.
     6.8 +     *
     6.9 +     * @param pd the packageDoc object
    6.10 +     * @param target name of the target frame
    6.11 +     * @param label tag for the link
    6.12 +     * @param profileName the name of the profile being documented
    6.13 +     * @return a content for the target profile packages link
    6.14 +     */
    6.15 +    public Content getTargetProfilePackageLink(PackageDoc pd, String target,
    6.16 +            Content label, String profileName) {
    6.17 +        return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)),
    6.18 +                label, "", target);
    6.19 +    }
    6.20 +
    6.21 +    /**
    6.22 +     * Get Profile link, with target frame.
    6.23 +     *
    6.24 +     * @param target name of the target frame
    6.25 +     * @param label tag for the link
    6.26 +     * @param profileName the name of the profile being documented
    6.27 +     * @return a content for the target profile link
    6.28 +     */
    6.29 +    public Content getTargetProfileLink(String target, Content label,
    6.30 +            String profileName) {
    6.31 +        return getHyperLink(pathToRoot.resolve(
    6.32 +                DocPaths.profileSummary(profileName)), label, "", target);
    6.33 +    }
    6.34 +
    6.35 +    /**
    6.36 +     * Get the type name for profile search.
    6.37 +     *
    6.38 +     * @param cd the classDoc object for which the type name conversion is needed
    6.39 +     * @return a type name string for the type
    6.40 +     */
    6.41 +    public String getTypeNameForProfile(ClassDoc cd) {
    6.42 +        StringBuilder typeName =
    6.43 +                new StringBuilder((cd.containingPackage()).name().replace(".", "/"));
    6.44 +        typeName.append("/")
    6.45 +                .append(cd.name().replace(".", "$"));
    6.46 +        return typeName.toString();
    6.47 +    }
    6.48 +
    6.49 +    /**
    6.50 +     * Check if a type belongs to a profile.
    6.51 +     *
    6.52 +     * @param cd the classDoc object that needs to be checked
    6.53 +     * @param profileValue the profile in which the type needs to be checked
    6.54 +     * @return true if the type is in the profile
    6.55 +     */
    6.56 +    public boolean isTypeInProfile(ClassDoc cd, int profileValue) {
    6.57 +        return (configuration.profiles.getProfile(getTypeNameForProfile(cd)) <= profileValue);
    6.58 +    }
    6.59 +
    6.60 +    public void addClassesSummary(ClassDoc[] classes, String label,
    6.61 +            String tableSummary, String[] tableHeader, Content summaryContentTree,
    6.62 +            int profileValue) {
    6.63 +        if(classes.length > 0) {
    6.64 +            Arrays.sort(classes);
    6.65 +            Content caption = getTableCaption(label);
    6.66 +            Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
    6.67 +                    tableSummary, caption);
    6.68 +            table.addContent(getSummaryTableHeader(tableHeader, "col"));
    6.69 +            Content tbody = new HtmlTree(HtmlTag.TBODY);
    6.70 +            for (int i = 0; i < classes.length; i++) {
    6.71 +                if (!isTypeInProfile(classes[i], profileValue)) {
    6.72 +                    continue;
    6.73 +                }
    6.74 +                if (!Util.isCoreClass(classes[i]) ||
    6.75 +                    !configuration.isGeneratedDoc(classes[i])) {
    6.76 +                    continue;
    6.77 +                }
    6.78 +                Content classContent = new RawHtml(getLink(new LinkInfoImpl(
    6.79 +                        configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i],
    6.80 +                        false)));
    6.81 +                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
    6.82 +                HtmlTree tr = HtmlTree.TR(tdClass);
    6.83 +                if (i%2 == 0)
    6.84 +                    tr.addStyle(HtmlStyle.altColor);
    6.85 +                else
    6.86 +                    tr.addStyle(HtmlStyle.rowColor);
    6.87 +                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
    6.88 +                tdClassDescription.addStyle(HtmlStyle.colLast);
    6.89 +                if (Util.isDeprecated(classes[i])) {
    6.90 +                    tdClassDescription.addContent(deprecatedLabel);
    6.91 +                    if (classes[i].tags("deprecated").length > 0) {
    6.92 +                        addSummaryDeprecatedComment(classes[i],
    6.93 +                            classes[i].tags("deprecated")[0], tdClassDescription);
    6.94 +                    }
    6.95 +                }
    6.96 +                else
    6.97 +                    addSummaryComment(classes[i], tdClassDescription);
    6.98 +                tr.addContent(tdClassDescription);
    6.99 +                tbody.addContent(tr);
   6.100 +            }
   6.101 +            table.addContent(tbody);
   6.102 +            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
   6.103 +            summaryContentTree.addContent(li);
   6.104 +        }
   6.105 +    }
   6.106 +
   6.107 +    /**
   6.108       * Generates the HTML document tree and prints it out.
   6.109       *
   6.110       * @param metakeywords Array of String keywords for META tag. Each element
     7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Thu Feb 21 12:23:27 2013 -0800
     7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -145,13 +145,26 @@
    7.11       * Adds "All Classes" link for the top of the left-hand frame page to the
    7.12       * documentation tree.
    7.13       *
    7.14 -     * @param body the Content object to which the all classes link should be added
    7.15 +     * @param div the Content object to which the all classes link should be added
    7.16       */
    7.17 -    protected void addAllClassesLink(Content body) {
    7.18 +    protected void addAllClassesLink(Content div) {
    7.19          Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
    7.20                  allclassesLabel, "", "packageFrame");
    7.21 -        Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
    7.22 -        body.addContent(div);
    7.23 +        Content span = HtmlTree.SPAN(linkContent);
    7.24 +        div.addContent(span);
    7.25 +    }
    7.26 +
    7.27 +    /**
    7.28 +     * Adds "All Profiles" link for the top of the left-hand frame page to the
    7.29 +     * documentation tree.
    7.30 +     *
    7.31 +     * @param div the Content object to which the all profiles link should be added
    7.32 +     */
    7.33 +    protected void addAllProfilesLink(Content div) {
    7.34 +        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
    7.35 +                allprofilesLabel, "", "profileListFrame");
    7.36 +        Content span = HtmlTree.SPAN(linkContent);
    7.37 +        div.addContent(span);
    7.38      }
    7.39  
    7.40      /**
     8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 21 12:23:27 2013 -0800
     8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 21 17:49:56 2013 -0800
     8.3 @@ -29,6 +29,7 @@
     8.4  import java.util.*;
     8.5  
     8.6  import com.sun.javadoc.*;
     8.7 +import com.sun.tools.javac.jvm.Profile;
     8.8  import com.sun.tools.doclets.formats.html.markup.*;
     8.9  import com.sun.tools.doclets.internal.toolkit.*;
    8.10  import com.sun.tools.doclets.internal.toolkit.util.*;
    8.11 @@ -122,6 +123,21 @@
    8.12      /**
    8.13       * {@inheritDoc}
    8.14       */
    8.15 +    protected void addProfilesList(String profileSummary, String profilesTableSummary,
    8.16 +            Content body) {
    8.17 +        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
    8.18 +                getTableCaption(profileSummary));
    8.19 +        table.addContent(getSummaryTableHeader(profileTableHeader, "col"));
    8.20 +        Content tbody = new HtmlTree(HtmlTag.TBODY);
    8.21 +        addProfilesList(tbody);
    8.22 +        table.addContent(tbody);
    8.23 +        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
    8.24 +        body.addContent(div);
    8.25 +    }
    8.26 +
    8.27 +    /**
    8.28 +     * {@inheritDoc}
    8.29 +     */
    8.30      protected void addPackagesList(PackageDoc[] packages, String text,
    8.31              String tableSummary, Content body) {
    8.32          Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
    8.33 @@ -135,6 +151,31 @@
    8.34      }
    8.35  
    8.36      /**
    8.37 +     * Adds list of profiles in the index table. Generate link to each profile.
    8.38 +     *
    8.39 +     * @param tbody the documentation tree to which the list will be added
    8.40 +     */
    8.41 +    protected void addProfilesList(Content tbody) {
    8.42 +        for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
    8.43 +            String profileName = Profile.lookup(i).name;
    8.44 +            Content profileLinkContent = getTargetProfileLink("classFrame",
    8.45 +                    new StringContent(profileName), profileName);
    8.46 +            Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent);
    8.47 +            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
    8.48 +            tdSummary.addStyle(HtmlStyle.colLast);
    8.49 +            tdSummary.addContent(getSpace());
    8.50 +            HtmlTree tr = HtmlTree.TR(tdProfile);
    8.51 +            tr.addContent(tdSummary);
    8.52 +            if (i % 2 == 0) {
    8.53 +                tr.addStyle(HtmlStyle.altColor);
    8.54 +            } else {
    8.55 +                tr.addStyle(HtmlStyle.rowColor);
    8.56 +            }
    8.57 +            tbody.addContent(tr);
    8.58 +        }
    8.59 +    }
    8.60 +
    8.61 +    /**
    8.62       * Adds list of packages in the index table. Generate link to each package.
    8.63       *
    8.64       * @param packages Packages to which link is to be generated
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
     9.3 @@ -0,0 +1,173 @@
     9.4 +/*
     9.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.  Oracle designates this
    9.11 + * particular file as subject to the "Classpath" exception as provided
    9.12 + * by Oracle in the LICENSE file that accompanied this code.
    9.13 + *
    9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 + * version 2 for more details (a copy is included in the LICENSE file that
    9.18 + * accompanied this code).
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License version
    9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 + *
    9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.25 + * or visit www.oracle.com if you need additional information or have any
    9.26 + * questions.
    9.27 + */
    9.28 +
    9.29 +package com.sun.tools.doclets.formats.html;
    9.30 +
    9.31 +import java.io.*;
    9.32 +
    9.33 +import com.sun.tools.javac.sym.Profiles;
    9.34 +import com.sun.tools.doclets.formats.html.markup.*;
    9.35 +import com.sun.tools.doclets.internal.toolkit.*;
    9.36 +import com.sun.tools.doclets.internal.toolkit.util.*;
    9.37 +import com.sun.tools.javac.jvm.Profile;
    9.38 +
    9.39 +/**
    9.40 + * Generate the profile index for the left-hand frame in the generated output.
    9.41 + * A click on the profile name in this frame will update the page in the top
    9.42 + * left hand frame with the listing of packages of the clicked profile.
    9.43 + *
    9.44 + *  <p><b>This is NOT part of any supported API.
    9.45 + *  If you write code that depends on this, you do so at your own risk.
    9.46 + *  This code and its internal interfaces are subject to change or
    9.47 + *  deletion without notice.</b>
    9.48 + *
    9.49 + * @author Bhavesh Patel
    9.50 + */
    9.51 +public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
    9.52 +
    9.53 +    /**
    9.54 +     * Construct the ProfileIndexFrameWriter object.
    9.55 +     *
    9.56 +     * @param configuration the configuration object
    9.57 +     * @param filename Name of the profile index file to be generated.
    9.58 +     */
    9.59 +    public ProfileIndexFrameWriter(ConfigurationImpl configuration,
    9.60 +                                   DocPath filename) throws IOException {
    9.61 +        super(configuration, filename);
    9.62 +    }
    9.63 +
    9.64 +    /**
    9.65 +     * Generate the profile index file named "profile-overview-frame.html".
    9.66 +     * @throws DocletAbortException
    9.67 +     * @param configuration the configuration object
    9.68 +     */
    9.69 +    public static void generate(ConfigurationImpl configuration) {
    9.70 +        ProfileIndexFrameWriter profilegen;
    9.71 +        DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME;
    9.72 +        try {
    9.73 +            profilegen = new ProfileIndexFrameWriter(configuration, filename);
    9.74 +            profilegen.buildProfileIndexFile("doclet.Window_Overview", false);
    9.75 +            profilegen.close();
    9.76 +        } catch (IOException exc) {
    9.77 +            configuration.standardmessage.error(
    9.78 +                        "doclet.exception_encountered",
    9.79 +                        exc.toString(), filename);
    9.80 +            throw new DocletAbortException();
    9.81 +        }
    9.82 +    }
    9.83 +
    9.84 +    /**
    9.85 +     * {@inheritDoc}
    9.86 +     */
    9.87 +    protected void addProfilesList(Profiles profiles, String text,
    9.88 +            String tableSummary, Content body) {
    9.89 +        Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
    9.90 +                profilesLabel);
    9.91 +        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
    9.92 +        HtmlTree ul = new HtmlTree(HtmlTag.UL);
    9.93 +        ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString());
    9.94 +        for (int i = 1; i < profiles.getProfileCount(); i++) {
    9.95 +            ul.addContent(getProfile(i));
    9.96 +        }
    9.97 +        div.addContent(ul);
    9.98 +        body.addContent(div);
    9.99 +    }
   9.100 +
   9.101 +    /**
   9.102 +     * Gets each profile name as a separate link.
   9.103 +     *
   9.104 +     * @param profile the profile being documented
   9.105 +     * @return content for the profile link
   9.106 +     */
   9.107 +    protected Content getProfile(int profile) {
   9.108 +        Content profileLinkContent;
   9.109 +        Content profileLabel;
   9.110 +        String profileName = (Profile.lookup(profile)).name;
   9.111 +        profileLabel = new StringContent(profileName);
   9.112 +        profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
   9.113 +                    "profileListFrame");
   9.114 +        Content li = HtmlTree.LI(profileLinkContent);
   9.115 +        return li;
   9.116 +    }
   9.117 +
   9.118 +    /**
   9.119 +     * {@inheritDoc}
   9.120 +     */
   9.121 +    protected void addNavigationBarHeader(Content body) {
   9.122 +        Content headerContent;
   9.123 +        if (configuration.packagesheader.length() > 0) {
   9.124 +            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
   9.125 +        } else {
   9.126 +            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
   9.127 +        }
   9.128 +        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
   9.129 +                HtmlStyle.bar, headerContent);
   9.130 +        body.addContent(heading);
   9.131 +    }
   9.132 +
   9.133 +    /**
   9.134 +     * Do nothing as there is no overview information in this page.
   9.135 +     */
   9.136 +    protected void addOverviewHeader(Content body) {
   9.137 +    }
   9.138 +
   9.139 +    /**
   9.140 +     * Adds "All Classes" link for the top of the left-hand frame page to the
   9.141 +     * documentation tree.
   9.142 +     *
   9.143 +     * @param div the Content object to which the all classes link should be added
   9.144 +     */
   9.145 +    protected void addAllClassesLink(Content div) {
   9.146 +        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
   9.147 +                allclassesLabel, "", "packageFrame");
   9.148 +        Content span = HtmlTree.SPAN(linkContent);
   9.149 +        div.addContent(span);
   9.150 +    }
   9.151 +
   9.152 +    /**
   9.153 +     * Adds "All Packages" link for the top of the left-hand frame page to the
   9.154 +     * documentation tree.
   9.155 +     *
   9.156 +     * @param div the Content object to which the all packages link should be added
   9.157 +     */
   9.158 +    protected void addAllPackagesLink(Content div) {
   9.159 +        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
   9.160 +                allpackagesLabel, "", "profileListFrame");
   9.161 +        Content span = HtmlTree.SPAN(linkContent);
   9.162 +        div.addContent(span);
   9.163 +    }
   9.164 +
   9.165 +    /**
   9.166 +     * {@inheritDoc}
   9.167 +     */
   9.168 +    protected void addNavigationBarFooter(Content body) {
   9.169 +        Content p = HtmlTree.P(getSpace());
   9.170 +        body.addContent(p);
   9.171 +    }
   9.172 +
   9.173 +    protected void addProfilePackagesList(Profiles profiles, String text,
   9.174 +            String tableSummary, Content body, String profileName) {
   9.175 +    }
   9.176 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
    10.3 @@ -0,0 +1,186 @@
    10.4 +/*
    10.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 + *
    10.8 + * This code is free software; you can redistribute it and/or modify it
    10.9 + * under the terms of the GNU General Public License version 2 only, as
   10.10 + * published by the Free Software Foundation.  Oracle designates this
   10.11 + * particular file as subject to the "Classpath" exception as provided
   10.12 + * by Oracle in the LICENSE file that accompanied this code.
   10.13 + *
   10.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   10.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.17 + * version 2 for more details (a copy is included in the LICENSE file that
   10.18 + * accompanied this code).
   10.19 + *
   10.20 + * You should have received a copy of the GNU General Public License version
   10.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   10.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.23 + *
   10.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.25 + * or visit www.oracle.com if you need additional information or have any
   10.26 + * questions.
   10.27 + */
   10.28 +
   10.29 +package com.sun.tools.doclets.formats.html;
   10.30 +
   10.31 +import java.io.*;
   10.32 +import java.util.*;
   10.33 +
   10.34 +import com.sun.javadoc.*;
   10.35 +import com.sun.tools.javac.jvm.Profile;
   10.36 +import com.sun.tools.doclets.formats.html.markup.*;
   10.37 +import com.sun.tools.doclets.internal.toolkit.*;
   10.38 +import com.sun.tools.doclets.internal.toolkit.util.*;
   10.39 +
   10.40 +/**
   10.41 + * Class to generate file for each package contents of a profile in the left-hand bottom
   10.42 + * frame. This will list all the Class Kinds in the package for a profile. A click on any
   10.43 + * class-kind will update the right-hand frame with the clicked class-kind page.
   10.44 + *
   10.45 + *  <p><b>This is NOT part of any supported API.
   10.46 + *  If you write code that depends on this, you do so at your own risk.
   10.47 + *  This code and its internal interfaces are subject to change or
   10.48 + *  deletion without notice.</b>
   10.49 + *
   10.50 + * @author Bhavesh Patel
   10.51 + */
   10.52 +public class ProfilePackageFrameWriter extends HtmlDocletWriter {
   10.53 +
   10.54 +    /**
   10.55 +     * The package being documented.
   10.56 +     */
   10.57 +    private PackageDoc packageDoc;
   10.58 +
   10.59 +    /**
   10.60 +     * Constructor to construct ProfilePackageFrameWriter object and to generate
   10.61 +     * "profilename-package-frame.html" file in the respective package directory.
   10.62 +     * For example for profile compact1 and package "java.lang" this will generate file
   10.63 +     * "compact1-package-frame.html" file in the "java/lang" directory. It will also
   10.64 +     * create "java/lang" directory in the current or the destination directory
   10.65 +     * if it doesn't exist.
   10.66 +     *
   10.67 +     * @param configuration the configuration of the doclet.
   10.68 +     * @param packageDoc PackageDoc under consideration.
   10.69 +     * @param profileName the name of the profile being documented
   10.70 +     */
   10.71 +    public ProfilePackageFrameWriter(ConfigurationImpl configuration,
   10.72 +            PackageDoc packageDoc, String profileName)
   10.73 +            throws IOException {
   10.74 +        super(configuration, DocPath.forPackage(packageDoc).resolve(
   10.75 +                DocPaths.profilePackageFrame(profileName)));
   10.76 +        this.packageDoc = packageDoc;
   10.77 +    }
   10.78 +
   10.79 +    /**
   10.80 +     * Generate a profile package summary page for the left-hand bottom frame. Construct
   10.81 +     * the ProfilePackageFrameWriter object and then uses it generate the file.
   10.82 +     *
   10.83 +     * @param configuration the current configuration of the doclet.
   10.84 +     * @param packageDoc The package for which "profilename-package-frame.html" is to be generated.
   10.85 +     * @param profileValue the value of the profile being documented
   10.86 +     */
   10.87 +    public static void generate(ConfigurationImpl configuration,
   10.88 +            PackageDoc packageDoc, int profileValue) {
   10.89 +        ProfilePackageFrameWriter profpackgen;
   10.90 +        try {
   10.91 +            String profileName = Profile.lookup(profileValue).name;
   10.92 +            profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc,
   10.93 +                    profileName);
   10.94 +            StringBuilder winTitle = new StringBuilder(profileName);
   10.95 +            String sep = " - ";
   10.96 +            winTitle.append(sep);
   10.97 +            String pkgName = Util.getPackageName(packageDoc);
   10.98 +            winTitle.append(pkgName);
   10.99 +            Content body = profpackgen.getBody(false,
  10.100 +                    profpackgen.getWindowTitle(winTitle.toString()));
  10.101 +            Content profName = new StringContent(profileName);
  10.102 +            Content sepContent = new StringContent(sep);
  10.103 +            Content pkgNameContent = new RawHtml(pkgName);
  10.104 +            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
  10.105 +                    profpackgen.getTargetProfileLink("classFrame", profName, profileName));
  10.106 +            heading.addContent(sepContent);
  10.107 +            heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
  10.108 +                    "classFrame", pkgNameContent, profileName));
  10.109 +            body.addContent(heading);
  10.110 +            HtmlTree div = new HtmlTree(HtmlTag.DIV);
  10.111 +            div.addStyle(HtmlStyle.indexContainer);
  10.112 +            profpackgen.addClassListing(div, profileValue);
  10.113 +            body.addContent(div);
  10.114 +            profpackgen.printHtmlDocument(
  10.115 +                    configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
  10.116 +            profpackgen.close();
  10.117 +        } catch (IOException exc) {
  10.118 +            configuration.standardmessage.error(
  10.119 +                    "doclet.exception_encountered",
  10.120 +                    exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
  10.121 +            throw new DocletAbortException();
  10.122 +        }
  10.123 +    }
  10.124 +
  10.125 +    /**
  10.126 +     * Add class listing for all the classes in this package. Divide class
  10.127 +     * listing as per the class kind and generate separate listing for
  10.128 +     * Classes, Interfaces, Exceptions and Errors.
  10.129 +     *
  10.130 +     * @param contentTree the content tree to which the listing will be added
  10.131 +     * @param profileValue the value of the profile being documented
  10.132 +     */
  10.133 +    protected void addClassListing(Content contentTree, int profileValue) {
  10.134 +        if (packageDoc.isIncluded()) {
  10.135 +            addClassKindListing(packageDoc.interfaces(),
  10.136 +                getResource("doclet.Interfaces"), contentTree, profileValue);
  10.137 +            addClassKindListing(packageDoc.ordinaryClasses(),
  10.138 +                getResource("doclet.Classes"), contentTree, profileValue);
  10.139 +            addClassKindListing(packageDoc.enums(),
  10.140 +                getResource("doclet.Enums"), contentTree, profileValue);
  10.141 +            addClassKindListing(packageDoc.exceptions(),
  10.142 +                getResource("doclet.Exceptions"), contentTree, profileValue);
  10.143 +            addClassKindListing(packageDoc.errors(),
  10.144 +                getResource("doclet.Errors"), contentTree, profileValue);
  10.145 +            addClassKindListing(packageDoc.annotationTypes(),
  10.146 +                getResource("doclet.AnnotationTypes"), contentTree, profileValue);
  10.147 +        }
  10.148 +    }
  10.149 +
  10.150 +    /**
  10.151 +     * Add specific class kind listing. Also add label to the listing.
  10.152 +     *
  10.153 +     * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
  10.154 +     * @param labelContent content tree of the label to be added
  10.155 +     * @param contentTree the content tree to which the class kind listing will be added
  10.156 +     * @param profileValue the value of the profile being documented
  10.157 +     */
  10.158 +    protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
  10.159 +            Content contentTree, int profileValue) {
  10.160 +        if(arr.length > 0) {
  10.161 +            Arrays.sort(arr);
  10.162 +            boolean printedHeader = false;
  10.163 +            HtmlTree ul = new HtmlTree(HtmlTag.UL);
  10.164 +            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
  10.165 +            for (int i = 0; i < arr.length; i++) {
  10.166 +                if (!isTypeInProfile(arr[i], profileValue)) {
  10.167 +                    continue;
  10.168 +                }
  10.169 +                if (!Util.isCoreClass(arr[i]) || !
  10.170 +                        configuration.isGeneratedDoc(arr[i])) {
  10.171 +                    continue;
  10.172 +                }
  10.173 +                if (!printedHeader) {
  10.174 +                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
  10.175 +                            true, labelContent);
  10.176 +                    contentTree.addContent(heading);
  10.177 +                    printedHeader = true;
  10.178 +                }
  10.179 +                Content link = new RawHtml (getLink(new LinkInfoImpl(configuration,
  10.180 +                        LinkInfoImpl.PACKAGE_FRAME, arr[i],
  10.181 +                        (arr[i].isInterface() ? italicsText(arr[i].name()) :
  10.182 +                            arr[i].name()),"classFrame")));
  10.183 +                Content li = HtmlTree.LI(link);
  10.184 +                ul.addContent(li);
  10.185 +            }
  10.186 +            contentTree.addContent(ul);
  10.187 +        }
  10.188 +    }
  10.189 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
    11.3 @@ -0,0 +1,200 @@
    11.4 +/*
    11.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.  Oracle designates this
   11.11 + * particular file as subject to the "Classpath" exception as provided
   11.12 + * by Oracle in the LICENSE file that accompanied this code.
   11.13 + *
   11.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.17 + * version 2 for more details (a copy is included in the LICENSE file that
   11.18 + * accompanied this code).
   11.19 + *
   11.20 + * You should have received a copy of the GNU General Public License version
   11.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.23 + *
   11.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.25 + * or visit www.oracle.com if you need additional information or have any
   11.26 + * questions.
   11.27 + */
   11.28 +
   11.29 +package com.sun.tools.doclets.formats.html;
   11.30 +
   11.31 +import java.io.*;
   11.32 +
   11.33 +import com.sun.javadoc.*;
   11.34 +import com.sun.tools.javac.sym.Profiles;
   11.35 +import com.sun.tools.doclets.formats.html.markup.*;
   11.36 +import com.sun.tools.doclets.internal.toolkit.*;
   11.37 +import com.sun.tools.doclets.internal.toolkit.util.*;
   11.38 +
   11.39 +/**
   11.40 + * Generate the profile package index for the left-hand frame in the generated output.
   11.41 + * A click on the package name in this frame will update the page in the bottom
   11.42 + * left hand frame with the listing of contents of the clicked profile package.
   11.43 + *
   11.44 + *  <p><b>This is NOT part of any supported API.
   11.45 + *  If you write code that depends on this, you do so at your own risk.
   11.46 + *  This code and its internal interfaces are subject to change or
   11.47 + *  deletion without notice.</b>
   11.48 + *
   11.49 + * @author Bhavesh Patel
   11.50 + */
   11.51 +public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
   11.52 +
   11.53 +    /**
   11.54 +     * Construct the ProfilePackageIndexFrameWriter object.
   11.55 +     *
   11.56 +     * @param configuration the configuration object
   11.57 +     * @param filename Name of the package index file to be generated.
   11.58 +     */
   11.59 +    public ProfilePackageIndexFrameWriter(ConfigurationImpl configuration,
   11.60 +                                   DocPath filename) throws IOException {
   11.61 +        super(configuration, filename);
   11.62 +    }
   11.63 +
   11.64 +    /**
   11.65 +     * Generate the profile package index file.
   11.66 +     * @throws DocletAbortException
   11.67 +     * @param configuration the configuration object
   11.68 +     * @param profileName the name of the profile being documented
   11.69 +     */
   11.70 +    public static void generate(ConfigurationImpl configuration, String profileName) {
   11.71 +        ProfilePackageIndexFrameWriter profpackgen;
   11.72 +        DocPath filename = DocPaths.profileFrame(profileName);
   11.73 +        try {
   11.74 +            profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename);
   11.75 +            profpackgen.buildProfilePackagesIndexFile("doclet.Window_Overview", false, profileName);
   11.76 +            profpackgen.close();
   11.77 +        } catch (IOException exc) {
   11.78 +            configuration.standardmessage.error(
   11.79 +                        "doclet.exception_encountered",
   11.80 +                        exc.toString(), filename);
   11.81 +            throw new DocletAbortException();
   11.82 +        }
   11.83 +    }
   11.84 +
   11.85 +    /**
   11.86 +     * {@inheritDoc}
   11.87 +     */
   11.88 +    protected void addProfilePackagesList(Profiles profiles, String text,
   11.89 +            String tableSummary, Content body, String profileName) {
   11.90 +        Content profNameContent = new StringContent(profileName);
   11.91 +        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
   11.92 +                getTargetProfileLink("classFrame", profNameContent, profileName));
   11.93 +        heading.addContent(getSpace());
   11.94 +        heading.addContent(packagesLabel);
   11.95 +        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
   11.96 +        HtmlTree ul = new HtmlTree(HtmlTag.UL);
   11.97 +        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
   11.98 +        PackageDoc[] packages = configuration.profilePackages.get(profileName);
   11.99 +        for (int i = 0; i < packages.length; i++) {
  11.100 +            if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
  11.101 +                ul.addContent(getPackage(packages[i], profileName));
  11.102 +            }
  11.103 +        }
  11.104 +        div.addContent(ul);
  11.105 +        body.addContent(div);
  11.106 +    }
  11.107 +
  11.108 +    /**
  11.109 +     * Gets each package name as a separate link.
  11.110 +     *
  11.111 +     * @param pd PackageDoc
  11.112 +     * @param profileName the name of the profile being documented
  11.113 +     * @return content for the package link
  11.114 +     */
  11.115 +    protected Content getPackage(PackageDoc pd, String profileName) {
  11.116 +        Content packageLinkContent;
  11.117 +        Content pkgLabel;
  11.118 +        if (pd.name().length() > 0) {
  11.119 +            pkgLabel = getPackageLabel(pd.name());
  11.120 +            packageLinkContent = getHyperLink(pathString(pd,
  11.121 +                     DocPaths.profilePackageFrame(profileName)), pkgLabel, "",
  11.122 +                    "packageFrame");
  11.123 +        } else {
  11.124 +            pkgLabel = new RawHtml("&lt;unnamed package&gt;");
  11.125 +            packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
  11.126 +                    pkgLabel, "", "packageFrame");
  11.127 +        }
  11.128 +        Content li = HtmlTree.LI(packageLinkContent);
  11.129 +        return li;
  11.130 +    }
  11.131 +
  11.132 +    /**
  11.133 +     * {@inheritDoc}
  11.134 +     */
  11.135 +    protected void addNavigationBarHeader(Content body) {
  11.136 +        Content headerContent;
  11.137 +        if (configuration.packagesheader.length() > 0) {
  11.138 +            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
  11.139 +        } else {
  11.140 +            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
  11.141 +        }
  11.142 +        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
  11.143 +                HtmlStyle.bar, headerContent);
  11.144 +        body.addContent(heading);
  11.145 +    }
  11.146 +
  11.147 +    /**
  11.148 +     * Do nothing as there is no overview information in this page.
  11.149 +     */
  11.150 +    protected void addOverviewHeader(Content body) {
  11.151 +    }
  11.152 +
  11.153 +    protected void addProfilesList(Profiles profiles, String text,
  11.154 +            String tableSummary, Content body) {
  11.155 +    }
  11.156 +
  11.157 +    /**
  11.158 +     * Adds "All Classes" link for the top of the left-hand frame page to the
  11.159 +     * documentation tree.
  11.160 +     *
  11.161 +     * @param div the Content object to which the all classes link should be added
  11.162 +     */
  11.163 +    protected void addAllClassesLink(Content div) {
  11.164 +        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
  11.165 +                allclassesLabel, "", "packageFrame");
  11.166 +        Content span = HtmlTree.SPAN(linkContent);
  11.167 +        div.addContent(span);
  11.168 +    }
  11.169 +
  11.170 +    /**
  11.171 +     * Adds "All Packages" link for the top of the left-hand frame page to the
  11.172 +     * documentation tree.
  11.173 +     *
  11.174 +     * @param div the Content object to which the all packages link should be added
  11.175 +     */
  11.176 +    protected void addAllPackagesLink(Content div) {
  11.177 +        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
  11.178 +                allpackagesLabel, "", "profileListFrame");
  11.179 +        Content span = HtmlTree.SPAN(linkContent);
  11.180 +        div.addContent(span);
  11.181 +    }
  11.182 +
  11.183 +    /**
  11.184 +     * Adds "All Profiles" link for the top of the left-hand frame page to the
  11.185 +     * documentation tree.
  11.186 +     *
  11.187 +     * @param div the Content object to which the all profiles link should be added
  11.188 +     */
  11.189 +    protected void addAllProfilesLink(Content div) {
  11.190 +        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
  11.191 +                allprofilesLabel, "", "profileListFrame");
  11.192 +        Content span = HtmlTree.SPAN(linkContent);
  11.193 +        div.addContent(span);
  11.194 +    }
  11.195 +
  11.196 +    /**
  11.197 +     * {@inheritDoc}
  11.198 +     */
  11.199 +    protected void addNavigationBarFooter(Content body) {
  11.200 +        Content p = HtmlTree.P(getSpace());
  11.201 +        body.addContent(p);
  11.202 +    }
  11.203 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Thu Feb 21 17:49:56 2013 -0800
    12.3 @@ -0,0 +1,296 @@
    12.4 +/*
    12.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 + *
    12.8 + * This code is free software; you can redistribute it and/or modify it
    12.9 + * under the terms of the GNU General Public License version 2 only, as
   12.10 + * published by the Free Software Foundation.  Oracle designates this
   12.11 + * particular file as subject to the "Classpath" exception as provided
   12.12 + * by Oracle in the LICENSE file that accompanied this code.
   12.13 + *
   12.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   12.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.17 + * version 2 for more details (a copy is included in the LICENSE file that
   12.18 + * accompanied this code).
   12.19 + *
   12.20 + * You should have received a copy of the GNU General Public License version
   12.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   12.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.23 + *
   12.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.25 + * or visit www.oracle.com if you need additional information or have any
   12.26 + * questions.
   12.27 + */
   12.28 +
   12.29 +package com.sun.tools.doclets.formats.html;
   12.30 +
   12.31 +import java.io.*;
   12.32 +import java.util.*;
   12.33 +
   12.34 +import com.sun.javadoc.*;
   12.35 +import com.sun.tools.javac.jvm.Profile;
   12.36 +import com.sun.tools.doclets.formats.html.markup.*;
   12.37 +import com.sun.tools.doclets.internal.toolkit.*;
   12.38 +import com.sun.tools.doclets.internal.toolkit.util.*;
   12.39 +
   12.40 +/**
   12.41 + * Class to generate file for each profile package contents in the right-hand
   12.42 + * frame. This will list all the Class Kinds in the package. A click on any
   12.43 + * class-kind will update the frame with the clicked class-kind page.
   12.44 + *
   12.45 + *  <p><b>This is NOT part of any supported API.
   12.46 + *  If you write code that depends on this, you do so at your own risk.
   12.47 + *  This code and its internal interfaces are subject to change or
   12.48 + *  deletion without notice.</b>
   12.49 + *
   12.50 + * @author Bhavesh Patel
   12.51 + */
   12.52 +public class ProfilePackageWriterImpl extends HtmlDocletWriter
   12.53 +    implements ProfilePackageSummaryWriter {
   12.54 +
   12.55 +    /**
   12.56 +     * The prev package name in the alpha-order list.
   12.57 +     */
   12.58 +    protected PackageDoc prev;
   12.59 +
   12.60 +    /**
   12.61 +     * The next package name in the alpha-order list.
   12.62 +     */
   12.63 +    protected PackageDoc next;
   12.64 +
   12.65 +    /**
   12.66 +     * The profile package being documented.
   12.67 +     */
   12.68 +    protected PackageDoc packageDoc;
   12.69 +
   12.70 +    /**
   12.71 +     * The name of the profile being documented.
   12.72 +     */
   12.73 +    protected String profileName;
   12.74 +
   12.75 +    /**
   12.76 +     * The value of the profile being documented.
   12.77 +     */
   12.78 +    protected int profileValue;
   12.79 +
   12.80 +    /**
   12.81 +     * Constructor to construct ProfilePackageWriter object and to generate
   12.82 +     * "profilename-package-summary.html" file in the respective package directory.
   12.83 +     * For example for profile compact1 and package "java.lang" this will generate file
   12.84 +     * "compact1-package-summary.html" file in the "java/lang" directory. It will also
   12.85 +     * create "java/lang" directory in the current or the destination directory
   12.86 +     * if it doesn't exist.
   12.87 +     *
   12.88 +     * @param configuration the configuration of the doclet.
   12.89 +     * @param packageDoc    PackageDoc under consideration.
   12.90 +     * @param prev          Previous package in the sorted array.
   12.91 +     * @param next          Next package in the sorted array.
   12.92 +     * @param profile       The profile being documented.
   12.93 +     */
   12.94 +    public ProfilePackageWriterImpl(ConfigurationImpl configuration,
   12.95 +            PackageDoc packageDoc, PackageDoc prev, PackageDoc next,
   12.96 +            Profile profile) throws IOException {
   12.97 +        super(configuration, DocPath.forPackage(packageDoc).resolve(
   12.98 +                DocPaths.profilePackageSummary(profile.name)));
   12.99 +        this.prev = prev;
  12.100 +        this.next = next;
  12.101 +        this.packageDoc = packageDoc;
  12.102 +        this.profileName = profile.name;
  12.103 +        this.profileValue = profile.value;
  12.104 +    }
  12.105 +
  12.106 +    /**
  12.107 +     * {@inheritDoc}
  12.108 +     */
  12.109 +    public Content getPackageHeader(String heading) {
  12.110 +        String pkgName = packageDoc.name();
  12.111 +        Content bodyTree = getBody(true, getWindowTitle(pkgName));
  12.112 +        addTop(bodyTree);
  12.113 +        addNavLinks(true, bodyTree);
  12.114 +        HtmlTree div = new HtmlTree(HtmlTag.DIV);
  12.115 +        div.addStyle(HtmlStyle.header);
  12.116 +        Content profileContent = new StringContent(profileName);
  12.117 +        Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent);
  12.118 +        div.addContent(profileNameDiv);
  12.119 +        Content annotationContent = new HtmlTree(HtmlTag.P);
  12.120 +        addAnnotationInfo(packageDoc, annotationContent);
  12.121 +        div.addContent(annotationContent);
  12.122 +        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
  12.123 +                HtmlStyle.title, packageLabel);
  12.124 +        tHeading.addContent(getSpace());
  12.125 +        Content packageHead = new RawHtml(heading);
  12.126 +        tHeading.addContent(packageHead);
  12.127 +        div.addContent(tHeading);
  12.128 +        addDeprecationInfo(div);
  12.129 +        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
  12.130 +            HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
  12.131 +            docSummaryDiv.addStyle(HtmlStyle.docSummary);
  12.132 +            addSummaryComment(packageDoc, docSummaryDiv);
  12.133 +            div.addContent(docSummaryDiv);
  12.134 +            Content space = getSpace();
  12.135 +            Content descLink = getHyperLink(DocLink.fragment("package_description"),
  12.136 +                    descriptionLabel, "", "");
  12.137 +            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
  12.138 +            div.addContent(descPara);
  12.139 +        }
  12.140 +        bodyTree.addContent(div);
  12.141 +        return bodyTree;
  12.142 +    }
  12.143 +
  12.144 +    /**
  12.145 +     * {@inheritDoc}
  12.146 +     */
  12.147 +    public Content getContentHeader() {
  12.148 +        HtmlTree div = new HtmlTree(HtmlTag.DIV);
  12.149 +        div.addStyle(HtmlStyle.contentContainer);
  12.150 +        return div;
  12.151 +    }
  12.152 +
  12.153 +    /**
  12.154 +     * Add the package deprecation information to the documentation tree.
  12.155 +     *
  12.156 +     * @param div the content tree to which the deprecation information will be added
  12.157 +     */
  12.158 +    public void addDeprecationInfo(Content div) {
  12.159 +        Tag[] deprs = packageDoc.tags("deprecated");
  12.160 +        if (Util.isDeprecated(packageDoc)) {
  12.161 +            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
  12.162 +            deprDiv.addStyle(HtmlStyle.deprecatedContent);
  12.163 +            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
  12.164 +            deprDiv.addContent(deprPhrase);
  12.165 +            if (deprs.length > 0) {
  12.166 +                Tag[] commentTags = deprs[0].inlineTags();
  12.167 +                if (commentTags.length > 0) {
  12.168 +                    addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
  12.169 +                }
  12.170 +            }
  12.171 +            div.addContent(deprDiv);
  12.172 +        }
  12.173 +    }
  12.174 +
  12.175 +    /**
  12.176 +     * {@inheritDoc}
  12.177 +     */
  12.178 +    public void addClassesSummary(ClassDoc[] classes, String label,
  12.179 +            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
  12.180 +        addClassesSummary(classes, label, tableSummary, tableHeader,
  12.181 +                packageSummaryContentTree, profileValue);
  12.182 +    }
  12.183 +
  12.184 +    /**
  12.185 +     * {@inheritDoc}
  12.186 +     */
  12.187 +    public Content getSummaryHeader() {
  12.188 +        HtmlTree ul = new HtmlTree(HtmlTag.UL);
  12.189 +        ul.addStyle(HtmlStyle.blockList);
  12.190 +        return ul;
  12.191 +    }
  12.192 +
  12.193 +    /**
  12.194 +     * {@inheritDoc}
  12.195 +     */
  12.196 +    public void addPackageDescription(Content packageContentTree) {
  12.197 +        if (packageDoc.inlineTags().length > 0) {
  12.198 +            packageContentTree.addContent(getMarkerAnchor("package_description"));
  12.199 +            Content h2Content = new StringContent(
  12.200 +                    configuration.getText("doclet.Package_Description",
  12.201 +                    packageDoc.name()));
  12.202 +            packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
  12.203 +                    true, h2Content));
  12.204 +            addInlineComment(packageDoc, packageContentTree);
  12.205 +        }
  12.206 +    }
  12.207 +
  12.208 +    /**
  12.209 +     * {@inheritDoc}
  12.210 +     */
  12.211 +    public void addPackageTags(Content packageContentTree) {
  12.212 +        addTagsInfo(packageDoc, packageContentTree);
  12.213 +    }
  12.214 +
  12.215 +    /**
  12.216 +     * {@inheritDoc}
  12.217 +     */
  12.218 +    public void addPackageFooter(Content contentTree) {
  12.219 +        addNavLinks(false, contentTree);
  12.220 +        addBottom(contentTree);
  12.221 +    }
  12.222 +
  12.223 +    /**
  12.224 +     * {@inheritDoc}
  12.225 +     */
  12.226 +    public void printDocument(Content contentTree) throws IOException {
  12.227 +        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
  12.228 +                true, contentTree);
  12.229 +    }
  12.230 +
  12.231 +    /**
  12.232 +     * Get "Use" link for this package in the navigation bar.
  12.233 +     *
  12.234 +     * @return a content tree for the class use link
  12.235 +     */
  12.236 +    protected Content getNavLinkClassUse() {
  12.237 +        Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
  12.238 +                useLabel, "", "");
  12.239 +        Content li = HtmlTree.LI(useLink);
  12.240 +        return li;
  12.241 +    }
  12.242 +
  12.243 +    /**
  12.244 +     * Get "PREV PACKAGE" link in the navigation bar.
  12.245 +     *
  12.246 +     * @return a content tree for the previous link
  12.247 +     */
  12.248 +    public Content getNavLinkPrevious() {
  12.249 +        Content li;
  12.250 +        if (prev == null) {
  12.251 +            li = HtmlTree.LI(prevpackageLabel);
  12.252 +        } else {
  12.253 +            DocPath path = DocPath.relativePath(packageDoc, prev);
  12.254 +            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
  12.255 +                prevpackageLabel, "", ""));
  12.256 +        }
  12.257 +        return li;
  12.258 +    }
  12.259 +
  12.260 +    /**
  12.261 +     * Get "NEXT PACKAGE" link in the navigation bar.
  12.262 +     *
  12.263 +     * @return a content tree for the next link
  12.264 +     */
  12.265 +    public Content getNavLinkNext() {
  12.266 +        Content li;
  12.267 +        if (next == null) {
  12.268 +            li = HtmlTree.LI(nextpackageLabel);
  12.269 +        } else {
  12.270 +            DocPath path = DocPath.relativePath(packageDoc, next);
  12.271 +            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
  12.272 +                nextpackageLabel, "", ""));
  12.273 +        }
  12.274 +        return li;
  12.275 +    }
  12.276 +
  12.277 +    /**
  12.278 +     * Get "Tree" link in the navigation bar. This will be link to the package
  12.279 +     * tree file.
  12.280 +     *
  12.281 +     * @return a content tree for the tree link
  12.282 +     */
  12.283 +    protected Content getNavLinkTree() {
  12.284 +        Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
  12.285 +                treeLabel, "", "");
  12.286 +        Content li = HtmlTree.LI(useLink);
  12.287 +        return li;
  12.288 +    }
  12.289 +
  12.290 +    /**
  12.291 +     * Highlight "Package" in the navigation bar, as this is the package page.
  12.292 +     *
  12.293 +     * @return a content tree for the package link
  12.294 +     */
  12.295 +    protected Content getNavLinkPackage() {
  12.296 +        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
  12.297 +        return li;
  12.298 +    }
  12.299 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Thu Feb 21 17:49:56 2013 -0800
    13.3 @@ -0,0 +1,208 @@
    13.4 +/*
    13.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.  Oracle designates this
   13.11 + * particular file as subject to the "Classpath" exception as provided
   13.12 + * by Oracle in the LICENSE file that accompanied this code.
   13.13 + *
   13.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.17 + * version 2 for more details (a copy is included in the LICENSE file that
   13.18 + * accompanied this code).
   13.19 + *
   13.20 + * You should have received a copy of the GNU General Public License version
   13.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.23 + *
   13.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   13.25 + * or visit www.oracle.com if you need additional information or have any
   13.26 + * questions.
   13.27 + */
   13.28 +
   13.29 +package com.sun.tools.doclets.formats.html;
   13.30 +
   13.31 +import java.io.*;
   13.32 +import java.util.*;
   13.33 +
   13.34 +import com.sun.javadoc.*;
   13.35 +import com.sun.tools.javac.jvm.Profile;
   13.36 +import com.sun.tools.doclets.formats.html.markup.*;
   13.37 +import com.sun.tools.doclets.internal.toolkit.*;
   13.38 +import com.sun.tools.doclets.internal.toolkit.util.*;
   13.39 +
   13.40 +/**
   13.41 + * Class to generate file for each profile contents in the right-hand
   13.42 + * frame. This will list all the packages and Class Kinds in the profile. A click on any
   13.43 + * class-kind will update the frame with the clicked class-kind page. A click on any
   13.44 + * package will update the frame with the clicked profile package page.
   13.45 + *
   13.46 + *  <p><b>This is NOT part of any supported API.
   13.47 + *  If you write code that depends on this, you do so at your own risk.
   13.48 + *  This code and its internal interfaces are subject to change or
   13.49 + *  deletion without notice.</b>
   13.50 + *
   13.51 + * @author Bhavesh Patel
   13.52 + */
   13.53 +public class ProfileWriterImpl extends HtmlDocletWriter
   13.54 +    implements ProfileSummaryWriter {
   13.55 +
   13.56 +    /**
   13.57 +     * The prev profile name in the alpha-order list.
   13.58 +     */
   13.59 +    protected Profile prevProfile;
   13.60 +
   13.61 +    /**
   13.62 +     * The next profile name in the alpha-order list.
   13.63 +     */
   13.64 +    protected Profile nextProfile;
   13.65 +
   13.66 +    /**
   13.67 +     * The profile being documented.
   13.68 +     */
   13.69 +    protected Profile profile;
   13.70 +
   13.71 +    /**
   13.72 +     * Constructor to construct ProfileWriter object and to generate
   13.73 +     * "profileName-summary.html" file.
   13.74 +     *
   13.75 +     * @param configuration the configuration of the doclet.
   13.76 +     * @param profile       Profile under consideration.
   13.77 +     * @param prevProfile   Previous profile in the sorted array.
   13.78 +     * @param nextProfile   Next profile in the sorted array.
   13.79 +     */
   13.80 +    public ProfileWriterImpl(ConfigurationImpl configuration,
   13.81 +            Profile profile, Profile prevProfile, Profile nextProfile)
   13.82 +            throws IOException {
   13.83 +        super(configuration, DocPaths.profileSummary(profile.name));
   13.84 +        this.prevProfile = prevProfile;
   13.85 +        this.nextProfile = nextProfile;
   13.86 +        this.profile = profile;
   13.87 +    }
   13.88 +
   13.89 +    /**
   13.90 +     * {@inheritDoc}
   13.91 +     */
   13.92 +    public Content getProfileHeader(String heading) {
   13.93 +        String profileName = profile.name;
   13.94 +        Content bodyTree = getBody(true, getWindowTitle(profileName));
   13.95 +        addTop(bodyTree);
   13.96 +        addNavLinks(true, bodyTree);
   13.97 +        HtmlTree div = new HtmlTree(HtmlTag.DIV);
   13.98 +        div.addStyle(HtmlStyle.header);
   13.99 +        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
  13.100 +                HtmlStyle.title, profileLabel);
  13.101 +        tHeading.addContent(getSpace());
  13.102 +        Content profileHead = new RawHtml(heading);
  13.103 +        tHeading.addContent(profileHead);
  13.104 +        div.addContent(tHeading);
  13.105 +        bodyTree.addContent(div);
  13.106 +        return bodyTree;
  13.107 +    }
  13.108 +
  13.109 +    /**
  13.110 +     * {@inheritDoc}
  13.111 +     */
  13.112 +    public Content getContentHeader() {
  13.113 +        HtmlTree div = new HtmlTree(HtmlTag.DIV);
  13.114 +        div.addStyle(HtmlStyle.contentContainer);
  13.115 +        return div;
  13.116 +    }
  13.117 +
  13.118 +    /**
  13.119 +     * {@inheritDoc}
  13.120 +     */
  13.121 +    public Content getSummaryHeader() {
  13.122 +        HtmlTree li = new HtmlTree(HtmlTag.LI);
  13.123 +        li.addStyle(HtmlStyle.blockList);
  13.124 +        return li;
  13.125 +    }
  13.126 +
  13.127 +    /**
  13.128 +     * {@inheritDoc}
  13.129 +     */
  13.130 +    public Content getSummaryTree(Content summaryContentTree) {
  13.131 +        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
  13.132 +        HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
  13.133 +        return div;
  13.134 +    }
  13.135 +
  13.136 +    /**
  13.137 +     * {@inheritDoc}
  13.138 +     */
  13.139 +    public Content getPackageSummaryHeader(PackageDoc pkg) {
  13.140 +        Content pkgName = getTargetProfilePackageLink(pkg,
  13.141 +                    "classFrame", new StringContent(pkg.name()), profile.name);
  13.142 +        Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
  13.143 +        HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
  13.144 +        return li;
  13.145 +    }
  13.146 +
  13.147 +    /**
  13.148 +     * {@inheritDoc}
  13.149 +     */
  13.150 +    public Content getPackageSummaryTree(Content packageSummaryContentTree) {
  13.151 +        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
  13.152 +        return ul;
  13.153 +    }
  13.154 +
  13.155 +    /**
  13.156 +     * {@inheritDoc}
  13.157 +     */
  13.158 +    public void addClassesSummary(ClassDoc[] classes, String label,
  13.159 +            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
  13.160 +        addClassesSummary(classes, label, tableSummary, tableHeader,
  13.161 +                packageSummaryContentTree, profile.value);
  13.162 +    }
  13.163 +
  13.164 +    /**
  13.165 +     * {@inheritDoc}
  13.166 +     */
  13.167 +    public void addProfileFooter(Content contentTree) {
  13.168 +        addNavLinks(false, contentTree);
  13.169 +        addBottom(contentTree);
  13.170 +    }
  13.171 +
  13.172 +    /**
  13.173 +     * {@inheritDoc}
  13.174 +     */
  13.175 +    public void printDocument(Content contentTree) throws IOException {
  13.176 +        printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
  13.177 +                true, contentTree);
  13.178 +    }
  13.179 +
  13.180 +    /**
  13.181 +     * Get "PREV PROFILE" link in the navigation bar.
  13.182 +     *
  13.183 +     * @return a content tree for the previous link
  13.184 +     */
  13.185 +    public Content getNavLinkPrevious() {
  13.186 +        Content li;
  13.187 +        if (prevProfile == null) {
  13.188 +            li = HtmlTree.LI(prevprofileLabel);
  13.189 +        } else {
  13.190 +            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
  13.191 +                    prevProfile.name)), prevprofileLabel, "", ""));
  13.192 +        }
  13.193 +        return li;
  13.194 +    }
  13.195 +
  13.196 +    /**
  13.197 +     * Get "NEXT PROFILE" link in the navigation bar.
  13.198 +     *
  13.199 +     * @return a content tree for the next link
  13.200 +     */
  13.201 +    public Content getNavLinkNext() {
  13.202 +        Content li;
  13.203 +        if (nextProfile == null) {
  13.204 +            li = HtmlTree.LI(nextprofileLabel);
  13.205 +        } else {
  13.206 +            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
  13.207 +                    nextProfile.name)), nextprofileLabel, "", ""));
  13.208 +        }
  13.209 +        return li;
  13.210 +    }
  13.211 +}
    14.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Feb 21 12:23:27 2013 -0800
    14.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Feb 21 17:49:56 2013 -0800
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 2003, 2013, 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 @@ -28,6 +28,7 @@
   14.11  import java.io.IOException;
   14.12  
   14.13  import com.sun.javadoc.*;
   14.14 +import com.sun.tools.javac.jvm.Profile;
   14.15  import com.sun.tools.doclets.internal.toolkit.*;
   14.16  import com.sun.tools.doclets.internal.toolkit.util.*;
   14.17  
   14.18 @@ -69,6 +70,24 @@
   14.19      /**
   14.20       * {@inheritDoc}
   14.21       */
   14.22 +    public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
   14.23 +        Profile prevProfile, Profile nextProfile) throws Exception {
   14.24 +        return new ProfileWriterImpl(configuration, profile,
   14.25 +            prevProfile, nextProfile);
   14.26 +    }
   14.27 +
   14.28 +    /**
   14.29 +     * {@inheritDoc}
   14.30 +     */
   14.31 +    public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
   14.32 +        PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
   14.33 +        return new ProfilePackageWriterImpl(configuration, packageDoc,
   14.34 +            prevPkg, nextPkg, profile);
   14.35 +    }
   14.36 +
   14.37 +    /**
   14.38 +     * {@inheritDoc}
   14.39 +     */
   14.40      public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
   14.41              ClassDoc nextClass, ClassTree classTree) throws IOException {
   14.42          return new ClassWriterImpl(configuration, classDoc,
    15.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Thu Feb 21 12:23:27 2013 -0800
    15.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Thu Feb 21 17:49:56 2013 -0800
    15.3 @@ -1,5 +1,5 @@
    15.4  /*
    15.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
    15.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    15.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.8   *
    15.9   * This code is free software; you can redistribute it and/or modify it
   15.10 @@ -168,6 +168,11 @@
   15.11      public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
   15.12  
   15.13      /**
   15.14 +     * Html tag for the profile name heading.
   15.15 +     */
   15.16 +    public static final HtmlTag PROFILE_HEADING = HtmlTag.H2;
   15.17 +
   15.18 +    /**
   15.19       * Html tag for the member summary heading.
   15.20       */
   15.21      public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
    16.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Feb 21 12:23:27 2013 -0800
    16.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Feb 21 17:49:56 2013 -0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 1997, 2013, 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 @@ -63,6 +63,11 @@
   16.11      protected boolean memberDetailsListPrinted;
   16.12  
   16.13      /**
   16.14 +     * Header for table displaying profiles and description..
   16.15 +     */
   16.16 +    protected final String[] profileTableHeader;
   16.17 +
   16.18 +    /**
   16.19       * Header for tables displaying packages and description..
   16.20       */
   16.21      protected final String[] packageTableHeader;
   16.22 @@ -83,6 +88,8 @@
   16.23  
   16.24      public final Content packageLabel;
   16.25  
   16.26 +    public final Content profileLabel;
   16.27 +
   16.28      public final Content useLabel;
   16.29  
   16.30      public final Content prevLabel;
   16.31 @@ -111,6 +118,10 @@
   16.32  
   16.33      public final Content allclassesLabel;
   16.34  
   16.35 +    public final Content allpackagesLabel;
   16.36 +
   16.37 +    public final Content allprofilesLabel;
   16.38 +
   16.39      public final Content indexLabel;
   16.40  
   16.41      public final Content helpLabel;
   16.42 @@ -123,8 +134,14 @@
   16.43  
   16.44      public final Content nextpackageLabel;
   16.45  
   16.46 +    public final Content prevprofileLabel;
   16.47 +
   16.48 +    public final Content nextprofileLabel;
   16.49 +
   16.50      public final Content packagesLabel;
   16.51  
   16.52 +    public final Content profilesLabel;
   16.53 +
   16.54      public final Content methodDetailsLabel;
   16.55  
   16.56      public final Content annotationTypeDetailsLabel;
   16.57 @@ -162,6 +179,10 @@
   16.58          writer = DocFile.createFileForOutput(configuration, path).openWriter();
   16.59          this.configuration = configuration;
   16.60          this.memberDetailsListPrinted = false;
   16.61 +        profileTableHeader = new String[] {
   16.62 +            configuration.getText("doclet.Profile"),
   16.63 +            configuration.getText("doclet.Description")
   16.64 +        };
   16.65          packageTableHeader = new String[] {
   16.66              configuration.getText("doclet.Package"),
   16.67              configuration.getText("doclet.Description")
   16.68 @@ -175,6 +196,7 @@
   16.69          defaultPackageLabel = new RawHtml(
   16.70                  DocletConstants.DEFAULT_PACKAGE_NAME);
   16.71          packageLabel = getResource("doclet.Package");
   16.72 +        profileLabel = getResource("doclet.Profile");
   16.73          useLabel = getResource("doclet.navClassUse");
   16.74          prevLabel = getResource("doclet.Prev");
   16.75          nextLabel = getResource("doclet.Next");
   16.76 @@ -189,13 +211,18 @@
   16.77          deprecatedLabel = getResource("doclet.navDeprecated");
   16.78          deprecatedPhrase = getResource("doclet.Deprecated");
   16.79          allclassesLabel = getResource("doclet.All_Classes");
   16.80 +        allpackagesLabel = getResource("doclet.All_Packages");
   16.81 +        allprofilesLabel = getResource("doclet.All_Profiles");
   16.82          indexLabel = getResource("doclet.Index");
   16.83          helpLabel = getResource("doclet.Help");
   16.84          seeLabel = getResource("doclet.See");
   16.85          descriptionLabel = getResource("doclet.Description");
   16.86          prevpackageLabel = getResource("doclet.Prev_Package");
   16.87          nextpackageLabel = getResource("doclet.Next_Package");
   16.88 +        prevprofileLabel = getResource("doclet.Prev_Profile");
   16.89 +        nextprofileLabel = getResource("doclet.Next_Profile");
   16.90          packagesLabel = getResource("doclet.Packages");
   16.91 +        profilesLabel = getResource("doclet.Profiles");
   16.92          methodDetailsLabel = getResource("doclet.Method_Detail");
   16.93          annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
   16.94          fieldDetailsLabel = getResource("doclet.Field_Detail");
    17.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Feb 21 12:23:27 2013 -0800
    17.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Feb 21 17:49:56 2013 -0800
    17.3 @@ -4,7 +4,9 @@
    17.4  doclet.Window_Overview=Overview List
    17.5  doclet.Window_Overview_Summary=Overview
    17.6  doclet.Package=Package
    17.7 +doclet.Profile=Profile
    17.8  doclet.All_Packages=All Packages
    17.9 +doclet.All_Profiles=All Profiles
   17.10  doclet.Tree=Tree
   17.11  doclet.Class_Hierarchy=Class Hierarchy
   17.12  doclet.Window_Class_Hierarchy=Class Hierarchy
   17.13 @@ -17,6 +19,8 @@
   17.14  doclet.Next_Class=Next Class
   17.15  doclet.Prev_Package=Prev Package
   17.16  doclet.Next_Package=Next Package
   17.17 +doclet.Prev_Profile=Prev Profile
   17.18 +doclet.Next_Profile=Next Profile
   17.19  doclet.Prev_Letter=Prev Letter
   17.20  doclet.Next_Letter=Next Letter
   17.21  doclet.Href_Class_Title=class in {0}
    18.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Feb 21 12:23:27 2013 -0800
    18.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Feb 21 17:49:56 2013 -0800
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 2003, 2013, 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 @@ -28,8 +28,6 @@
   18.11  import com.sun.javadoc.*;
   18.12  import com.sun.tools.doclets.internal.toolkit.builders.*;
   18.13  import com.sun.tools.doclets.internal.toolkit.util.*;
   18.14 -import java.io.File;
   18.15 -import java.util.StringTokenizer;
   18.16  
   18.17  /**
   18.18   * An abstract implementation of a Doclet.
   18.19 @@ -128,6 +126,7 @@
   18.20  
   18.21          PackageListWriter.generate(configuration);
   18.22          generatePackageFiles(classtree);
   18.23 +        generateProfileFiles();
   18.24  
   18.25          generateOtherFiles(root, classtree);
   18.26          configuration.tagletManager.printReport();
   18.27 @@ -148,6 +147,12 @@
   18.28      }
   18.29  
   18.30      /**
   18.31 +     * Generate the profile documentation.
   18.32 +     *
   18.33 +     */
   18.34 +    protected abstract void generateProfileFiles() throws Exception;
   18.35 +
   18.36 +    /**
   18.37       * Generate the package documentation.
   18.38       *
   18.39       * @param classtree the data structure representing the class tree.
    19.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Feb 21 12:23:27 2013 -0800
    19.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Feb 21 17:49:56 2013 -0800
    19.3 @@ -29,6 +29,8 @@
    19.4  import java.util.*;
    19.5  
    19.6  import com.sun.javadoc.*;
    19.7 +import com.sun.tools.javac.sym.Profiles;
    19.8 +import com.sun.tools.javac.jvm.Profile;
    19.9  import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
   19.10  import com.sun.tools.doclets.internal.toolkit.taglets.*;
   19.11  import com.sun.tools.doclets.internal.toolkit.util.*;
   19.12 @@ -188,6 +190,17 @@
   19.13      public String sourcepath = "";
   19.14  
   19.15      /**
   19.16 +     * Argument for command line option "-Xprofilespath".
   19.17 +     */
   19.18 +    public String profilespath = "";
   19.19 +
   19.20 +    /**
   19.21 +     * Generate profiles documentation if profilespath is set and valid profiles
   19.22 +     * are present.
   19.23 +     */
   19.24 +    public boolean showProfiles = false;
   19.25 +
   19.26 +    /**
   19.27       * Don't generate deprecated API information at all, if -nodeprecated
   19.28       * option is used. <code>nodepracted</code> is set to true if
   19.29       * -nodeprecated option is used. Default is generate deprected API
   19.30 @@ -247,6 +260,16 @@
   19.31      public abstract MessageRetriever getDocletSpecificMsg();
   19.32  
   19.33      /**
   19.34 +     * A profiles object used to access profiles across various pages.
   19.35 +     */
   19.36 +    public Profiles profiles;
   19.37 +
   19.38 +    /**
   19.39 +     * An map of the profiles to packages.
   19.40 +     */
   19.41 +    public Map<String,PackageDoc[]> profilePackages;
   19.42 +
   19.43 +    /**
   19.44       * An array of the packages specified on the command-line merged
   19.45       * with the array of packages that contain the classes specified on the
   19.46       * command-line.  The array is sorted.
   19.47 @@ -315,7 +338,8 @@
   19.48                     option.equals("-sourcepath") ||
   19.49                     option.equals("-tag") ||
   19.50                     option.equals("-taglet") ||
   19.51 -                   option.equals("-tagletpath")) {
   19.52 +                   option.equals("-tagletpath") ||
   19.53 +                   option.equals("-xprofilespath")) {
   19.54              return 2;
   19.55          } else if (option.equals("-group") ||
   19.56                     option.equals("-linkoffline")) {
   19.57 @@ -334,6 +358,38 @@
   19.58      public abstract boolean validOptions(String options[][],
   19.59          DocErrorReporter reporter);
   19.60  
   19.61 +    private void initProfiles() throws IOException {
   19.62 +        profiles = Profiles.read(new File(profilespath));
   19.63 +        // Generate profiles documentation only is profilespath is set and if
   19.64 +        // profiles is not null and profiles count is 1 or more.
   19.65 +        showProfiles = (!profilespath.isEmpty() && profiles != null &&
   19.66 +                profiles.getProfileCount() > 0);
   19.67 +    }
   19.68 +
   19.69 +    private void initProfilePackages() throws IOException {
   19.70 +        profilePackages = new HashMap<String,PackageDoc[]>();
   19.71 +        ArrayList<PackageDoc> results;
   19.72 +        Map<String,PackageDoc> packageIndex = new HashMap<String,PackageDoc>();
   19.73 +        for (int i = 0; i < packages.length; i++) {
   19.74 +            PackageDoc pkg = packages[i];
   19.75 +            packageIndex.put(pkg.name(), pkg);
   19.76 +        }
   19.77 +        for (int i = 1; i < profiles.getProfileCount(); i++) {
   19.78 +            Set<String> profPkgs = profiles.getPackages(i);
   19.79 +            results = new ArrayList<PackageDoc>();
   19.80 +            for (String packageName : profPkgs) {
   19.81 +                packageName = packageName.replace("/", ".");
   19.82 +                PackageDoc profPkg = packageIndex.get(packageName);
   19.83 +                if (profPkg != null) {
   19.84 +                    results.add(profPkg);
   19.85 +                }
   19.86 +            }
   19.87 +            Collections.sort(results);
   19.88 +            PackageDoc[] profilePkgs = results.toArray(new PackageDoc[]{});
   19.89 +            profilePackages.put(Profile.lookup(i).name, profilePkgs);
   19.90 +        }
   19.91 +    }
   19.92 +
   19.93      private void initPackageArray() {
   19.94          Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
   19.95          ClassDoc[] classes = root.specifiedClasses();
   19.96 @@ -404,6 +460,8 @@
   19.97                  customTagStrs.add(os);
   19.98              } else if (opt.equals("-tagletpath")) {
   19.99                  tagletpath = os[1];
  19.100 +            }  else if (opt.equals("-xprofilespath")) {
  19.101 +                profilespath = os[1];
  19.102              } else if (opt.equals("-keywords")) {
  19.103                  keywords = true;
  19.104              } else if (opt.equals("-serialwarn")) {
  19.105 @@ -439,6 +497,14 @@
  19.106      public void setOptions() {
  19.107          initPackageArray();
  19.108          setOptions(root.options());
  19.109 +        if (!profilespath.isEmpty()) {
  19.110 +            try {
  19.111 +                initProfiles();
  19.112 +                initProfilePackages();
  19.113 +            } catch (Exception e) {
  19.114 +                throw new DocletAbortException();
  19.115 +            }
  19.116 +        }
  19.117          setSpecificDocletOptions(root.options());
  19.118      }
  19.119  
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfilePackageSummaryWriter.java	Thu Feb 21 17:49:56 2013 -0800
    20.3 @@ -0,0 +1,116 @@
    20.4 +/*
    20.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.  Oracle designates this
   20.11 + * particular file as subject to the "Classpath" exception as provided
   20.12 + * by Oracle in the LICENSE file that accompanied this code.
   20.13 + *
   20.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.17 + * version 2 for more details (a copy is included in the LICENSE file that
   20.18 + * accompanied this code).
   20.19 + *
   20.20 + * You should have received a copy of the GNU General Public License version
   20.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.23 + *
   20.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.25 + * or visit www.oracle.com if you need additional information or have any
   20.26 + * questions.
   20.27 + */
   20.28 +
   20.29 +package com.sun.tools.doclets.internal.toolkit;
   20.30 +
   20.31 +import java.io.*;
   20.32 +
   20.33 +import com.sun.javadoc.*;
   20.34 +
   20.35 +/**
   20.36 + * The interface for writing profile package summary output.
   20.37 + *
   20.38 + *  <p><b>This is NOT part of any supported API.
   20.39 + *  If you write code that depends on this, you do so at your own risk.
   20.40 + *  This code and its internal interfaces are subject to change or
   20.41 + *  deletion without notice.</b>
   20.42 + *
   20.43 + * @author Bhavesh Patel
   20.44 + */
   20.45 +
   20.46 +public interface ProfilePackageSummaryWriter {
   20.47 +
   20.48 +    /**
   20.49 +     * Get the header for the summary.
   20.50 +     *
   20.51 +     * @param heading Package name.
   20.52 +     * @return the header to be added to the content tree
   20.53 +     */
   20.54 +    public abstract Content getPackageHeader(String heading);
   20.55 +
   20.56 +    /**
   20.57 +     * Get the header for the content.
   20.58 +     *
   20.59 +     * @return a content tree for the content header
   20.60 +     */
   20.61 +    public abstract Content getContentHeader();
   20.62 +
   20.63 +    /**
   20.64 +     * Get the header for the package summary.
   20.65 +     *
   20.66 +     * @return a content tree with the package summary header
   20.67 +     */
   20.68 +    public abstract Content getSummaryHeader();
   20.69 +
   20.70 +    /**
   20.71 +     * Adds the table of classes to the documentation tree.
   20.72 +     *
   20.73 +     * @param classes the array of classes to document.
   20.74 +     * @param label the label for this table.
   20.75 +     * @param tableSummary the summary string for the table
   20.76 +     * @param tableHeader array of table headers
   20.77 +     * @param summaryContentTree the content tree to which the summaries will be added
   20.78 +     */
   20.79 +    public abstract void addClassesSummary(ClassDoc[] classes, String label,
   20.80 +            String tableSummary, String[] tableHeader, Content summaryContentTree);
   20.81 +
   20.82 +    /**
   20.83 +     * Adds the package description from the "packages.html" file to the documentation
   20.84 +     * tree.
   20.85 +     *
   20.86 +     * @param packageContentTree the content tree to which the package description
   20.87 +     *                           will be added
   20.88 +     */
   20.89 +    public abstract void addPackageDescription(Content packageContentTree);
   20.90 +
   20.91 +    /**
   20.92 +     * Adds the tag information from the "packages.html" file to the documentation
   20.93 +     * tree.
   20.94 +     *
   20.95 +     * @param packageContentTree the content tree to which the package tags will
   20.96 +     *                           be added
   20.97 +     */
   20.98 +    public abstract void addPackageTags(Content packageContentTree);
   20.99 +
  20.100 +    /**
  20.101 +     * Adds the footer to the documentation tree.
  20.102 +     *
  20.103 +     * @param contentTree the tree to which the footer will be added
  20.104 +     */
  20.105 +    public abstract void addPackageFooter(Content contentTree);
  20.106 +
  20.107 +    /**
  20.108 +     * Print the package summary document.
  20.109 +     *
  20.110 +     * @param contentTree the content tree that will be printed
  20.111 +     */
  20.112 +    public abstract void printDocument(Content contentTree) throws IOException;
  20.113 +
  20.114 +    /**
  20.115 +     * Close the writer.
  20.116 +     */
  20.117 +    public abstract void close() throws IOException;
  20.118 +
  20.119 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfileSummaryWriter.java	Thu Feb 21 17:49:56 2013 -0800
    21.3 @@ -0,0 +1,120 @@
    21.4 +/*
    21.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.  Oracle designates this
   21.11 + * particular file as subject to the "Classpath" exception as provided
   21.12 + * by Oracle in the LICENSE file that accompanied this code.
   21.13 + *
   21.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.17 + * version 2 for more details (a copy is included in the LICENSE file that
   21.18 + * accompanied this code).
   21.19 + *
   21.20 + * You should have received a copy of the GNU General Public License version
   21.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.23 + *
   21.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.25 + * or visit www.oracle.com if you need additional information or have any
   21.26 + * questions.
   21.27 + */
   21.28 +
   21.29 +package com.sun.tools.doclets.internal.toolkit;
   21.30 +
   21.31 +import java.io.*;
   21.32 +
   21.33 +import com.sun.javadoc.*;
   21.34 +
   21.35 +/**
   21.36 + * The interface for writing profile summary output.
   21.37 + *
   21.38 + *  <p><b>This is NOT part of any supported API.
   21.39 + *  If you write code that depends on this, you do so at your own risk.
   21.40 + *  This code and its internal interfaces are subject to change or
   21.41 + *  deletion without notice.</b>
   21.42 + *
   21.43 + * @author Bhavesh Patel
   21.44 + */
   21.45 +
   21.46 +public interface ProfileSummaryWriter {
   21.47 +
   21.48 +    /**
   21.49 +     * Get the header for the summary.
   21.50 +     *
   21.51 +     * @param heading profile name.
   21.52 +     * @return the header to be added to the content tree
   21.53 +     */
   21.54 +    public abstract Content getProfileHeader(String heading);
   21.55 +
   21.56 +    /**
   21.57 +     * Get the header for the profile content.
   21.58 +     *
   21.59 +     * @return a content tree for the profile content header
   21.60 +     */
   21.61 +    public abstract Content getContentHeader();
   21.62 +
   21.63 +    /**
   21.64 +     * Get the header for the summary header.
   21.65 +     *
   21.66 +     * @return a content tree with the summary header
   21.67 +     */
   21.68 +    public abstract Content getSummaryHeader();
   21.69 +
   21.70 +    /**
   21.71 +     * Get the header for the summary tree.
   21.72 +     *
   21.73 +     * @param summaryContentTree the content tree.
   21.74 +     * @return a content tree with the summary tree
   21.75 +     */
   21.76 +    public abstract Content getSummaryTree(Content summaryContentTree);
   21.77 +
   21.78 +    /**
   21.79 +     * Get the header for the package summary header.
   21.80 +     *
   21.81 +     * @return a content tree with the package summary header
   21.82 +     */
   21.83 +    public abstract Content getPackageSummaryHeader(PackageDoc pkg);
   21.84 +
   21.85 +    /**
   21.86 +     * Get the header for the package summary tree.
   21.87 +     *
   21.88 +     * @return a content tree with the package summary
   21.89 +     */
   21.90 +    public abstract Content getPackageSummaryTree(Content packageSummaryContentTree);
   21.91 +
   21.92 +    /**
   21.93 +     * Adds the table of classes to the documentation tree.
   21.94 +     *
   21.95 +     * @param classes the array of classes to document.
   21.96 +     * @param label the label for this table.
   21.97 +     * @param tableSummary the summary string for the table
   21.98 +     * @param tableHeader array of table headers
   21.99 +     * @param packageSummaryContentTree the content tree to which the summaries will be added
  21.100 +     */
  21.101 +    public abstract void addClassesSummary(ClassDoc[] classes, String label,
  21.102 +            String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
  21.103 +
  21.104 +    /**
  21.105 +     * Adds the footer to the documentation tree.
  21.106 +     *
  21.107 +     * @param contentTree the tree to which the footer will be added
  21.108 +     */
  21.109 +    public abstract void addProfileFooter(Content contentTree);
  21.110 +
  21.111 +    /**
  21.112 +     * Print the profile summary document.
  21.113 +     *
  21.114 +     * @param contentTree the content tree that will be printed
  21.115 +     */
  21.116 +    public abstract void printDocument(Content contentTree) throws IOException;
  21.117 +
  21.118 +    /**
  21.119 +     * Close the writer.
  21.120 +     */
  21.121 +    public abstract void close() throws IOException;
  21.122 +
  21.123 +}
    22.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Thu Feb 21 12:23:27 2013 -0800
    22.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Thu Feb 21 17:49:56 2013 -0800
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
   22.10 @@ -26,6 +26,7 @@
   22.11  package com.sun.tools.doclets.internal.toolkit;
   22.12  
   22.13  import com.sun.javadoc.*;
   22.14 +import com.sun.tools.javac.jvm.Profile;
   22.15  import com.sun.tools.doclets.internal.toolkit.util.*;
   22.16  
   22.17  /**
   22.18 @@ -65,6 +66,33 @@
   22.19      throws Exception;
   22.20  
   22.21      /**
   22.22 +     * Return the writer for the profile summary.
   22.23 +     *
   22.24 +     * @param profile the profile being documented.
   22.25 +     * @param prevProfile the previous profile that was documented.
   22.26 +     * @param nextProfile the next profile being documented.
   22.27 +     * @return the writer for the profile summary.  Return null if this
   22.28 +     * writer is not supported by the doclet.
   22.29 +     */
   22.30 +    public abstract ProfileSummaryWriter getProfileSummaryWriter(Profile
   22.31 +        profile, Profile prevProfile, Profile nextProfile)
   22.32 +    throws Exception;
   22.33 +
   22.34 +    /**
   22.35 +     * Return the writer for the profile package summary.
   22.36 +     *
   22.37 +     * @param packageDoc the profile package being documented.
   22.38 +     * @param prevPkg the previous profile package that was documented.
   22.39 +     * @param nextPkg the next profile package being documented.
   22.40 +     * @param profile the profile being documented.
   22.41 +     * @return the writer for the profile package summary.  Return null if this
   22.42 +     * writer is not supported by the doclet.
   22.43 +     */
   22.44 +    public abstract ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
   22.45 +            PackageDoc packageDoc, PackageDoc prevPkg, PackageDoc nextPkg,
   22.46 +            Profile profile) throws Exception;
   22.47 +
   22.48 +    /**
   22.49       * Return the writer for a class.
   22.50       *
   22.51       * @param classDoc the class being documented.
    23.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Feb 21 12:23:27 2013 -0800
    23.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Feb 21 17:49:56 2013 -0800
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -29,6 +29,7 @@
   23.11  import java.util.Set;
   23.12  
   23.13  import com.sun.javadoc.*;
   23.14 +import com.sun.tools.javac.jvm.Profile;
   23.15  import com.sun.tools.doclets.internal.toolkit.*;
   23.16  import com.sun.tools.doclets.internal.toolkit.util.*;
   23.17  
   23.18 @@ -96,6 +97,36 @@
   23.19      }
   23.20  
   23.21      /**
   23.22 +     * Return the builder that builds the profile summary.
   23.23 +     *
   23.24 +     * @param profile the profile being documented.
   23.25 +     * @param prevProfile the previous profile being documented.
   23.26 +     * @param nextProfile the next profile being documented.
   23.27 +     * @return the builder that builds the profile summary.
   23.28 +     */
   23.29 +    public AbstractBuilder getProfileSummaryBuilder(Profile profile, Profile prevProfile,
   23.30 +            Profile nextProfile) throws Exception {
   23.31 +        return ProfileSummaryBuilder.getInstance(context, profile,
   23.32 +            writerFactory.getProfileSummaryWriter(profile, prevProfile, nextProfile));
   23.33 +    }
   23.34 +
   23.35 +    /**
   23.36 +     * Return the builder that builds the profile package summary.
   23.37 +     *
   23.38 +     * @param pkg the profile package being documented.
   23.39 +     * @param prevPkg the previous profile package being documented.
   23.40 +     * @param nextPkg the next profile package being documented.
   23.41 +     * @param profile the profile being documented.
   23.42 +     * @return the builder that builds the profile package summary.
   23.43 +     */
   23.44 +    public AbstractBuilder getProfilePackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
   23.45 +            PackageDoc nextPkg, Profile profile) throws Exception {
   23.46 +        return ProfilePackageSummaryBuilder.getInstance(context, pkg,
   23.47 +            writerFactory.getProfilePackageSummaryWriter(pkg, prevPkg, nextPkg,
   23.48 +                profile), profile);
   23.49 +    }
   23.50 +
   23.51 +    /**
   23.52       * Return the builder for the class.
   23.53       *
   23.54       * @param classDoc the class being documented.
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Thu Feb 21 17:49:56 2013 -0800
    24.3 @@ -0,0 +1,374 @@
    24.4 +/*
    24.5 + * Copyright (c) 2013, 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.  Oracle designates this
   24.11 + * particular file as subject to the "Classpath" exception as provided
   24.12 + * by Oracle in the LICENSE file that accompanied this code.
   24.13 + *
   24.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   24.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.17 + * version 2 for more details (a copy is included in the LICENSE file that
   24.18 + * accompanied this code).
   24.19 + *
   24.20 + * You should have received a copy of the GNU General Public License version
   24.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   24.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.23 + *
   24.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.25 + * or visit www.oracle.com if you need additional information or have any
   24.26 + * questions.
   24.27 + */
   24.28 +
   24.29 +package com.sun.tools.doclets.internal.toolkit.builders;
   24.30 +
   24.31 +import java.io.*;
   24.32 +
   24.33 +import com.sun.javadoc.*;
   24.34 +import com.sun.tools.javac.jvm.Profile;
   24.35 +import com.sun.tools.doclets.internal.toolkit.*;
   24.36 +import com.sun.tools.doclets.internal.toolkit.util.*;
   24.37 +
   24.38 +/**
   24.39 + * Builds the summary for a given profile package.
   24.40 + *
   24.41 + *  <p><b>This is NOT part of any supported API.
   24.42 + *  If you write code that depends on this, you do so at your own risk.
   24.43 + *  This code and its internal interfaces are subject to change or
   24.44 + *  deletion without notice.</b>
   24.45 + *
   24.46 + * @author Bhavesh Patel
   24.47 + */
   24.48 +public class ProfilePackageSummaryBuilder extends AbstractBuilder {
   24.49 +    /**
   24.50 +     * The root element of the profile package summary XML is {@value}.
   24.51 +     */
   24.52 +    public static final String ROOT = "PackageDoc";
   24.53 +
   24.54 +    /**
   24.55 +     * The profile package being documented.
   24.56 +     */
   24.57 +    private final PackageDoc packageDoc;
   24.58 +
   24.59 +    /**
   24.60 +     * The name of the profile being documented.
   24.61 +     */
   24.62 +    private final String profileName;
   24.63 +
   24.64 +    /**
   24.65 +     * The value of the profile being documented.
   24.66 +     */
   24.67 +    private final int profileValue;
   24.68 +
   24.69 +    /**
   24.70 +     * The doclet specific writer that will output the result.
   24.71 +     */
   24.72 +    private final ProfilePackageSummaryWriter profilePackageWriter;
   24.73 +
   24.74 +    /**
   24.75 +     * The content that will be added to the profile package summary documentation tree.
   24.76 +     */
   24.77 +    private Content contentTree;
   24.78 +
   24.79 +    /**
   24.80 +     * Construct a new ProfilePackageSummaryBuilder.
   24.81 +     *
   24.82 +     * @param context  the build context.
   24.83 +     * @param pkg the profile package being documented.
   24.84 +     * @param profilePackageWriter the doclet specific writer that will output the
   24.85 +     *        result.
   24.86 +     * @param profile the profile being documented.
   24.87 +     */
   24.88 +    private ProfilePackageSummaryBuilder(Context context,
   24.89 +            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
   24.90 +            Profile profile) {
   24.91 +        super(context);
   24.92 +        this.packageDoc = pkg;
   24.93 +        this.profilePackageWriter = profilePackageWriter;
   24.94 +        this.profileName = profile.name;
   24.95 +        this.profileValue = profile.value;
   24.96 +    }
   24.97 +
   24.98 +    /**
   24.99 +     * Construct a new ProfilePackageSummaryBuilder.
  24.100 +     *
  24.101 +     * @param context  the build context.
  24.102 +     * @param pkg the profile package being documented.
  24.103 +     * @param profilePackageWriter the doclet specific writer that will output the
  24.104 +     *        result.
  24.105 +     * @param profile the profile being documented.
  24.106 +     *
  24.107 +     * @return an instance of a ProfilePackageSummaryBuilder.
  24.108 +     */
  24.109 +    public static ProfilePackageSummaryBuilder getInstance(Context context,
  24.110 +            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
  24.111 +            Profile profile) {
  24.112 +        return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
  24.113 +                profile);
  24.114 +    }
  24.115 +
  24.116 +    /**
  24.117 +     * Build the profile package summary.
  24.118 +     */
  24.119 +    public void build() throws IOException {
  24.120 +        if (profilePackageWriter == null) {
  24.121 +            //Doclet does not support this output.
  24.122 +            return;
  24.123 +        }
  24.124 +        build(layoutParser.parseXML(ROOT), contentTree);
  24.125 +    }
  24.126 +
  24.127 +    /**
  24.128 +     * {@inheritDoc}
  24.129 +     */
  24.130 +    public String getName() {
  24.131 +        return ROOT;
  24.132 +    }
  24.133 +
  24.134 +    /**
  24.135 +     * Build the profile package documentation.
  24.136 +     *
  24.137 +     * @param node the XML element that specifies which components to document
  24.138 +     * @param contentTree the content tree to which the documentation will be added
  24.139 +     */
  24.140 +    public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
  24.141 +        contentTree = profilePackageWriter.getPackageHeader(
  24.142 +                Util.getPackageName(packageDoc));
  24.143 +        buildChildren(node, contentTree);
  24.144 +        profilePackageWriter.addPackageFooter(contentTree);
  24.145 +        profilePackageWriter.printDocument(contentTree);
  24.146 +        profilePackageWriter.close();
  24.147 +        Util.copyDocFiles(configuration, packageDoc);
  24.148 +    }
  24.149 +
  24.150 +    /**
  24.151 +     * Build the content for the profile package doc.
  24.152 +     *
  24.153 +     * @param node the XML element that specifies which components to document
  24.154 +     * @param contentTree the content tree to which the package contents
  24.155 +     *                    will be added
  24.156 +     */
  24.157 +    public void buildContent(XMLNode node, Content contentTree) {
  24.158 +        Content packageContentTree = profilePackageWriter.getContentHeader();
  24.159 +        buildChildren(node, packageContentTree);
  24.160 +        contentTree.addContent(packageContentTree);
  24.161 +    }
  24.162 +
  24.163 +    /**
  24.164 +     * Build the profile package summary.
  24.165 +     *
  24.166 +     * @param node the XML element that specifies which components to document
  24.167 +     * @param packageContentTree the package content tree to which the summaries will
  24.168 +     *                           be added
  24.169 +     */
  24.170 +    public void buildSummary(XMLNode node, Content packageContentTree) {
  24.171 +        Content summaryContentTree = profilePackageWriter.getSummaryHeader();
  24.172 +        buildChildren(node, summaryContentTree);
  24.173 +        packageContentTree.addContent(summaryContentTree);
  24.174 +    }
  24.175 +
  24.176 +    /**
  24.177 +     * Build the summary for the interfaces in this package.
  24.178 +     *
  24.179 +     * @param node the XML element that specifies which components to document
  24.180 +     * @param summaryContentTree the summary tree to which the interface summary
  24.181 +     *                           will be added
  24.182 +     */
  24.183 +    public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
  24.184 +        String interfaceTableSummary =
  24.185 +                configuration.getText("doclet.Member_Table_Summary",
  24.186 +                configuration.getText("doclet.Interface_Summary"),
  24.187 +                configuration.getText("doclet.interfaces"));
  24.188 +        String[] interfaceTableHeader = new String[] {
  24.189 +            configuration.getText("doclet.Interface"),
  24.190 +            configuration.getText("doclet.Description")
  24.191 +        };
  24.192 +        ClassDoc[] interfaces =
  24.193 +                packageDoc.isIncluded()
  24.194 +                        ? packageDoc.interfaces()
  24.195 +                        : configuration.classDocCatalog.interfaces(
  24.196 +                                Util.getPackageName(packageDoc));
  24.197 +        if (interfaces.length > 0) {
  24.198 +            profilePackageWriter.addClassesSummary(
  24.199 +                    interfaces,
  24.200 +                    configuration.getText("doclet.Interface_Summary"),
  24.201 +                    interfaceTableSummary, interfaceTableHeader, summaryContentTree);
  24.202 +        }
  24.203 +    }
  24.204 +
  24.205 +    /**
  24.206 +     * Build the summary for the classes in this package.
  24.207 +     *
  24.208 +     * @param node the XML element that specifies which components to document
  24.209 +     * @param summaryContentTree the summary tree to which the class summary will
  24.210 +     *                           be added
  24.211 +     */
  24.212 +    public void buildClassSummary(XMLNode node, Content summaryContentTree) {
  24.213 +        String classTableSummary =
  24.214 +                configuration.getText("doclet.Member_Table_Summary",
  24.215 +                configuration.getText("doclet.Class_Summary"),
  24.216 +                configuration.getText("doclet.classes"));
  24.217 +        String[] classTableHeader = new String[] {
  24.218 +            configuration.getText("doclet.Class"),
  24.219 +            configuration.getText("doclet.Description")
  24.220 +        };
  24.221 +        ClassDoc[] classes =
  24.222 +                packageDoc.isIncluded()
  24.223 +                        ? packageDoc.ordinaryClasses()
  24.224 +                        : configuration.classDocCatalog.ordinaryClasses(
  24.225 +                                Util.getPackageName(packageDoc));
  24.226 +        if (classes.length > 0) {
  24.227 +            profilePackageWriter.addClassesSummary(
  24.228 +                    classes,
  24.229 +                    configuration.getText("doclet.Class_Summary"),
  24.230 +                    classTableSummary, classTableHeader, summaryContentTree);
  24.231 +        }
  24.232 +    }
  24.233 +
  24.234 +    /**
  24.235 +     * Build the summary for the enums in this package.
  24.236 +     *
  24.237 +     * @param node the XML element that specifies which components to document
  24.238 +     * @param summaryContentTree the summary tree to which the enum summary will
  24.239 +     *                           be added
  24.240 +     */
  24.241 +    public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
  24.242 +        String enumTableSummary =
  24.243 +                configuration.getText("doclet.Member_Table_Summary",
  24.244 +                configuration.getText("doclet.Enum_Summary"),
  24.245 +                configuration.getText("doclet.enums"));
  24.246 +        String[] enumTableHeader = new String[] {
  24.247 +            configuration.getText("doclet.Enum"),
  24.248 +            configuration.getText("doclet.Description")
  24.249 +        };
  24.250 +        ClassDoc[] enums =
  24.251 +                packageDoc.isIncluded()
  24.252 +                        ? packageDoc.enums()
  24.253 +                        : configuration.classDocCatalog.enums(
  24.254 +                                Util.getPackageName(packageDoc));
  24.255 +        if (enums.length > 0) {
  24.256 +            profilePackageWriter.addClassesSummary(
  24.257 +                    enums,
  24.258 +                    configuration.getText("doclet.Enum_Summary"),
  24.259 +                    enumTableSummary, enumTableHeader, summaryContentTree);
  24.260 +        }
  24.261 +    }
  24.262 +
  24.263 +    /**
  24.264 +     * Build the summary for the exceptions in this package.
  24.265 +     *
  24.266 +     * @param node the XML element that specifies which components to document
  24.267 +     * @param summaryContentTree the summary tree to which the exception summary will
  24.268 +     *                           be added
  24.269 +     */
  24.270 +    public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
  24.271 +        String exceptionTableSummary =
  24.272 +                configuration.getText("doclet.Member_Table_Summary",
  24.273 +                configuration.getText("doclet.Exception_Summary"),
  24.274 +                configuration.getText("doclet.exceptions"));
  24.275 +        String[] exceptionTableHeader = new String[] {
  24.276 +            configuration.getText("doclet.Exception"),
  24.277 +            configuration.getText("doclet.Description")
  24.278 +        };
  24.279 +        ClassDoc[] exceptions =
  24.280 +                packageDoc.isIncluded()
  24.281 +                        ? packageDoc.exceptions()
  24.282 +                        : configuration.classDocCatalog.exceptions(
  24.283 +                                Util.getPackageName(packageDoc));
  24.284 +        if (exceptions.length > 0) {
  24.285 +            profilePackageWriter.addClassesSummary(
  24.286 +                    exceptions,
  24.287 +                    configuration.getText("doclet.Exception_Summary"),
  24.288 +                    exceptionTableSummary, exceptionTableHeader, summaryContentTree);
  24.289 +        }
  24.290 +    }
  24.291 +
  24.292 +    /**
  24.293 +     * Build the summary for the errors in this package.
  24.294 +     *
  24.295 +     * @param node the XML element that specifies which components to document
  24.296 +     * @param summaryContentTree the summary tree to which the error summary will
  24.297 +     *                           be added
  24.298 +     */
  24.299 +    public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
  24.300 +        String errorTableSummary =
  24.301 +                configuration.getText("doclet.Member_Table_Summary",
  24.302 +                configuration.getText("doclet.Error_Summary"),
  24.303 +                configuration.getText("doclet.errors"));
  24.304 +        String[] errorTableHeader = new String[] {
  24.305 +            configuration.getText("doclet.Error"),
  24.306 +            configuration.getText("doclet.Description")
  24.307 +        };
  24.308 +        ClassDoc[] errors =
  24.309 +                packageDoc.isIncluded()
  24.310 +                        ? packageDoc.errors()
  24.311 +                        : configuration.classDocCatalog.errors(
  24.312 +                                Util.getPackageName(packageDoc));
  24.313 +        if (errors.length > 0) {
  24.314 +            profilePackageWriter.addClassesSummary(
  24.315 +                    errors,
  24.316 +                    configuration.getText("doclet.Error_Summary"),
  24.317 +                    errorTableSummary, errorTableHeader, summaryContentTree);
  24.318 +        }
  24.319 +    }
  24.320 +
  24.321 +    /**
  24.322 +     * Build the summary for the annotation type in this package.
  24.323 +     *
  24.324 +     * @param node the XML element that specifies which components to document
  24.325 +     * @param summaryContentTree the summary tree to which the annotation type
  24.326 +     *                           summary will be added
  24.327 +     */
  24.328 +    public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
  24.329 +        String annotationtypeTableSummary =
  24.330 +                configuration.getText("doclet.Member_Table_Summary",
  24.331 +                configuration.getText("doclet.Annotation_Types_Summary"),
  24.332 +                configuration.getText("doclet.annotationtypes"));
  24.333 +        String[] annotationtypeTableHeader = new String[] {
  24.334 +            configuration.getText("doclet.AnnotationType"),
  24.335 +            configuration.getText("doclet.Description")
  24.336 +        };
  24.337 +        ClassDoc[] annotationTypes =
  24.338 +                packageDoc.isIncluded()
  24.339 +                        ? packageDoc.annotationTypes()
  24.340 +                        : configuration.classDocCatalog.annotationTypes(
  24.341 +                                Util.getPackageName(packageDoc));
  24.342 +        if (annotationTypes.length > 0) {
  24.343 +            profilePackageWriter.addClassesSummary(
  24.344 +                    annotationTypes,
  24.345 +                    configuration.getText("doclet.Annotation_Types_Summary"),
  24.346 +                    annotationtypeTableSummary, annotationtypeTableHeader,
  24.347 +                    summaryContentTree);
  24.348 +        }
  24.349 +    }
  24.350 +
  24.351 +    /**
  24.352 +     * Build the description of the summary.
  24.353 +     *
  24.354 +     * @param node the XML element that specifies which components to document
  24.355 +     * @param packageContentTree the tree to which the package description will
  24.356 +     *                           be added
  24.357 +     */
  24.358 +    public void buildPackageDescription(XMLNode node, Content packageContentTree) {
  24.359 +        if (configuration.nocomment) {
  24.360 +            return;
  24.361 +        }
  24.362 +        profilePackageWriter.addPackageDescription(packageContentTree);
  24.363 +    }
  24.364 +
  24.365 +    /**
  24.366 +     * Build the tags of the summary.
  24.367 +     *
  24.368 +     * @param node the XML element that specifies which components to document
  24.369 +     * @param packageContentTree the tree to which the package tags will be added
  24.370 +     */
  24.371 +    public void buildPackageTags(XMLNode node, Content packageContentTree) {
  24.372 +        if (configuration.nocomment) {
  24.373 +            return;
  24.374 +        }
  24.375 +        profilePackageWriter.addPackageTags(packageContentTree);
  24.376 +    }
  24.377 +}
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Thu Feb 21 17:49:56 2013 -0800
    25.3 @@ -0,0 +1,328 @@
    25.4 +/*
    25.5 + * Copyright (c) 2013, 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.  Oracle designates this
   25.11 + * particular file as subject to the "Classpath" exception as provided
   25.12 + * by Oracle in the LICENSE file that accompanied this code.
   25.13 + *
   25.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   25.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.17 + * version 2 for more details (a copy is included in the LICENSE file that
   25.18 + * accompanied this code).
   25.19 + *
   25.20 + * You should have received a copy of the GNU General Public License version
   25.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   25.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.23 + *
   25.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.25 + * or visit www.oracle.com if you need additional information or have any
   25.26 + * questions.
   25.27 + */
   25.28 +
   25.29 +package com.sun.tools.doclets.internal.toolkit.builders;
   25.30 +
   25.31 +import java.io.*;
   25.32 +
   25.33 +import com.sun.javadoc.*;
   25.34 +import com.sun.tools.javac.jvm.Profile;
   25.35 +import com.sun.tools.doclets.internal.toolkit.*;
   25.36 +import com.sun.tools.doclets.internal.toolkit.util.*;
   25.37 +
   25.38 +/**
   25.39 + * Builds the summary for a given profile.
   25.40 + *
   25.41 + *  <p><b>This is NOT part of any supported API.
   25.42 + *  If you write code that depends on this, you do so at your own risk.
   25.43 + *  This code and its internal interfaces are subject to change or
   25.44 + *  deletion without notice.</b>
   25.45 + *
   25.46 + * @author Bhavesh Patel
   25.47 + */
   25.48 +public class ProfileSummaryBuilder extends AbstractBuilder {
   25.49 +    /**
   25.50 +     * The root element of the profile summary XML is {@value}.
   25.51 +     */
   25.52 +    public static final String ROOT = "ProfileDoc";
   25.53 +
   25.54 +    /**
   25.55 +     * The profile being documented.
   25.56 +     */
   25.57 +    private final Profile profile;
   25.58 +
   25.59 +    /**
   25.60 +     * The doclet specific writer that will output the result.
   25.61 +     */
   25.62 +    private final ProfileSummaryWriter profileWriter;
   25.63 +
   25.64 +    /**
   25.65 +     * The content that will be added to the profile summary documentation tree.
   25.66 +     */
   25.67 +    private Content contentTree;
   25.68 +
   25.69 +    /**
   25.70 +     * The profile package being documented.
   25.71 +     */
   25.72 +    private PackageDoc pkg;
   25.73 +
   25.74 +    /**
   25.75 +     * Construct a new ProfileSummaryBuilder.
   25.76 +     *
   25.77 +     * @param context  the build context.
   25.78 +     * @param profile the profile being documented.
   25.79 +     * @param profileWriter the doclet specific writer that will output the
   25.80 +     *        result.
   25.81 +     */
   25.82 +    private ProfileSummaryBuilder(Context context,
   25.83 +            Profile profile, ProfileSummaryWriter profileWriter) {
   25.84 +        super(context);
   25.85 +        this.profile = profile;
   25.86 +        this.profileWriter = profileWriter;
   25.87 +    }
   25.88 +
   25.89 +    /**
   25.90 +     * Construct a new ProfileSummaryBuilder.
   25.91 +     *
   25.92 +     * @param context  the build context.
   25.93 +     * @param profile the profile being documented.
   25.94 +     * @param profileWriter the doclet specific writer that will output the
   25.95 +     *        result.
   25.96 +     *
   25.97 +     * @return an instance of a ProfileSummaryBuilder.
   25.98 +     */
   25.99 +    public static ProfileSummaryBuilder getInstance(Context context,
  25.100 +            Profile profile, ProfileSummaryWriter profileWriter) {
  25.101 +        return new ProfileSummaryBuilder(context, profile, profileWriter);
  25.102 +    }
  25.103 +
  25.104 +    /**
  25.105 +     * Build the profile summary.
  25.106 +     */
  25.107 +    public void build() throws IOException {
  25.108 +        if (profileWriter == null) {
  25.109 +            //Doclet does not support this output.
  25.110 +            return;
  25.111 +        }
  25.112 +        build(layoutParser.parseXML(ROOT), contentTree);
  25.113 +    }
  25.114 +
  25.115 +    /**
  25.116 +     * {@inheritDoc}
  25.117 +     */
  25.118 +    public String getName() {
  25.119 +        return ROOT;
  25.120 +    }
  25.121 +
  25.122 +    /**
  25.123 +     * Build the profile documentation.
  25.124 +     *
  25.125 +     * @param node the XML element that specifies which components to document
  25.126 +     * @param contentTree the content tree to which the documentation will be added
  25.127 +     */
  25.128 +    public void buildProfileDoc(XMLNode node, Content contentTree) throws Exception {
  25.129 +        contentTree = profileWriter.getProfileHeader(profile.name);
  25.130 +        buildChildren(node, contentTree);
  25.131 +        profileWriter.addProfileFooter(contentTree);
  25.132 +        profileWriter.printDocument(contentTree);
  25.133 +        profileWriter.close();
  25.134 +        Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
  25.135 +    }
  25.136 +
  25.137 +    /**
  25.138 +     * Build the content for the profile doc.
  25.139 +     *
  25.140 +     * @param node the XML element that specifies which components to document
  25.141 +     * @param contentTree the content tree to which the profile contents
  25.142 +     *                    will be added
  25.143 +     */
  25.144 +    public void buildContent(XMLNode node, Content contentTree) {
  25.145 +        Content profileContentTree = profileWriter.getContentHeader();
  25.146 +        buildChildren(node, profileContentTree);
  25.147 +        contentTree.addContent(profileContentTree);
  25.148 +    }
  25.149 +
  25.150 +    /**
  25.151 +     * Build the profile summary.
  25.152 +     *
  25.153 +     * @param node the XML element that specifies which components to document
  25.154 +     * @param profileContentTree the profile content tree to which the summaries will
  25.155 +     *                           be added
  25.156 +     */
  25.157 +    public void buildSummary(XMLNode node, Content profileContentTree) {
  25.158 +        Content summaryContentTree = profileWriter.getSummaryHeader();
  25.159 +        buildChildren(node, summaryContentTree);
  25.160 +        profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree));
  25.161 +    }
  25.162 +
  25.163 +    /**
  25.164 +     * Build the profile package summary.
  25.165 +     *
  25.166 +     * @param node the XML element that specifies which components to document
  25.167 +     * @param summaryContentTree the content tree to which the summaries will
  25.168 +     *                           be added
  25.169 +     */
  25.170 +    public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
  25.171 +        PackageDoc[] packages = configuration.profilePackages.get(profile.name);
  25.172 +        for (int i = 0; i < packages.length; i++) {
  25.173 +            this.pkg = packages[i];
  25.174 +            Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
  25.175 +            buildChildren(node, packageSummaryContentTree);
  25.176 +            summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
  25.177 +                    packageSummaryContentTree));
  25.178 +        }
  25.179 +    }
  25.180 +
  25.181 +    /**
  25.182 +     * Build the summary for the interfaces in the package.
  25.183 +     *
  25.184 +     * @param node the XML element that specifies which components to document
  25.185 +     * @param packageSummaryContentTree the tree to which the interface summary
  25.186 +     *                           will be added
  25.187 +     */
  25.188 +    public void buildInterfaceSummary(XMLNode node, Content packageSummaryContentTree) {
  25.189 +        String interfaceTableSummary =
  25.190 +                configuration.getText("doclet.Member_Table_Summary",
  25.191 +                configuration.getText("doclet.Interface_Summary"),
  25.192 +                configuration.getText("doclet.interfaces"));
  25.193 +        String[] interfaceTableHeader = new String[] {
  25.194 +            configuration.getText("doclet.Interface"),
  25.195 +            configuration.getText("doclet.Description")
  25.196 +        };
  25.197 +        ClassDoc[] interfaces = pkg.interfaces();
  25.198 +        if (interfaces.length > 0) {
  25.199 +            profileWriter.addClassesSummary(
  25.200 +                    interfaces,
  25.201 +                    configuration.getText("doclet.Interface_Summary"),
  25.202 +                    interfaceTableSummary, interfaceTableHeader, packageSummaryContentTree);
  25.203 +        }
  25.204 +    }
  25.205 +
  25.206 +    /**
  25.207 +     * Build the summary for the classes in the package.
  25.208 +     *
  25.209 +     * @param node the XML element that specifies which components to document
  25.210 +     * @param packageSummaryContentTree the tree to which the class summary will
  25.211 +     *                           be added
  25.212 +     */
  25.213 +    public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
  25.214 +        String classTableSummary =
  25.215 +                configuration.getText("doclet.Member_Table_Summary",
  25.216 +                configuration.getText("doclet.Class_Summary"),
  25.217 +                configuration.getText("doclet.classes"));
  25.218 +        String[] classTableHeader = new String[] {
  25.219 +            configuration.getText("doclet.Class"),
  25.220 +            configuration.getText("doclet.Description")
  25.221 +        };
  25.222 +        ClassDoc[] classes = pkg.ordinaryClasses();
  25.223 +        if (classes.length > 0) {
  25.224 +            profileWriter.addClassesSummary(
  25.225 +                    classes,
  25.226 +                    configuration.getText("doclet.Class_Summary"),
  25.227 +                    classTableSummary, classTableHeader, packageSummaryContentTree);
  25.228 +        }
  25.229 +    }
  25.230 +
  25.231 +    /**
  25.232 +     * Build the summary for the enums in the package.
  25.233 +     *
  25.234 +     * @param node the XML element that specifies which components to document
  25.235 +     * @param packageSummaryContentTree the tree to which the enum summary will
  25.236 +     *                           be added
  25.237 +     */
  25.238 +    public void buildEnumSummary(XMLNode node, Content packageSummaryContentTree) {
  25.239 +        String enumTableSummary =
  25.240 +                configuration.getText("doclet.Member_Table_Summary",
  25.241 +                configuration.getText("doclet.Enum_Summary"),
  25.242 +                configuration.getText("doclet.enums"));
  25.243 +        String[] enumTableHeader = new String[] {
  25.244 +            configuration.getText("doclet.Enum"),
  25.245 +            configuration.getText("doclet.Description")
  25.246 +        };
  25.247 +        ClassDoc[] enums = pkg.enums();
  25.248 +        if (enums.length > 0) {
  25.249 +            profileWriter.addClassesSummary(
  25.250 +                    enums,
  25.251 +                    configuration.getText("doclet.Enum_Summary"),
  25.252 +                    enumTableSummary, enumTableHeader, packageSummaryContentTree);
  25.253 +        }
  25.254 +    }
  25.255 +
  25.256 +    /**
  25.257 +     * Build the summary for the exceptions in the package.
  25.258 +     *
  25.259 +     * @param node the XML element that specifies which components to document
  25.260 +     * @param packageSummaryContentTree the tree to which the exception summary will
  25.261 +     *                           be added
  25.262 +     */
  25.263 +    public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
  25.264 +        String exceptionTableSummary =
  25.265 +                configuration.getText("doclet.Member_Table_Summary",
  25.266 +                configuration.getText("doclet.Exception_Summary"),
  25.267 +                configuration.getText("doclet.exceptions"));
  25.268 +        String[] exceptionTableHeader = new String[] {
  25.269 +            configuration.getText("doclet.Exception"),
  25.270 +            configuration.getText("doclet.Description")
  25.271 +        };
  25.272 +        ClassDoc[] exceptions = pkg.exceptions();
  25.273 +        if (exceptions.length > 0) {
  25.274 +            profileWriter.addClassesSummary(
  25.275 +                    exceptions,
  25.276 +                    configuration.getText("doclet.Exception_Summary"),
  25.277 +                    exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree);
  25.278 +        }
  25.279 +    }
  25.280 +
  25.281 +    /**
  25.282 +     * Build the summary for the errors in the package.
  25.283 +     *
  25.284 +     * @param node the XML element that specifies which components to document
  25.285 +     * @param packageSummaryContentTree the tree to which the error summary will
  25.286 +     *                           be added
  25.287 +     */
  25.288 +    public void buildErrorSummary(XMLNode node, Content packageSummaryContentTree) {
  25.289 +        String errorTableSummary =
  25.290 +                configuration.getText("doclet.Member_Table_Summary",
  25.291 +                configuration.getText("doclet.Error_Summary"),
  25.292 +                configuration.getText("doclet.errors"));
  25.293 +        String[] errorTableHeader = new String[] {
  25.294 +            configuration.getText("doclet.Error"),
  25.295 +            configuration.getText("doclet.Description")
  25.296 +        };
  25.297 +        ClassDoc[] errors = pkg.errors();
  25.298 +        if (errors.length > 0) {
  25.299 +            profileWriter.addClassesSummary(
  25.300 +                    errors,
  25.301 +                    configuration.getText("doclet.Error_Summary"),
  25.302 +                    errorTableSummary, errorTableHeader, packageSummaryContentTree);
  25.303 +        }
  25.304 +    }
  25.305 +
  25.306 +    /**
  25.307 +     * Build the summary for the annotation type in the package.
  25.308 +     *
  25.309 +     * @param node the XML element that specifies which components to document
  25.310 +     * @param packageSummaryContentTree the tree to which the annotation type
  25.311 +     *                           summary will be added
  25.312 +     */
  25.313 +    public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) {
  25.314 +        String annotationtypeTableSummary =
  25.315 +                configuration.getText("doclet.Member_Table_Summary",
  25.316 +                configuration.getText("doclet.Annotation_Types_Summary"),
  25.317 +                configuration.getText("doclet.annotationtypes"));
  25.318 +        String[] annotationtypeTableHeader = new String[] {
  25.319 +            configuration.getText("doclet.AnnotationType"),
  25.320 +            configuration.getText("doclet.Description")
  25.321 +        };
  25.322 +        ClassDoc[] annotationTypes = pkg.annotationTypes();
  25.323 +        if (annotationTypes.length > 0) {
  25.324 +            profileWriter.addClassesSummary(
  25.325 +                    annotationTypes,
  25.326 +                    configuration.getText("doclet.Annotation_Types_Summary"),
  25.327 +                    annotationtypeTableSummary, annotationtypeTableHeader,
  25.328 +                    packageSummaryContentTree);
  25.329 +        }
  25.330 +    }
  25.331 +}
    26.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 21 12:23:27 2013 -0800
    26.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 21 17:49:56 2013 -0800
    26.3 @@ -28,6 +28,21 @@
    26.4  
    26.5  <Doclet>
    26.6  
    26.7 +    <ProfileDoc>
    26.8 +        <Content>
    26.9 +            <Summary>
   26.10 +                <PackageSummary>
   26.11 +                    <InterfaceSummary/>
   26.12 +                    <ClassSummary/>
   26.13 +                    <EnumSummary/>
   26.14 +                    <ExceptionSummary/>
   26.15 +                    <ErrorSummary/>
   26.16 +                    <AnnotationTypeSummary/>
   26.17 +                </PackageSummary>
   26.18 +            </Summary>
   26.19 +        </Content>
   26.20 +    </ProfileDoc>
   26.21 +
   26.22      <PackageDoc>
   26.23          <Content>
   26.24              <Summary>
    27.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Thu Feb 21 12:23:27 2013 -0800
    27.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Thu Feb 21 17:49:56 2013 -0800
    27.3 @@ -31,6 +31,7 @@
    27.4  doclet.Building_Index_For_All_Classes=Building index for all classes...
    27.5  doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0.
    27.6  doclet.Packages=Packages
    27.7 +doclet.Profiles=Profiles
    27.8  doclet.Other_Packages=Other Packages
    27.9  doclet.Notice_taglet_registered=Registered Taglet {0} ...
   27.10  doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0}
   27.11 @@ -61,6 +62,7 @@
   27.12  doclet.malformed_html_link_tag=<a> tag is malformed:\n"{0}"
   27.13  doclet.tag_misuse=Tag {0} cannot be used in {1} documentation.  It can only be used in the following types of documentation: {2}.
   27.14  doclet.Package_Summary=Package Summary
   27.15 +doclet.Profile_Summary=Profile Summary
   27.16  doclet.Interface_Summary=Interface Summary
   27.17  doclet.Annotation_Types_Summary=Annotation Types Summary
   27.18  doclet.Enum_Summary=Enum Summary
   27.19 @@ -82,6 +84,7 @@
   27.20  doclet.Classes=Classes
   27.21  doclet.Packages=Packages
   27.22  doclet.packages=packages
   27.23 +doclet.profiles=profiles
   27.24  doclet.All_Classes=All Classes
   27.25  doclet.All_Superinterfaces=All Superinterfaces:
   27.26  doclet.All_Implemented_Interfaces=All Implemented Interfaces:
    28.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Feb 21 12:23:27 2013 -0800
    28.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Feb 21 17:49:56 2013 -0800
    28.3 @@ -191,6 +191,9 @@
    28.4      margin:10px;
    28.5      position:relative;
    28.6  }
    28.7 +.indexHeader span{
    28.8 +    margin-right:15px;
    28.9 +}
   28.10  .indexHeader h1 {
   28.11      font-size:1.3em;
   28.12  }
    29.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Thu Feb 21 12:23:27 2013 -0800
    29.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Thu Feb 21 17:49:56 2013 -0800
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
   29.10 @@ -87,6 +87,26 @@
   29.11      /** The name of the file for the package frame. */
   29.12      public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
   29.13  
   29.14 +    /** The name of the file for the profile frame. */
   29.15 +     public static final DocPath profileFrame(String profileName) {
   29.16 +        return DocPath.create(profileName + "-frame.html");
   29.17 +    }
   29.18 +
   29.19 +    /** The name of the file for the profile package frame. */
   29.20 +     public static final DocPath profilePackageFrame(String profileName) {
   29.21 +        return DocPath.create(profileName + "-package-frame.html");
   29.22 +    }
   29.23 +
   29.24 +    /** The name of the file for the profile package summary. */
   29.25 +     public static final DocPath profilePackageSummary(String profileName) {
   29.26 +        return DocPath.create(profileName + "-package-summary.html");
   29.27 +    }
   29.28 +
   29.29 +    /** The name of the file for the profile summary. */
   29.30 +     public static final DocPath profileSummary(String profileName) {
   29.31 +        return DocPath.create(profileName + "-summary.html");
   29.32 +    }
   29.33 +
   29.34      /** The name of the file for the package list. */
   29.35      public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
   29.36  
   29.37 @@ -99,6 +119,9 @@
   29.38      /** The name of the file for the package usage info. */
   29.39      public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
   29.40  
   29.41 +    /** The name of the file for the overview frame. */
   29.42 +    public static final DocPath PROFILE_OVERVIEW_FRAME = DocPath.create("profile-overview-frame.html");
   29.43 +
   29.44      /** The name of the directory in which resources are generated.
   29.45       *  Also the name of the sub-package from which resources are read.
   29.46       */
    30.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Thu Feb 21 12:23:27 2013 -0800
    30.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Thu Feb 21 17:49:56 2013 -0800
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -28,6 +28,7 @@
   30.11  import java.util.*;
   30.12  
   30.13  import com.sun.javadoc.*;
   30.14 +import com.sun.tools.javac.jvm.Profile;
   30.15  import com.sun.tools.doclets.internal.toolkit.*;
   30.16  
   30.17  /**
   30.18 @@ -105,6 +106,20 @@
   30.19      }
   30.20  
   30.21      /**
   30.22 +     * Get the profile keywords.
   30.23 +     *
   30.24 +     * @param profile the profile being documented
   30.25 +     */
   30.26 +    public String[] getMetaKeywords(Profile profile) {
   30.27 +        if( configuration.keywords ) {
   30.28 +            String profileName = profile.name;
   30.29 +            return new String[] { profileName + " " + "profile" };
   30.30 +        } else {
   30.31 +            return new String[] {};
   30.32 +        }
   30.33 +    }
   30.34 +
   30.35 +    /**
   30.36       * Get the overview keywords.
   30.37       */
   30.38      public String[] getOverviewMetaKeywords(String title, String docTitle) {
    31.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Feb 21 12:23:27 2013 -0800
    31.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Feb 21 17:49:56 2013 -0800
    31.3 @@ -158,10 +158,11 @@
    31.4                  throw new IllegalStateException();
    31.5          } else {
    31.6              initContext();
    31.7 +            compilerMain.log = Log.instance(context);
    31.8              compilerMain.setOptions(Options.instance(context));
    31.9              compilerMain.filenames = new LinkedHashSet<File>();
   31.10              Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
   31.11 -            if (!filenames.isEmpty())
   31.12 +            if (filenames != null && !filenames.isEmpty())
   31.13                  throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
   31.14              compiler = JavaCompiler.instance(context);
   31.15              compiler.keepComments = true;
    32.1 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 21 12:23:27 2013 -0800
    32.2 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 21 17:49:56 2013 -0800
    32.3 @@ -269,6 +269,11 @@
    32.4      public static final long AUXILIARY = 1L<<44;
    32.5  
    32.6      /**
    32.7 +     * Flag that marks that a symbol is not available in the current profile
    32.8 +     */
    32.9 +    public static final long NOT_IN_PROFILE = 1L<<45;
   32.10 +
   32.11 +    /**
   32.12       * Flag that indicates that an override error has been detected by Check.
   32.13       */
   32.14      public static final long BAD_OVERRIDE = 1L<<45;
    33.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 21 12:23:27 2013 -0800
    33.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 21 17:49:56 2013 -0800
    33.3 @@ -157,6 +157,7 @@
    33.4      public final Type deprecatedType;
    33.5      public final Type suppressWarningsType;
    33.6      public final Type inheritedType;
    33.7 +    public final Type profileType;
    33.8      public final Type proprietaryType;
    33.9      public final Type systemType;
   33.10      public final Type autoCloseableType;
   33.11 @@ -361,6 +362,22 @@
   33.12  
   33.13      }
   33.14  
   33.15 +    // Enter a synthetic class that is used to mark classes in ct.sym.
   33.16 +    // This class does not have a class file.
   33.17 +    private Type enterSyntheticAnnotation(String name) {
   33.18 +        ClassType type = (ClassType)enterClass(name);
   33.19 +        ClassSymbol sym = (ClassSymbol)type.tsym;
   33.20 +        sym.completer = null;
   33.21 +        sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
   33.22 +        sym.erasure_field = type;
   33.23 +        sym.members_field = new Scope(sym);
   33.24 +        type.typarams_field = List.nil();
   33.25 +        type.allparams_field = List.nil();
   33.26 +        type.supertype_field = annotationType;
   33.27 +        type.interfaces_field = List.nil();
   33.28 +        return type;
   33.29 +    }
   33.30 +
   33.31      /** Constructor; enters all predefined identifiers and operators
   33.32       *  into symbol table.
   33.33       */
   33.34 @@ -524,17 +541,13 @@
   33.35          // Enter a synthetic class that is used to mark internal
   33.36          // proprietary classes in ct.sym.  This class does not have a
   33.37          // class file.
   33.38 -        ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
   33.39 -        this.proprietaryType = proprietaryType;
   33.40 -        ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
   33.41 -        proprietarySymbol.completer = null;
   33.42 -        proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
   33.43 -        proprietarySymbol.erasure_field = proprietaryType;
   33.44 -        proprietarySymbol.members_field = new Scope(proprietarySymbol);
   33.45 -        proprietaryType.typarams_field = List.nil();
   33.46 -        proprietaryType.allparams_field = List.nil();
   33.47 -        proprietaryType.supertype_field = annotationType;
   33.48 -        proprietaryType.interfaces_field = List.nil();
   33.49 +        proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
   33.50 +
   33.51 +        // Enter a synthetic class that is used to provide profile info for
   33.52 +        // classes in ct.sym.  This class does not have a class file.
   33.53 +        profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
   33.54 +        MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
   33.55 +        profileType.tsym.members().enter(m);
   33.56  
   33.57          // Enter a class for arrays.
   33.58          // The class implements java.lang.Cloneable and java.io.Serializable.
    34.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 21 12:23:27 2013 -0800
    34.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 21 17:49:56 2013 -0800
    34.3 @@ -3412,6 +3412,7 @@
    34.4              if (sym.name != names.init) {
    34.5                  chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym);
    34.6                  chk.checkSunAPI(tree.pos(), sym);
    34.7 +                chk.checkProfile(tree.pos(), sym);
    34.8              }
    34.9  
   34.10              // Test (3): if symbol is a variable, check that its type and
    35.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 21 12:23:27 2013 -0800
    35.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 21 17:49:56 2013 -0800
    35.3 @@ -80,6 +80,7 @@
    35.4      private boolean enableSunApiLintControl;
    35.5      private final TreeInfo treeinfo;
    35.6      private final JavaFileManager fileManager;
    35.7 +    private final Profile profile;
    35.8  
    35.9      // The set of lint options currently in effect. It is initialized
   35.10      // from the context, and then is set/reset as needed by Attr as it
   35.11 @@ -110,7 +111,7 @@
   35.12          enter = Enter.instance(context);
   35.13          deferredAttr = DeferredAttr.instance(context);
   35.14          infer = Infer.instance(context);
   35.15 -        this.types = Types.instance(context);
   35.16 +        types = Types.instance(context);
   35.17          diags = JCDiagnostic.Factory.instance(context);
   35.18          Options options = Options.instance(context);
   35.19          lint = Lint.instance(context);
   35.20 @@ -133,6 +134,8 @@
   35.21          Target target = Target.instance(context);
   35.22          syntheticNameChar = target.syntheticNameChar();
   35.23  
   35.24 +        profile = Profile.instance(context);
   35.25 +
   35.26          boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
   35.27          boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
   35.28          boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
   35.29 @@ -3068,6 +3071,12 @@
   35.30          }
   35.31      }
   35.32  
   35.33 +    void checkProfile(final DiagnosticPosition pos, final Symbol s) {
   35.34 +        if (profile != Profile.DEFAULT && (s.flags() & NOT_IN_PROFILE) != 0) {
   35.35 +            log.error(pos, "not.in.profile", s, profile);
   35.36 +        }
   35.37 +    }
   35.38 +
   35.39  /* *************************************************************************
   35.40   * Check for recursive annotation elements.
   35.41   **************************************************************************/
    36.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 21 12:23:27 2013 -0800
    36.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 21 17:49:56 2013 -0800
    36.3 @@ -134,6 +134,11 @@
    36.4       **/
    36.5      public boolean preferSource;
    36.6  
    36.7 +    /**
    36.8 +     * The currently selected profile.
    36.9 +     */
   36.10 +    public final Profile profile;
   36.11 +
   36.12      /** The log to use for verbose output
   36.13       */
   36.14      final Log log;
   36.15 @@ -284,16 +289,20 @@
   36.16          annotate = Annotate.instance(context);
   36.17          verbose        = options.isSet(VERBOSE);
   36.18          checkClassFile = options.isSet("-checkclassfile");
   36.19 +
   36.20          Source source = Source.instance(context);
   36.21          allowGenerics    = source.allowGenerics();
   36.22          allowVarargs     = source.allowVarargs();
   36.23          allowAnnotations = source.allowAnnotations();
   36.24          allowSimplifiedVarargs = source.allowSimplifiedVarargs();
   36.25          allowDefaultMethods = source.allowDefaultMethods();
   36.26 +
   36.27          saveParameterNames = options.isSet("save-parameter-names");
   36.28          cacheCompletionFailure = options.isUnset("dev");
   36.29          preferSource = "source".equals(options.get("-Xprefer"));
   36.30  
   36.31 +        profile = Profile.instance(context);
   36.32 +
   36.33          completionFailureName =
   36.34              options.isSet("failcomplete")
   36.35              ? names.fromString(options.get("failcomplete"))
   36.36 @@ -1372,7 +1381,18 @@
   36.37                  CompoundAnnotationProxy proxy = readCompoundAnnotation();
   36.38                  if (proxy.type.tsym == syms.proprietaryType.tsym)
   36.39                      sym.flags_field |= PROPRIETARY;
   36.40 -                else
   36.41 +                else if (proxy.type.tsym == syms.profileType.tsym) {
   36.42 +                    if (profile != Profile.DEFAULT) {
   36.43 +                        for (Pair<Name,Attribute> v: proxy.values) {
   36.44 +                            if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
   36.45 +                                Attribute.Constant c = (Attribute.Constant) v.snd;
   36.46 +                                if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
   36.47 +                                    sym.flags_field |= NOT_IN_PROFILE;
   36.48 +                                }
   36.49 +                            }
   36.50 +                        }
   36.51 +                    }
   36.52 +                } else
   36.53                      proxies.append(proxy);
   36.54              }
   36.55              annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Profile.java	Thu Feb 21 17:49:56 2013 -0800
    37.3 @@ -0,0 +1,105 @@
    37.4 +/*
    37.5 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
    37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.7 + *
    37.8 + * This code is free software; you can redistribute it and/or modify it
    37.9 + * under the terms of the GNU General Public License version 2 only, as
   37.10 + * published by the Free Software Foundation.  Oracle designates this
   37.11 + * particular file as subject to the "Classpath" exception as provided
   37.12 + * by Oracle in the LICENSE file that accompanied this code.
   37.13 + *
   37.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   37.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   37.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   37.17 + * version 2 for more details (a copy is included in the LICENSE file that
   37.18 + * accompanied this code).
   37.19 + *
   37.20 + * You should have received a copy of the GNU General Public License version
   37.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   37.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   37.23 + *
   37.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   37.25 + * or visit www.oracle.com if you need additional information or have any
   37.26 + * questions.
   37.27 + */
   37.28 +package com.sun.tools.javac.jvm;
   37.29 +
   37.30 +import com.sun.tools.javac.util.Context;
   37.31 +import com.sun.tools.javac.util.Options;
   37.32 +import java.util.EnumSet;
   37.33 +import java.util.Set;
   37.34 +
   37.35 +import static com.sun.tools.javac.main.Option.PROFILE;
   37.36 +
   37.37 +/** The target profile.
   37.38 + *
   37.39 + *  <p><b>This is NOT part of any supported API.
   37.40 + *  If you write code that depends on this, you do so at your own risk.
   37.41 + *  This code and its internal interfaces are subject to change or
   37.42 + *  deletion without notice.</b>
   37.43 + */
   37.44 +public enum Profile {
   37.45 +    COMPACT1("compact1", 1, Target.JDK1_8),
   37.46 +    COMPACT2("compact2", 2, Target.JDK1_8),
   37.47 +    COMPACT3("compact3", 3, Target.JDK1_8),
   37.48 +
   37.49 +    DEFAULT {
   37.50 +        @Override
   37.51 +        public boolean isValid(Target t) {
   37.52 +            return true;
   37.53 +        }
   37.54 +    };
   37.55 +
   37.56 +    private static final Context.Key<Profile> profileKey =
   37.57 +        new Context.Key<Profile>();
   37.58 +
   37.59 +    public static Profile instance(Context context) {
   37.60 +        Profile instance = context.get(profileKey);
   37.61 +        if (instance == null) {
   37.62 +            Options options = Options.instance(context);
   37.63 +            String profileString = options.get(PROFILE);
   37.64 +            if (profileString != null) instance = lookup(profileString);
   37.65 +            if (instance == null) instance = DEFAULT;
   37.66 +            context.put(profileKey, instance);
   37.67 +        }
   37.68 +        return instance;
   37.69 +    }
   37.70 +
   37.71 +    public final String name;
   37.72 +    public final int value;
   37.73 +    final Set<Target> targets;
   37.74 +
   37.75 +    Profile() {
   37.76 +        name = null;
   37.77 +        value = Integer.MAX_VALUE;
   37.78 +        targets = null;
   37.79 +    }
   37.80 +
   37.81 +    Profile(String name, int value, Target t, Target... targets) {
   37.82 +        this.name = name;
   37.83 +        this.value = value;
   37.84 +        this.targets = EnumSet.of(t, targets);
   37.85 +    }
   37.86 +
   37.87 +    public static Profile lookup(String name) {
   37.88 +        // the set of values is small enough to do linear search
   37.89 +        for (Profile p: values()) {
   37.90 +            if (name.equals(p.name))
   37.91 +                return p;
   37.92 +        }
   37.93 +        return null;
   37.94 +    }
   37.95 +
   37.96 +    public static Profile lookup(int value) {
   37.97 +        // the set of values is small enough to do linear search
   37.98 +        for (Profile p: values()) {
   37.99 +            if (value == p.value)
  37.100 +                return p;
  37.101 +        }
  37.102 +        return null;
  37.103 +    }
  37.104 +
  37.105 +    public boolean isValid(Target t) {
  37.106 +        return targets.contains(t);
  37.107 +    }
  37.108 +}
    38.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Feb 21 12:23:27 2013 -0800
    38.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Feb 21 17:49:56 2013 -0800
    38.3 @@ -31,7 +31,7 @@
    38.4  import com.sun.tools.javac.code.Symbol;
    38.5  import com.sun.tools.javac.util.*;
    38.6  
    38.7 -import static com.sun.tools.javac.main.Option.*;
    38.8 +import static com.sun.tools.javac.main.Option.TARGET;
    38.9  
   38.10  /** The classfile version target.
   38.11   *
    39.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 21 12:23:27 2013 -0800
    39.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 21 17:49:56 2013 -0800
    39.3 @@ -49,6 +49,7 @@
    39.4  import com.sun.tools.javac.code.Source;
    39.5  import com.sun.tools.javac.file.CacheFSInfo;
    39.6  import com.sun.tools.javac.file.JavacFileManager;
    39.7 +import com.sun.tools.javac.jvm.Profile;
    39.8  import com.sun.tools.javac.jvm.Target;
    39.9  import com.sun.tools.javac.processing.AnnotationProcessingError;
   39.10  import com.sun.tools.javac.processing.JavacProcessingEnvironment;
   39.11 @@ -76,7 +77,7 @@
   39.12  
   39.13      /** The log to use for diagnostic output.
   39.14       */
   39.15 -    Log log;
   39.16 +    public Log log;
   39.17  
   39.18      /**
   39.19       * If true, certain errors will cause an exception, such as command line
   39.20 @@ -165,6 +166,7 @@
   39.21          this.ownName = name;
   39.22          this.out = out;
   39.23      }
   39.24 +
   39.25      /** A table of all options that's passed to the JavaCompiler constructor.  */
   39.26      private Options options = null;
   39.27  
   39.28 @@ -307,6 +309,15 @@
   39.29              }
   39.30          }
   39.31  
   39.32 +        String profileString = options.get(PROFILE);
   39.33 +        if (profileString != null) {
   39.34 +            Profile profile = Profile.lookup(profileString);
   39.35 +            if (!profile.isValid(target)) {
   39.36 +                warning("warn.profile.target.conflict", profileString, target.name);
   39.37 +                return null;
   39.38 +            }
   39.39 +        }
   39.40 +
   39.41          // handle this here so it works even if no other options given
   39.42          String showClass = options.get("showClass");
   39.43          if (showClass != null) {
    40.1 --- a/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 21 12:23:27 2013 -0800
    40.2 +++ b/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 21 17:49:56 2013 -0800
    40.3 @@ -40,6 +40,7 @@
    40.4  import com.sun.tools.javac.code.Lint;
    40.5  import com.sun.tools.javac.code.Source;
    40.6  import com.sun.tools.javac.code.Type;
    40.7 +import com.sun.tools.javac.jvm.Profile;
    40.8  import com.sun.tools.javac.jvm.Target;
    40.9  import com.sun.tools.javac.processing.JavacProcessingEnvironment;
   40.10  import com.sun.tools.javac.util.Log;
   40.11 @@ -218,6 +219,18 @@
   40.12          }
   40.13      },
   40.14  
   40.15 +    PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) {
   40.16 +        @Override
   40.17 +        public boolean process(OptionHelper helper, String option, String operand) {
   40.18 +            Profile profile = Profile.lookup(operand);
   40.19 +            if (profile == null) {
   40.20 +                helper.error("err.invalid.profile", operand);
   40.21 +                return true;
   40.22 +            }
   40.23 +            return super.process(helper, option, operand);
   40.24 +        }
   40.25 +    },
   40.26 +
   40.27      VERSION("-version", "opt.version", STANDARD, INFO) {
   40.28          @Override
   40.29          public boolean process(OptionHelper helper, String option) {
    41.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 21 12:23:27 2013 -0800
    41.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 21 17:49:56 2013 -0800
    41.3 @@ -485,6 +485,10 @@
    41.4  compiler.err.illegal.forward.ref=\
    41.5      illegal forward reference
    41.6  
    41.7 +# 0: symbol, 1: string
    41.8 +compiler.err.not.in.profile=\
    41.9 +    {0} is not available in profile ''{1}''
   41.10 +
   41.11  # 0: symbol
   41.12  compiler.warn.forward.ref=\
   41.13      reference to variable ''{0}'' before it has been initialized
    42.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Feb 21 12:23:27 2013 -0800
    42.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Feb 21 17:49:56 2013 -0800
    42.3 @@ -69,6 +69,8 @@
    42.4      Pass <flag> directly to the runtime system
    42.5  javac.opt.encoding=\
    42.6      Specify character encoding used by source files
    42.7 +javac.opt.profile=\
    42.8 +    Check that API used is available in the specified profile
    42.9  javac.opt.target=\
   42.10      Generate class files for specific VM version
   42.11  javac.opt.source=\
   42.12 @@ -97,6 +99,8 @@
   42.13      <directory>
   42.14  javac.opt.arg.encoding=\
   42.15      <encoding>
   42.16 +javac.opt.arg.profile=\
   42.17 +    <profile>
   42.18  javac.opt.arg.release=\
   42.19      <release>
   42.20  javac.opt.arg.number=\
   42.21 @@ -175,6 +179,8 @@
   42.22       key in annotation processor option ''{0}'' is not a dot-separated sequence of identifiers
   42.23  javac.err.invalid.flag=\
   42.24      invalid flag: {0}
   42.25 +javac.err.invalid.profile=\
   42.26 +    invalid profile: {0}
   42.27  javac.err.invalid.target=\
   42.28      invalid target release: {0}
   42.29  javac.err.no.source.files=\
   42.30 @@ -191,6 +197,8 @@
   42.31      source release {0} requires target release {1}
   42.32  javac.warn.target.default.source.conflict=\
   42.33      target release {0} conflicts with default source release {1}
   42.34 +javac.warn.profile.target.conflict=\
   42.35 +    profile {0} is not valid for target release {1}
   42.36  javac.err.dir.not.found=\
   42.37      directory not found: {0}
   42.38  javac.err.file.not.found=\
    43.1 --- a/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Feb 21 12:23:27 2013 -0800
    43.2 +++ b/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Feb 21 17:49:56 2013 -0800
    43.3 @@ -34,11 +34,11 @@
    43.4  import com.sun.tools.javac.code.Symtab;
    43.5  import com.sun.tools.javac.code.Type;
    43.6  import com.sun.tools.javac.code.Types;
    43.7 -import com.sun.tools.javac.jvm.ClassReader;
    43.8  import com.sun.tools.javac.jvm.ClassWriter;
    43.9  import com.sun.tools.javac.jvm.Pool;
   43.10  import com.sun.tools.javac.processing.JavacProcessingEnvironment;
   43.11  import com.sun.tools.javac.util.List;
   43.12 +import com.sun.tools.javac.util.Names;
   43.13  import com.sun.tools.javac.util.Pair;
   43.14  
   43.15  import java.io.File;
   43.16 @@ -47,6 +47,7 @@
   43.17  import java.util.EnumSet;
   43.18  import java.util.Enumeration;
   43.19  import java.util.HashSet;
   43.20 +import java.util.Map;
   43.21  import java.util.ResourceBundle;
   43.22  import java.util.Set;
   43.23  
   43.24 @@ -85,7 +86,10 @@
   43.25   *
   43.26   * @author Peter von der Ah\u00e9
   43.27   */
   43.28 -@SupportedOptions({"com.sun.tools.javac.sym.Jar","com.sun.tools.javac.sym.Dest"})
   43.29 +@SupportedOptions({
   43.30 +    "com.sun.tools.javac.sym.Jar",
   43.31 +    "com.sun.tools.javac.sym.Dest",
   43.32 +    "com.sun.tools.javac.sym.Profiles"})
   43.33  @SupportedAnnotationTypes("*")
   43.34  public class CreateSymbols extends AbstractProcessor {
   43.35  
   43.36 @@ -106,6 +110,7 @@
   43.37              processingEnv.getMessager()
   43.38                  .printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage());
   43.39          } catch (Throwable t) {
   43.40 +            t.printStackTrace();
   43.41              Throwable cause = t.getCause();
   43.42              if (cause == null)
   43.43                  cause = t;
   43.44 @@ -121,12 +126,17 @@
   43.45          Set<String> documented = new HashSet<String>();
   43.46          Set<PackageSymbol> packages =
   43.47              ((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages();
   43.48 -        String jarName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Jar");
   43.49 +        Map<String,String> pOptions = processingEnv.getOptions();
   43.50 +        String jarName = pOptions.get("com.sun.tools.javac.sym.Jar");
   43.51          if (jarName == null)
   43.52              throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Jar=LOCATION_OF_JAR");
   43.53 -        String destName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Dest");
   43.54 +        String destName = pOptions.get("com.sun.tools.javac.sym.Dest");
   43.55          if (destName == null)
   43.56              throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Dest=LOCATION_OF_JAR");
   43.57 +        String profileSpec=pOptions.get("com.sun.tools.javac.sym.Profiles");
   43.58 +        if (profileSpec == null)
   43.59 +            throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Profiles=PROFILES_SPEC");
   43.60 +        Profiles profiles = Profiles.read(new File(profileSpec));
   43.61  
   43.62          for (PackageSymbol psym : packages) {
   43.63              String name = psym.getQualifiedName().toString();
   43.64 @@ -166,12 +176,19 @@
   43.65              tool.getTask(null, fm, null, options, null, null);
   43.66          com.sun.tools.javac.main.JavaCompiler compiler =
   43.67              com.sun.tools.javac.main.JavaCompiler.instance(task.getContext());
   43.68 -        ClassReader reader = ClassReader.instance(task.getContext());
   43.69          ClassWriter writer = ClassWriter.instance(task.getContext());
   43.70          Symtab syms = Symtab.instance(task.getContext());
   43.71 -        Attribute.Compound proprietary =
   43.72 +        Names names = Names.instance(task.getContext());
   43.73 +        Attribute.Compound proprietaryAnno =
   43.74              new Attribute.Compound(syms.proprietaryType,
   43.75                                     List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
   43.76 +        Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1];
   43.77 +        Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym;
   43.78 +        for (int i = 1; i < profileAnnos.length; i++) {
   43.79 +            profileAnnos[i] = new Attribute.Compound(syms.profileType,
   43.80 +                    List.<Pair<Symbol.MethodSymbol, Attribute>>of(
   43.81 +                    new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
   43.82 +        }
   43.83  
   43.84          Type.moreInfo = true;
   43.85          Types types = Types.instance(task.getContext());
   43.86 @@ -208,8 +225,11 @@
   43.87              }
   43.88              ClassSymbol cs = (ClassSymbol) sym;
   43.89              if (addLegacyAnnotation) {
   43.90 -                cs.annotations.prepend(List.of(proprietary));
   43.91 +                cs.annotations.prepend(List.of(proprietaryAnno));
   43.92              }
   43.93 +            int p = profiles.getProfile(cs.fullname.toString().replace(".", "/"));
   43.94 +            if (0 < p && p < profileAnnos.length)
   43.95 +                cs.annotations.prepend(List.of(profileAnnos[p]));
   43.96              writeClass(pool, cs, writer);
   43.97          }
   43.98  
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Thu Feb 21 17:49:56 2013 -0800
    44.3 @@ -0,0 +1,298 @@
    44.4 +/*
    44.5 + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
    44.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.7 + *
    44.8 + * This code is free software; you can redistribute it and/or modify it
    44.9 + * under the terms of the GNU General Public License version 2 only, as
   44.10 + * published by the Free Software Foundation.  Oracle designates this
   44.11 + * particular file as subject to the "Classpath" exception as provided
   44.12 + * by Oracle in the LICENSE file that accompanied this code.
   44.13 + *
   44.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   44.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   44.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   44.17 + * version 2 for more details (a copy is included in the LICENSE file that
   44.18 + * accompanied this code).
   44.19 + *
   44.20 + * You should have received a copy of the GNU General Public License version
   44.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   44.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   44.23 + *
   44.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   44.25 + * or visit www.oracle.com if you need additional information or have any
   44.26 + * questions.
   44.27 + */
   44.28 +package com.sun.tools.javac.sym;
   44.29 +
   44.30 +import java.io.BufferedInputStream;
   44.31 +import java.io.BufferedWriter;
   44.32 +import java.io.File;
   44.33 +import java.io.FileInputStream;
   44.34 +import java.io.FileWriter;
   44.35 +import java.io.IOException;
   44.36 +import java.nio.charset.Charset;
   44.37 +import java.nio.file.Files;
   44.38 +import java.util.HashMap;
   44.39 +import java.util.Map;
   44.40 +import java.util.Properties;
   44.41 +import java.util.Set;
   44.42 +import java.util.TreeMap;
   44.43 +import java.util.TreeSet;
   44.44 +
   44.45 +import com.sun.tools.javac.util.Assert;
   44.46 +
   44.47 +/**
   44.48 + * Provide details about profile contents.
   44.49 + *
   44.50 + * <p><b>This is NOT part of any supported API.
   44.51 + * If you write code that depends on this, you do so at your own
   44.52 + * risk.  This code and its internal interfaces are subject to change
   44.53 + * or deletion without notice.</b></p>
   44.54 + */
   44.55 +public abstract class Profiles {
   44.56 +    // for debugging
   44.57 +    public static void main(String[] args) throws IOException {
   44.58 +        Profiles p = Profiles.read(new File(args[0]));
   44.59 +        if (args.length >= 2) {
   44.60 +            Map<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
   44.61 +            for (int i = 1; i <= 4; i++)
   44.62 +                lists.put(i, new TreeSet<String>());
   44.63 +
   44.64 +            File rt_jar_lst = new File(args[1]);
   44.65 +            for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) {
   44.66 +                if (line.endsWith(".class")) {
   44.67 +                    String type = line.substring(0, line.length() - 6);
   44.68 +                    int profile = p.getProfile(type);
   44.69 +                    for (int i = profile; i <= 4; i++)
   44.70 +                        lists.get(i).add(type);
   44.71 +                }
   44.72 +            }
   44.73 +
   44.74 +            for (int i = 1; i <= 4; i++) {
   44.75 +                BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
   44.76 +                try {
   44.77 +                    for (String type: lists.get(i)) {
   44.78 +                        out.write(type);
   44.79 +                        out.newLine();
   44.80 +                    }
   44.81 +                } finally {
   44.82 +                    out.close();
   44.83 +                }
   44.84 +            }
   44.85 +        }
   44.86 +    }
   44.87 +
   44.88 +    public static Profiles read(File file) throws IOException {
   44.89 +        BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
   44.90 +        try {
   44.91 +            Properties p = new Properties();
   44.92 +            p.load(in);
   44.93 +            if (p.containsKey("java/lang/Object"))
   44.94 +                return new SimpleProfiles(p);
   44.95 +            else
   44.96 +                return new MakefileProfiles(p);
   44.97 +        } finally {
   44.98 +            in.close();
   44.99 +        }
  44.100 +    }
  44.101 +
  44.102 +    public abstract int getProfileCount();
  44.103 +
  44.104 +    public abstract int getProfile(String typeName);
  44.105 +
  44.106 +    public abstract Set<String> getPackages(int profile);
  44.107 +
  44.108 +    private static class MakefileProfiles extends Profiles {
  44.109 +        static class Package {
  44.110 +            final Package parent;
  44.111 +            final String name;
  44.112 +
  44.113 +            Map<String, Package> subpackages = new TreeMap<String, Package>();
  44.114 +
  44.115 +            int profile;
  44.116 +            Map<String, Integer> includedTypes = new TreeMap<String,Integer>();
  44.117 +            Map<String, Integer> excludedTypes = new TreeMap<String,Integer>();
  44.118 +
  44.119 +            Package(Package parent, String name) {
  44.120 +                this.parent = parent;
  44.121 +                this.name = name;
  44.122 +            }
  44.123 +
  44.124 +            int getProfile() {
  44.125 +                return (parent == null) ? profile : Math.max(parent.getProfile(), profile);
  44.126 +            }
  44.127 +
  44.128 +            int getProfile(String simpleTypeName) {
  44.129 +                Integer i;
  44.130 +                if ((i = includedTypes.get(simpleTypeName)) != null)
  44.131 +                    return i;
  44.132 +                if ((i = includedTypes.get("*")) != null)
  44.133 +                    return i;
  44.134 +                if ((i = excludedTypes.get(simpleTypeName)) != null)
  44.135 +                    return i + 1;
  44.136 +                if ((i = excludedTypes.get("*")) != null)
  44.137 +                    return i + 1;
  44.138 +                return getProfile();
  44.139 +            }
  44.140 +
  44.141 +            String getName() {
  44.142 +                return (parent == null) ? name : (parent.getName() + "/" + name);
  44.143 +            }
  44.144 +
  44.145 +            void getPackages(int profile, Set<String> results) {
  44.146 +                int prf = getProfile();
  44.147 +                if (prf != 0 && profile >= prf)
  44.148 +                    results.add(getName());
  44.149 +                for (Package pkg: subpackages.values())
  44.150 +                    pkg.getPackages(profile, results);
  44.151 +            }
  44.152 +        }
  44.153 +
  44.154 +        final static Map<String, Package> packages = new TreeMap<String, Package>();
  44.155 +        int maxProfile;
  44.156 +
  44.157 +        MakefileProfiles(Properties p) {
  44.158 +            int profile = 1;
  44.159 +            while (true) {
  44.160 +                String inclPackages = p.getProperty("PROFILE_" + profile + "_RTJAR_INCLUDE_PACKAGES");
  44.161 +                if (inclPackages == null)
  44.162 +                    break;
  44.163 +                for (String pkg: inclPackages.substring(1).trim().split("\\s+")) {
  44.164 +                    if (pkg.endsWith("/"))
  44.165 +                        pkg = pkg.substring(0, pkg.length() - 1);
  44.166 +                    includePackage(profile, pkg);
  44.167 +                }
  44.168 +                String inclTypes =  p.getProperty("PROFILE_" + profile + "_RTJAR_INCLUDE_TYPES");
  44.169 +                if (inclTypes != null) {
  44.170 +                    for (String type: inclTypes.replace("$$", "$").split("\\s+")) {
  44.171 +                        if (type.endsWith(".class"))
  44.172 +                            includeType(profile, type.substring(0, type.length() - 6));
  44.173 +                    }
  44.174 +                }
  44.175 +                String exclTypes =  p.getProperty("PROFILE_" + profile + "_RTJAR_EXCLUDE_TYPES");
  44.176 +                if (exclTypes != null) {
  44.177 +                    for (String type: exclTypes.replace("$$", "$").split("\\s+")) {
  44.178 +                        if (type.endsWith(".class"))
  44.179 +                            excludeType(profile, type.substring(0, type.length() - 6));
  44.180 +                    }
  44.181 +                }
  44.182 +                maxProfile = profile;
  44.183 +                profile++;
  44.184 +            }
  44.185 +        }
  44.186 +
  44.187 +        @Override
  44.188 +        public int getProfileCount() {
  44.189 +            return maxProfile;
  44.190 +        }
  44.191 +
  44.192 +        @Override
  44.193 +        public int getProfile(String typeName) {
  44.194 +            int sep = typeName.lastIndexOf("/");
  44.195 +            String packageName = typeName.substring(0, sep);
  44.196 +            String simpleName = typeName.substring(sep + 1);
  44.197 +
  44.198 +            Package p = getPackage(packageName);
  44.199 +            return p.getProfile(simpleName);
  44.200 +        }
  44.201 +
  44.202 +        @Override
  44.203 +        public Set<String> getPackages(int profile) {
  44.204 +            Set<String> results = new TreeSet<String>();
  44.205 +            for (Package p: packages.values())
  44.206 +                p.getPackages(profile, results);
  44.207 +            return results;
  44.208 +        }
  44.209 +
  44.210 +        private void includePackage(int profile, String packageName) {
  44.211 +//            System.err.println("include package " + packageName);
  44.212 +            Package p = getPackage(packageName);
  44.213 +            Assert.check(p.profile == 0);
  44.214 +            p.profile = profile;
  44.215 +        }
  44.216 +
  44.217 +        private void includeType(int profile, String typeName) {
  44.218 +//            System.err.println("include type " + typeName);
  44.219 +            int sep = typeName.lastIndexOf("/");
  44.220 +            String packageName = typeName.substring(0, sep);
  44.221 +            String simpleName = typeName.substring(sep + 1);
  44.222 +
  44.223 +            Package p = getPackage(packageName);
  44.224 +            Assert.check(!p.includedTypes.containsKey(simpleName));
  44.225 +            p.includedTypes.put(simpleName, profile);
  44.226 +        }
  44.227 +
  44.228 +        private void excludeType(int profile, String typeName) {
  44.229 +//            System.err.println("exclude type " + typeName);
  44.230 +            int sep = typeName.lastIndexOf("/");
  44.231 +            String packageName = typeName.substring(0, sep);
  44.232 +            String simpleName = typeName.substring(sep + 1);
  44.233 +
  44.234 +            Package p = getPackage(packageName);
  44.235 +            Assert.check(!p.excludedTypes.containsKey(simpleName));
  44.236 +            p.excludedTypes.put(simpleName, profile);
  44.237 +        }
  44.238 +
  44.239 +        private Package getPackage(String packageName) {
  44.240 +            int sep = packageName.lastIndexOf("/");
  44.241 +            Package parent;
  44.242 +            Map<String, Package> parentSubpackages;
  44.243 +            String simpleName;
  44.244 +            if (sep == -1) {
  44.245 +                parent = null;
  44.246 +                parentSubpackages = packages;
  44.247 +                simpleName = packageName;
  44.248 +            } else {
  44.249 +                parent = getPackage(packageName.substring(0, sep));
  44.250 +                parentSubpackages = parent.subpackages;
  44.251 +                simpleName = packageName.substring(sep + 1);
  44.252 +            }
  44.253 +
  44.254 +            Package p = parentSubpackages.get(simpleName);
  44.255 +            if (p == null) {
  44.256 +                parentSubpackages.put(simpleName, p = new Package(parent, simpleName));
  44.257 +            }
  44.258 +            return p;
  44.259 +        }
  44.260 +    }
  44.261 +
  44.262 +    private static class SimpleProfiles extends Profiles {
  44.263 +        private final Map<String, Integer> map;
  44.264 +        private final int profileCount;
  44.265 +
  44.266 +        SimpleProfiles(Properties p) {
  44.267 +            int max = 0;
  44.268 +            map = new HashMap<String, Integer>();
  44.269 +            for (Map.Entry<Object,Object> e: p.entrySet()) {
  44.270 +                String typeName = (String) e.getKey();
  44.271 +                int profile = Integer.valueOf((String) e.getValue());
  44.272 +                map.put(typeName, profile);
  44.273 +                max = Math.max(max, profile);
  44.274 +            }
  44.275 +            profileCount = max;
  44.276 +        }
  44.277 +
  44.278 +        @Override
  44.279 +        public int getProfileCount() {
  44.280 +            return profileCount;
  44.281 +        }
  44.282 +
  44.283 +        @Override
  44.284 +        public int getProfile(String typeName) {
  44.285 +            return map.get(typeName);
  44.286 +        }
  44.287 +
  44.288 +        @Override
  44.289 +        public Set<String> getPackages(int profile) {
  44.290 +            Set<String> results = new TreeSet<String>();
  44.291 +            for (Map.Entry<String,Integer> e: map.entrySet()) {
  44.292 +                String tn = e.getKey();
  44.293 +                int prf = e.getValue();
  44.294 +                int sep = tn.lastIndexOf("/");
  44.295 +                if (sep > 0 && profile >= prf)
  44.296 +                    results.add(tn);
  44.297 +            }
  44.298 +            return results;
  44.299 +        }
  44.300 +    }
  44.301 +}
    45.1 --- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 21 12:23:27 2013 -0800
    45.2 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 21 17:49:56 2013 -0800
    45.3 @@ -45,6 +45,7 @@
    45.4  import com.sun.tools.javac.code.Type;
    45.5  import com.sun.tools.javac.code.Type.CapturedType;
    45.6  import com.sun.tools.javac.file.BaseFileObject;
    45.7 +import com.sun.tools.javac.jvm.Profile;
    45.8  import com.sun.tools.javac.tree.JCTree.*;
    45.9  import com.sun.tools.javac.tree.Pretty;
   45.10  import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
   45.11 @@ -197,6 +198,9 @@
   45.12          else if (arg instanceof JavaFileObject) {
   45.13              return ((JavaFileObject)arg).getName();
   45.14          }
   45.15 +        else if (arg instanceof Profile) {
   45.16 +            return ((Profile)arg).name;
   45.17 +        }
   45.18          else if (arg instanceof Formattable) {
   45.19              return ((Formattable)arg).toString(l, messages);
   45.20          }
    46.1 --- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Feb 21 12:23:27 2013 -0800
    46.2 +++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Feb 21 17:49:56 2013 -0800
    46.3 @@ -24,6 +24,7 @@
    46.4   */
    46.5  package com.sun.tools.javac.util;
    46.6  
    46.7 +import java.util.EnumMap;
    46.8  import java.util.EnumSet;
    46.9  import java.util.HashMap;
   46.10  import java.util.LinkedHashMap;
   46.11 @@ -96,7 +97,7 @@
   46.12          this.diags = JCDiagnostic.Factory.instance(context);
   46.13          this.types = Types.instance(context);
   46.14          this.messages = JavacMessages.instance(context);
   46.15 -        whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
   46.16 +        whereClauses = new EnumMap<WhereClauseKind, Map<Type, JCDiagnostic>>(WhereClauseKind.class);
   46.17          configuration = new RichConfiguration(Options.instance(context), formatter);
   46.18          for (WhereClauseKind kind : WhereClauseKind.values())
   46.19              whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java	Thu Feb 21 17:49:56 2013 -0800
    47.3 @@ -0,0 +1,186 @@
    47.4 +/*
    47.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    47.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.7 + *
    47.8 + * This code is free software; you can redistribute it and/or modify it
    47.9 + * under the terms of the GNU General Public License version 2 only, as
   47.10 + * published by the Free Software Foundation.
   47.11 + *
   47.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   47.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   47.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   47.15 + * version 2 for more details (a copy is included in the LICENSE file that
   47.16 + * accompanied this code).
   47.17 + *
   47.18 + * You should have received a copy of the GNU General Public License version
   47.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   47.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   47.21 + *
   47.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   47.23 + * or visit www.oracle.com if you need additional information or have any
   47.24 + * questions.
   47.25 + */
   47.26 +
   47.27 +/*
   47.28 + * @test
   47.29 + * @bug      8006124
   47.30 + * @summary  Test javadoc support for profiles.
   47.31 + * @author   Bhavesh Patel
   47.32 + * @library  ../lib/
   47.33 + * @build    JavadocTester TestProfiles
   47.34 + * @run main TestProfiles
   47.35 + */
   47.36 +public class TestProfiles extends JavadocTester {
   47.37 +
   47.38 +    //Test information.
   47.39 +    private static final String BUG_ID = "8006124";
   47.40 +    private static final String PROFILE_BUG_ID = BUG_ID + "-1";
   47.41 +    private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
   47.42 +    //Javadoc arguments.
   47.43 +    private static final String[] ARGS1 = new String[]{
   47.44 +        "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS
   47.45 +        + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
   47.46 +    };
   47.47 +    private static final String[] ARGS2 = new String[]{
   47.48 +        "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
   47.49 +    };
   47.50 +    //Input for string tests for profiles.
   47.51 +    private static final String[][] PROFILES_TEST = {
   47.52 +        // Tests for profile-overview-frame.html listing all profiles.
   47.53 +        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
   47.54 +            "<span><a href=\"overview-frame.html\" "
   47.55 +            + "target=\"profileListFrame\">All Packages</a></span>"
   47.56 +        },
   47.57 +        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
   47.58 +            "<li><a href=\"compact1-frame.html\" target=\"profileListFrame\">"
   47.59 +            + "compact1</a></li>"
   47.60 +        },
   47.61 +        // Tests for profileName-frame.html listing all packages in a profile.
   47.62 +        {PROFILE_BUG_ID + FS + "compact2-frame.html",
   47.63 +            "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
   47.64 +            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
   47.65 +            + "target=\"profileListFrame\">All Profiles</a></span>"
   47.66 +        },
   47.67 +        {PROFILE_BUG_ID + FS + "compact2-frame.html",
   47.68 +            "<li><a href=\"pkg4/compact2-package-frame.html\" "
   47.69 +            + "target=\"packageFrame\">pkg4</a></li>"
   47.70 +        },
   47.71 +        // Test for profileName-package-frame.html listing all types in a
   47.72 +        // package of a profile.
   47.73 +        {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
   47.74 +            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
   47.75 +            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
   47.76 +            + "target=\"classFrame\">pkg2</a>"
   47.77 +        },
   47.78 +        // Tests for profileName-summary.html listing the summary for a profile.
   47.79 +        {PROFILE_BUG_ID + FS + "compact2-summary.html",
   47.80 +            "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
   47.81 +            + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
   47.82 +        },
   47.83 +        {PROFILE_BUG_ID + FS + "compact2-summary.html",
   47.84 +            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
   47.85 +        },
   47.86 +        {PROFILE_BUG_ID + FS + "compact2-summary.html",
   47.87 +            "<h3><a href=\"pkg2/compact2-package-summary.html\" "
   47.88 +            + "target=\"classFrame\">pkg2</a></h3>"
   47.89 +        },
   47.90 +        // Tests for profileName-package-summary.html listing the summary for a
   47.91 +        // package in a profile.
   47.92 +        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
   47.93 +            "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
   47.94 +            + "</a></li>"
   47.95 +        },
   47.96 +        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
   47.97 +            "<div class=\"subTitle\">compact3</div>"
   47.98 +        },
   47.99 +        //Test for "overview-frame.html" showing the "All Profiles" link.
  47.100 +        {PROFILE_BUG_ID + FS + "overview-frame.html",
  47.101 +            "<span><a href=\"profile-overview-frame.html\" "
  47.102 +            + "target=\"profileListFrame\">All Profiles</a></span>"
  47.103 +        },
  47.104 +        //Test for "className.html" showing the profile information for the type.
  47.105 +        {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
  47.106 +            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
  47.107 +        }
  47.108 +    };
  47.109 +    private static final String[][] PROFILES_NEGATED_TEST = {
  47.110 +        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
  47.111 +            "<div class=\"subTitle\">compact1"
  47.112 +        },
  47.113 +        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
  47.114 +            "<div class=\"subTitle\">compact1"
  47.115 +        },
  47.116 +        {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
  47.117 +            "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
  47.118 +            + "target=\"classFrame\">Anno1Pkg4</a></li>"
  47.119 +        }
  47.120 +    };
  47.121 +    private static final String[][] PACKAGES_TEST = {
  47.122 +        {PACKAGE_BUG_ID + FS + "overview-frame.html",
  47.123 +            "<h2 title=\"Packages\">Packages</h2>"
  47.124 +        },
  47.125 +        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
  47.126 +            "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
  47.127 +            + "target=\"classFrame\">pkg4</a></h1>"
  47.128 +        },
  47.129 +        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
  47.130 +            "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
  47.131 +            + "class=\"title\">Package&nbsp;pkg4</h1>" + NL + "</div>"
  47.132 +        }
  47.133 +    };
  47.134 +    private static final String[][] PACKAGES_NEGATED_TEST = {
  47.135 +        {PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
  47.136 +            "<span><a href=\"overview-frame.html\" "
  47.137 +            + "target=\"profileListFrame\">All Packages</a></span>"
  47.138 +        },
  47.139 +        {PACKAGE_BUG_ID + FS + "compact2-frame.html",
  47.140 +            "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
  47.141 +            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
  47.142 +            + "target=\"profileListFrame\">All Profiles</a></span>"
  47.143 +        },
  47.144 +        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
  47.145 +            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
  47.146 +            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
  47.147 +            + "target=\"classFrame\">pkg2</a>"
  47.148 +        },
  47.149 +        {PACKAGE_BUG_ID + FS + "compact2-summary.html",
  47.150 +            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
  47.151 +        },
  47.152 +        {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
  47.153 +            "<div class=\"subTitle\">compact3</div>"
  47.154 +        },
  47.155 +        {PACKAGE_BUG_ID + FS + "overview-frame.html",
  47.156 +            "<span><a href=\"profile-overview-frame.html\" "
  47.157 +            + "target=\"profileListFrame\">All Profiles</a></span>"
  47.158 +        },
  47.159 +        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
  47.160 +            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
  47.161 +        }
  47.162 +    };
  47.163 +
  47.164 +    /**
  47.165 +     * The entry point of the test.
  47.166 +     *
  47.167 +     * @param args the array of command line arguments.
  47.168 +     */
  47.169 +    public static void main(String[] args) {
  47.170 +        TestProfiles tester = new TestProfiles();
  47.171 +        run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
  47.172 +        run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST);
  47.173 +        tester.printSummary();
  47.174 +    }
  47.175 +
  47.176 +    /**
  47.177 +     * {@inheritDoc}
  47.178 +     */
  47.179 +    public String getBugId() {
  47.180 +        return BUG_ID;
  47.181 +    }
  47.182 +
  47.183 +    /**
  47.184 +     * {@inheritDoc}
  47.185 +     */
  47.186 +    public String getBugName() {
  47.187 +        return getClass().getName();
  47.188 +    }
  47.189 +}
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/test/com/sun/javadoc/testProfiles/pkg1/Class1Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
    48.3 @@ -0,0 +1,32 @@
    48.4 +/*
    48.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    48.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.7 + *
    48.8 + * This code is free software; you can redistribute it and/or modify it
    48.9 + * under the terms of the GNU General Public License version 2 only, as
   48.10 + * published by the Free Software Foundation.
   48.11 + *
   48.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   48.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   48.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   48.15 + * version 2 for more details (a copy is included in the LICENSE file that
   48.16 + * accompanied this code).
   48.17 + *
   48.18 + * You should have received a copy of the GNU General Public License version
   48.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   48.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   48.21 + *
   48.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   48.23 + * or visit www.oracle.com if you need additional information or have any
   48.24 + * questions.
   48.25 + */
   48.26 +
   48.27 +package pkg1;
   48.28 +
   48.29 +/**
   48.30 + * A test class.
   48.31 + *
   48.32 + * @author Bhavesh Patel
   48.33 + */
   48.34 +public class Class1Pkg1 {
   48.35 +}
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/com/sun/javadoc/testProfiles/pkg1/Class2Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
    49.3 @@ -0,0 +1,32 @@
    49.4 +/*
    49.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 + *
    49.8 + * This code is free software; you can redistribute it and/or modify it
    49.9 + * under the terms of the GNU General Public License version 2 only, as
   49.10 + * published by the Free Software Foundation.
   49.11 + *
   49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 + * version 2 for more details (a copy is included in the LICENSE file that
   49.16 + * accompanied this code).
   49.17 + *
   49.18 + * You should have received a copy of the GNU General Public License version
   49.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 + *
   49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   49.23 + * or visit www.oracle.com if you need additional information or have any
   49.24 + * questions.
   49.25 + */
   49.26 +
   49.27 +package pkg1;
   49.28 +
   49.29 +/**
   49.30 + * A test class.
   49.31 + *
   49.32 + * @author Bhavesh Patel
   49.33 + */
   49.34 +public class Class2Pkg1 {
   49.35 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/com/sun/javadoc/testProfiles/pkg1/Class3Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
    50.3 @@ -0,0 +1,32 @@
    50.4 +/*
    50.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 + *
    50.8 + * This code is free software; you can redistribute it and/or modify it
    50.9 + * under the terms of the GNU General Public License version 2 only, as
   50.10 + * published by the Free Software Foundation.
   50.11 + *
   50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 + * version 2 for more details (a copy is included in the LICENSE file that
   50.16 + * accompanied this code).
   50.17 + *
   50.18 + * You should have received a copy of the GNU General Public License version
   50.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 + *
   50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.23 + * or visit www.oracle.com if you need additional information or have any
   50.24 + * questions.
   50.25 + */
   50.26 +
   50.27 +package pkg1;
   50.28 +
   50.29 +/**
   50.30 + * A test class.
   50.31 + *
   50.32 + * @author Bhavesh Patel
   50.33 + */
   50.34 +public class Class3Pkg1 {
   50.35 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/com/sun/javadoc/testProfiles/pkg1/Interface1Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
    51.3 @@ -0,0 +1,48 @@
    51.4 +/*
    51.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    51.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.7 + *
    51.8 + * This code is free software; you can redistribute it and/or modify it
    51.9 + * under the terms of the GNU General Public License version 2 only, as
   51.10 + * published by the Free Software Foundation.
   51.11 + *
   51.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   51.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   51.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   51.15 + * version 2 for more details (a copy is included in the LICENSE file that
   51.16 + * accompanied this code).
   51.17 + *
   51.18 + * You should have received a copy of the GNU General Public License version
   51.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   51.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   51.21 + *
   51.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   51.23 + * or visit www.oracle.com if you need additional information or have any
   51.24 + * questions.
   51.25 + */
   51.26 +
   51.27 +package pkg1;
   51.28 +
   51.29 +/**
   51.30 + * A sample interface.
   51.31 + *
   51.32 + * @author Bhavesh Patel
   51.33 + */
   51.34 +public interface Interface1Pkg1 {
   51.35 +
   51.36 +    /**
   51.37 +     * A test method.
   51.38 +     *
   51.39 +     * @param a blah.
   51.40 +     * @param b blah.
   51.41 +     */
   51.42 +    void method1(int a, int b);
   51.43 +
   51.44 +    /**
   51.45 +     * Another test method.
   51.46 +     *
   51.47 +     * @param c blah.
   51.48 +     */
   51.49 +    void method2(int c);
   51.50 +
   51.51 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/test/com/sun/javadoc/testProfiles/pkg2/Anno1Pkg2.java	Thu Feb 21 17:49:56 2013 -0800
    52.3 @@ -0,0 +1,40 @@
    52.4 +/*
    52.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 + *
    52.8 + * This code is free software; you can redistribute it and/or modify it
    52.9 + * under the terms of the GNU General Public License version 2 only, as
   52.10 + * published by the Free Software Foundation.  Oracle designates this
   52.11 + * particular file as subject to the "Classpath" exception as provided
   52.12 + * by Oracle in the LICENSE file that accompanied this code.
   52.13 + *
   52.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   52.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.17 + * version 2 for more details (a copy is included in the LICENSE file that
   52.18 + * accompanied this code).
   52.19 + *
   52.20 + * You should have received a copy of the GNU General Public License version
   52.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   52.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.23 + *
   52.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   52.25 + * or visit www.oracle.com if you need additional information or have any
   52.26 + * questions.
   52.27 + */
   52.28 +
   52.29 +package pkg2;
   52.30 +
   52.31 +import java.lang.annotation.*;
   52.32 +
   52.33 +/**
   52.34 + * Test Annotation class.
   52.35 + *
   52.36 + * @author Bhavesh Patel
   52.37 + */
   52.38 +public @interface Anno1Pkg2 {
   52.39 +    /**
   52.40 +     * Comment.
   52.41 +     */
   52.42 +    String[] value();
   52.43 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/com/sun/javadoc/testProfiles/pkg2/Anno2Pkg2.java	Thu Feb 21 17:49:56 2013 -0800
    53.3 @@ -0,0 +1,35 @@
    53.4 +/*
    53.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 + *
    53.8 + * This code is free software; you can redistribute it and/or modify it
    53.9 + * under the terms of the GNU General Public License version 2 only, as
   53.10 + * published by the Free Software Foundation.  Oracle designates this
   53.11 + * particular file as subject to the "Classpath" exception as provided
   53.12 + * by Oracle in the LICENSE file that accompanied this code.
   53.13 + *
   53.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   53.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.17 + * version 2 for more details (a copy is included in the LICENSE file that
   53.18 + * accompanied this code).
   53.19 + *
   53.20 + * You should have received a copy of the GNU General Public License version
   53.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   53.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.23 + *
   53.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.25 + * or visit www.oracle.com if you need additional information or have any
   53.26 + * questions.
   53.27 + */
   53.28 +
   53.29 +package pkg2;
   53.30 +
   53.31 +import java.lang.annotation.*;
   53.32 +
   53.33 +/*
   53.34 + * A sample interface.
   53.35 + */
   53.36 +public @interface Anno2Pkg2 {
   53.37 +    boolean value() default true;
   53.38 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java	Thu Feb 21 17:49:56 2013 -0800
    54.3 @@ -0,0 +1,51 @@
    54.4 +/*
    54.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + *
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + *
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + *
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + *
   54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.23 + * or visit www.oracle.com if you need additional information or have any
   54.24 + * questions.
   54.25 + */
   54.26 +
   54.27 +package pkg2;
   54.28 +
   54.29 +/**
   54.30 + * Another test class.
   54.31 + *
   54.32 + * @author Bhavesh Patel
   54.33 + */
   54.34 +public class Class1Pkg2 {
   54.35 +
   54.36 +    /**
   54.37 +     * A sample enum.
   54.38 +     */
   54.39 +    public static enum ModalExclusionType {
   54.40 +        /**
   54.41 +         * Test comment.
   54.42 +         */
   54.43 +        NO_EXCLUDE,
   54.44 +        /**
   54.45 +         * Another comment.
   54.46 +         */
   54.47 +        APPLICATION_EXCLUDE
   54.48 +    };
   54.49 +
   54.50 +    /**
   54.51 +     * A string constant.
   54.52 +     */
   54.53 +    public static final String CONSTANT1 = "C2";
   54.54 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/com/sun/javadoc/testProfiles/pkg3/Class1Pkg3.java	Thu Feb 21 17:49:56 2013 -0800
    55.3 @@ -0,0 +1,32 @@
    55.4 +/*
    55.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + *
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.
   55.11 + *
   55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.15 + * version 2 for more details (a copy is included in the LICENSE file that
   55.16 + * accompanied this code).
   55.17 + *
   55.18 + * You should have received a copy of the GNU General Public License version
   55.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.21 + *
   55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.23 + * or visit www.oracle.com if you need additional information or have any
   55.24 + * questions.
   55.25 + */
   55.26 +
   55.27 +package pkg3;
   55.28 +
   55.29 +/**
   55.30 + * A test class.
   55.31 + *
   55.32 + * @author Bhavesh Patel
   55.33 + */
   55.34 +public class Class1Pkg3 {
   55.35 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/com/sun/javadoc/testProfiles/pkg3/Class2Pkg3.java	Thu Feb 21 17:49:56 2013 -0800
    56.3 @@ -0,0 +1,32 @@
    56.4 +/*
    56.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 + *
    56.8 + * This code is free software; you can redistribute it and/or modify it
    56.9 + * under the terms of the GNU General Public License version 2 only, as
   56.10 + * published by the Free Software Foundation.
   56.11 + *
   56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.15 + * version 2 for more details (a copy is included in the LICENSE file that
   56.16 + * accompanied this code).
   56.17 + *
   56.18 + * You should have received a copy of the GNU General Public License version
   56.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.21 + *
   56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   56.23 + * or visit www.oracle.com if you need additional information or have any
   56.24 + * questions.
   56.25 + */
   56.26 +
   56.27 +package pkg3;
   56.28 +
   56.29 +/**
   56.30 + * A test class.
   56.31 + *
   56.32 + * @author Bhavesh Patel
   56.33 + */
   56.34 +public class Class2Pkg3 {
   56.35 +}
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/com/sun/javadoc/testProfiles/pkg3/Interface1Pkg3.java	Thu Feb 21 17:49:56 2013 -0800
    57.3 @@ -0,0 +1,48 @@
    57.4 +/*
    57.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    57.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 + *
    57.8 + * This code is free software; you can redistribute it and/or modify it
    57.9 + * under the terms of the GNU General Public License version 2 only, as
   57.10 + * published by the Free Software Foundation.
   57.11 + *
   57.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 + * version 2 for more details (a copy is included in the LICENSE file that
   57.16 + * accompanied this code).
   57.17 + *
   57.18 + * You should have received a copy of the GNU General Public License version
   57.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 + *
   57.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 + * or visit www.oracle.com if you need additional information or have any
   57.24 + * questions.
   57.25 + */
   57.26 +
   57.27 +package pkg3;
   57.28 +
   57.29 +/**
   57.30 + * A sample interface.
   57.31 + *
   57.32 + * @author Bhavesh Patel
   57.33 + */
   57.34 +public interface Interface1Pkg3 {
   57.35 +
   57.36 +    /**
   57.37 +     * A test method.
   57.38 +     *
   57.39 +     * @param a blah.
   57.40 +     * @param b blah.
   57.41 +     */
   57.42 +    void method1(int a, int b);
   57.43 +
   57.44 +    /**
   57.45 +     * Another test method.
   57.46 +     *
   57.47 +     * @param c blah.
   57.48 +     */
   57.49 +    void method2(int c);
   57.50 +
   57.51 +}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/com/sun/javadoc/testProfiles/pkg4/Anno1Pkg4.java	Thu Feb 21 17:49:56 2013 -0800
    58.3 @@ -0,0 +1,40 @@
    58.4 +/*
    58.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.7 + *
    58.8 + * This code is free software; you can redistribute it and/or modify it
    58.9 + * under the terms of the GNU General Public License version 2 only, as
   58.10 + * published by the Free Software Foundation.  Oracle designates this
   58.11 + * particular file as subject to the "Classpath" exception as provided
   58.12 + * by Oracle in the LICENSE file that accompanied this code.
   58.13 + *
   58.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   58.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.17 + * version 2 for more details (a copy is included in the LICENSE file that
   58.18 + * accompanied this code).
   58.19 + *
   58.20 + * You should have received a copy of the GNU General Public License version
   58.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   58.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.23 + *
   58.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   58.25 + * or visit www.oracle.com if you need additional information or have any
   58.26 + * questions.
   58.27 + */
   58.28 +
   58.29 +package pkg4;
   58.30 +
   58.31 +import java.lang.annotation.*;
   58.32 +
   58.33 +/**
   58.34 + * Test Annotation class.
   58.35 + *
   58.36 + * @author Bhavesh Patel
   58.37 + */
   58.38 +public @interface Anno1Pkg4 {
   58.39 +    /**
   58.40 +     * Comment.
   58.41 +     */
   58.42 +    String[] value();
   58.43 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/com/sun/javadoc/testProfiles/pkg4/Class1Pkg4.java	Thu Feb 21 17:49:56 2013 -0800
    59.3 @@ -0,0 +1,32 @@
    59.4 +/*
    59.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.7 + *
    59.8 + * This code is free software; you can redistribute it and/or modify it
    59.9 + * under the terms of the GNU General Public License version 2 only, as
   59.10 + * published by the Free Software Foundation.
   59.11 + *
   59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   59.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   59.15 + * version 2 for more details (a copy is included in the LICENSE file that
   59.16 + * accompanied this code).
   59.17 + *
   59.18 + * You should have received a copy of the GNU General Public License version
   59.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   59.21 + *
   59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   59.23 + * or visit www.oracle.com if you need additional information or have any
   59.24 + * questions.
   59.25 + */
   59.26 +
   59.27 +package pkg4;
   59.28 +
   59.29 +/**
   59.30 + * Another test class.
   59.31 + *
   59.32 + * @author Bhavesh Patel
   59.33 + */
   59.34 +public class Class1Pkg4 {
   59.35 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/com/sun/javadoc/testProfiles/pkg5/Class1Pkg5.java	Thu Feb 21 17:49:56 2013 -0800
    60.3 @@ -0,0 +1,32 @@
    60.4 +/*
    60.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.
   60.11 + *
   60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 + * version 2 for more details (a copy is included in the LICENSE file that
   60.16 + * accompanied this code).
   60.17 + *
   60.18 + * You should have received a copy of the GNU General Public License version
   60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 + *
   60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.23 + * or visit www.oracle.com if you need additional information or have any
   60.24 + * questions.
   60.25 + */
   60.26 +
   60.27 +package pkg5;
   60.28 +
   60.29 +/**
   60.30 + * A test class.
   60.31 + *
   60.32 + * @author Bhavesh Patel
   60.33 + */
   60.34 +public class Class1Pkg5 {
   60.35 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/test/com/sun/javadoc/testProfiles/pkg5/Interface1Pkg5.java	Thu Feb 21 17:49:56 2013 -0800
    61.3 @@ -0,0 +1,40 @@
    61.4 +/*
    61.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.7 + *
    61.8 + * This code is free software; you can redistribute it and/or modify it
    61.9 + * under the terms of the GNU General Public License version 2 only, as
   61.10 + * published by the Free Software Foundation.
   61.11 + *
   61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   61.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   61.15 + * version 2 for more details (a copy is included in the LICENSE file that
   61.16 + * accompanied this code).
   61.17 + *
   61.18 + * You should have received a copy of the GNU General Public License version
   61.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   61.21 + *
   61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   61.23 + * or visit www.oracle.com if you need additional information or have any
   61.24 + * questions.
   61.25 + */
   61.26 +
   61.27 +package pkg5;
   61.28 +
   61.29 +/**
   61.30 + * A sample interface.
   61.31 + *
   61.32 + * @author Bhavesh Patel
   61.33 + */
   61.34 +public interface Interface1Pkg5 {
   61.35 +
   61.36 +    /**
   61.37 +     * A test method.
   61.38 +     *
   61.39 +     * @param a blah.
   61.40 +     * @param b blah.
   61.41 +     */
   61.42 +    void method1(int a, int b);
   61.43 +}
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt	Thu Feb 21 17:49:56 2013 -0800
    62.3 @@ -0,0 +1,42 @@
    62.4 +PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
    62.5 +    pkg2 
    62.6 +
    62.7 +PROFILE_1_RTJAR_INCLUDE_TYPES := \
    62.8 +    pkg3/Class1Pkg3.class
    62.9 +
   62.10 +PROFILE_1_RTJAR_EXCLUDE_TYPES := 
   62.11 +
   62.12 +PROFILE_1_INCLUDE_METAINF_SERVICES := 
   62.13 +
   62.14 +
   62.15 +PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
   62.16 +    pkg4 
   62.17 +
   62.18 +PROFILE_2_RTJAR_INCLUDE_TYPES := 
   62.19 +
   62.20 +PROFILE_2_RTJAR_EXCLUDE_TYPES := \
   62.21 +    pkg4/Anno1Pkg4.class 
   62.22 +
   62.23 +PROFILE_2_INCLUDE_METAINF_SERVICES := 
   62.24 +
   62.25 +
   62.26 +PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
   62.27 +    pkg5 
   62.28 +
   62.29 +PROFILE_3_RTJAR_INCLUDE_TYPES := 
   62.30 +
   62.31 +PROFILE_3_RTJAR_EXCLUDE_TYPES := 
   62.32 +
   62.33 +PROFILE_3_INCLUDE_METAINF_SERVICES := 
   62.34 +
   62.35 +
   62.36 +PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
   62.37 +    pkg1 
   62.38 +
   62.39 +PROFILE_4_RTJAR_INCLUDE_TYPES := 
   62.40 +
   62.41 +PROFILE_4_RTJAR_EXCLUDE_TYPES := 
   62.42 +
   62.43 +PROFILE_4_INCLUDE_METAINF_SERVICES :=  
   62.44 +
   62.45 +
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/test/tools/javac/diags/examples/NotInProfile.java	Thu Feb 21 17:49:56 2013 -0800
    63.3 @@ -0,0 +1,29 @@
    63.4 +/*
    63.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    63.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.7 + *
    63.8 + * This code is free software; you can redistribute it and/or modify it
    63.9 + * under the terms of the GNU General Public License version 2 only, as
   63.10 + * published by the Free Software Foundation.
   63.11 + *
   63.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   63.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   63.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   63.15 + * version 2 for more details (a copy is included in the LICENSE file that
   63.16 + * accompanied this code).
   63.17 + *
   63.18 + * You should have received a copy of the GNU General Public License version
   63.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   63.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   63.21 + *
   63.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   63.23 + * or visit www.oracle.com if you need additional information or have any
   63.24 + * questions.
   63.25 + */
   63.26 +
   63.27 +// key: compiler.err.not.in.profile
   63.28 +// options: -profile compact1
   63.29 +
   63.30 +class NotInProfile {
   63.31 +    Class<?> c = java.awt.Frame.class;
   63.32 +}
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/test/tools/javac/profiles/ProfileOptionTest.java	Thu Feb 21 17:49:56 2013 -0800
    64.3 @@ -0,0 +1,268 @@
    64.4 +/*
    64.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.7 + *
    64.8 + * This code is free software; you can redistribute it and/or modify it
    64.9 + * under the terms of the GNU General Public License version 2 only, as
   64.10 + * published by the Free Software Foundation.
   64.11 + *
   64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   64.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   64.15 + * version 2 for more details (a copy is included in the LICENSE file that
   64.16 + * accompanied this code).
   64.17 + *
   64.18 + * You should have received a copy of the GNU General Public License version
   64.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   64.21 + *
   64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   64.23 + * or visit www.oracle.com if you need additional information or have any
   64.24 + * questions.
   64.25 + */
   64.26 +
   64.27 +/*
   64.28 + * @test
   64.29 + * @bug 8004182
   64.30 + * @summary Add support for profiles in javac
   64.31 + */
   64.32 +
   64.33 +import java.io.PrintWriter;
   64.34 +import java.io.StringWriter;
   64.35 +import java.lang.annotation.Annotation;
   64.36 +import java.lang.annotation.Retention;
   64.37 +import java.lang.annotation.RetentionPolicy;
   64.38 +import java.lang.reflect.InvocationTargetException;
   64.39 +import java.lang.reflect.Method;
   64.40 +import java.net.URI;
   64.41 +import java.util.ArrayList;
   64.42 +import java.util.Arrays;
   64.43 +import java.util.Collections;
   64.44 +import java.util.EnumMap;
   64.45 +import java.util.List;
   64.46 +import java.util.Map;
   64.47 +
   64.48 +import javax.tools.Diagnostic;
   64.49 +import javax.tools.DiagnosticCollector;
   64.50 +import javax.tools.JavaCompiler;
   64.51 +import javax.tools.JavaFileObject;
   64.52 +import javax.tools.SimpleJavaFileObject;
   64.53 +import javax.tools.StandardJavaFileManager;
   64.54 +
   64.55 +import com.sun.source.util.JavacTask;
   64.56 +import com.sun.tools.javac.api.JavacTool;
   64.57 +import com.sun.tools.javac.jvm.Profile;
   64.58 +import com.sun.tools.javac.jvm.Target;
   64.59 +
   64.60 +
   64.61 +public class ProfileOptionTest {
   64.62 +    public static void main(String... args) throws Exception {
   64.63 +        new ProfileOptionTest().run();
   64.64 +    }
   64.65 +
   64.66 +    private final JavaCompiler javac = JavacTool.create();
   64.67 +    private final StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
   64.68 +
   64.69 +
   64.70 +    // ---------- Test cases, invoked reflectively via run. ----------
   64.71 +
   64.72 +    @Test
   64.73 +    void testInvalidProfile_CommandLine() throws Exception {
   64.74 +        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
   64.75 +        String badName = "foo";
   64.76 +        List<String> opts = Arrays.asList("-profile", badName);
   64.77 +        StringWriter sw = new StringWriter();
   64.78 +        try {
   64.79 +            JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
   64.80 +                Arrays.asList(fo));
   64.81 +            throw new Exception("expected exception not thrown");
   64.82 +        } catch (IllegalArgumentException e) {
   64.83 +            // expected
   64.84 +        }
   64.85 +    }
   64.86 +
   64.87 +    @Test
   64.88 +    void testInvalidProfile_API() throws Exception {
   64.89 +        String badName = "foo";
   64.90 +        String[] opts = { "-profile", badName };
   64.91 +        StringWriter sw = new StringWriter();
   64.92 +        PrintWriter pw = new PrintWriter(sw);
   64.93 +        int rc = com.sun.tools.javac.Main.compile(opts, pw);
   64.94 +
   64.95 +        // sadly, command line errors are not (yet?) reported to
   64.96 +        // the diag listener
   64.97 +        String out = sw.toString();
   64.98 +        if (!out.isEmpty())
   64.99 +            System.err.println(out.trim());
  64.100 +
  64.101 +        if (!out.contains("invalid profile: " + badName)) {
  64.102 +            error("expected message not found");
  64.103 +        }
  64.104 +    }
  64.105 +
  64.106 +    @Test
  64.107 +    void testTargetProfileCombinations() throws Exception {
  64.108 +        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
  64.109 +        for (Target t: Target.values()) {
  64.110 +            switch (t) {
  64.111 +                case JDK1_1: case JDK1_2: // no equivalent -source
  64.112 +                case JDK1_4_1: case JDK1_4_2: case JSR14: // transitional values
  64.113 +                    continue;
  64.114 +            }
  64.115 +
  64.116 +            for (Profile p: Profile.values()) {
  64.117 +                List<String> opts = new ArrayList<String>();
  64.118 +                opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
  64.119 +                opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
  64.120 +                if (p != Profile.DEFAULT)
  64.121 +                    opts.addAll(Arrays.asList("-profile", p.name));
  64.122 +                StringWriter sw = new StringWriter();
  64.123 +                JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
  64.124 +                        Arrays.asList(fo));
  64.125 +                task.analyze();
  64.126 +
  64.127 +                // sadly, command line errors are not (yet?) reported to
  64.128 +                // the diag listener
  64.129 +                String out = sw.toString();
  64.130 +                if (!out.isEmpty())
  64.131 +                    System.err.println(out.trim());
  64.132 +
  64.133 +                switch (t) {
  64.134 +                    case JDK1_8:
  64.135 +                        if (!out.isEmpty())
  64.136 +                            error("unexpected output from compiler");
  64.137 +                        break;
  64.138 +                    default:
  64.139 +                        if (p != Profile.DEFAULT
  64.140 +                                && !out.contains("profile " + p.name
  64.141 +                                    + " is not valid for target release " + t.name)) {
  64.142 +                            error("expected message not found");
  64.143 +                        }
  64.144 +                }
  64.145 +            }
  64.146 +        }
  64.147 +    }
  64.148 +
  64.149 +    @Test
  64.150 +    void testClassesInProfiles() throws Exception {
  64.151 +        for (Profile p: Profile.values()) {
  64.152 +            for (Map.Entry<Profile, List<JavaFileObject>> e: testClasses.entrySet()) {
  64.153 +                for (JavaFileObject fo: e.getValue()) {
  64.154 +                    DiagnosticCollector<JavaFileObject> dl =
  64.155 +                            new DiagnosticCollector<JavaFileObject>();
  64.156 +                    List<String> opts = (p == Profile.DEFAULT)
  64.157 +                            ? Collections.<String>emptyList()
  64.158 +                            : Arrays.asList("-profile", p.name);
  64.159 +                    JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
  64.160 +                            Arrays.asList(fo));
  64.161 +                    task.analyze();
  64.162 +
  64.163 +                    List<String> expectDiagCodes = (p.value >= e.getKey().value)
  64.164 +                            ? Collections.<String>emptyList()
  64.165 +                            : Arrays.asList("compiler.err.not.in.profile");
  64.166 +
  64.167 +                    checkDiags(opts + " " + fo.getName(), dl.getDiagnostics(), expectDiagCodes);
  64.168 +                }
  64.169 +            }
  64.170 +        }
  64.171 +    }
  64.172 +
  64.173 +    Map<Profile, List<JavaFileObject>> testClasses =
  64.174 +            new EnumMap<Profile, List<JavaFileObject>>(Profile.class);
  64.175 +
  64.176 +    void initTestClasses() {
  64.177 +        // The following table assumes the existence of specific classes
  64.178 +        // in specific profiles, as defined in the Java SE 8 spec.
  64.179 +        init(Profile.COMPACT1,
  64.180 +                java.lang.String.class);
  64.181 +
  64.182 +        init(Profile.COMPACT2,
  64.183 +                javax.xml.XMLConstants.class);
  64.184 +
  64.185 +        init(Profile.COMPACT3,
  64.186 +                javax.script.Bindings.class,
  64.187 +                com.sun.security.auth.PolicyFile.class); // specifically included in 3
  64.188 +
  64.189 +        init(Profile.DEFAULT,
  64.190 +                java.beans.BeanInfo.class,
  64.191 +                javax.management.remote.rmi._RMIServer_Stub.class); // specifically excluded in 3
  64.192 +    }
  64.193 +
  64.194 +    void init(Profile p, Class<?>... classes) {
  64.195 +        List<JavaFileObject> srcs = new ArrayList<JavaFileObject>();
  64.196 +        for (Class<?> c: classes) {
  64.197 +            String name = "T" + c.getSimpleName();
  64.198 +            String src =
  64.199 +                    "class T" + name + "{" + "\n" +
  64.200 +                    "    Class<?> c = " + c.getName() + ".class;\n" +
  64.201 +                    "}";
  64.202 +            srcs.add(new StringJavaFileObject(name + ".java", src));
  64.203 +        }
  64.204 +        testClasses.put(p, srcs);
  64.205 +    }
  64.206 +
  64.207 +    void checkDiags(String msg, List<Diagnostic<? extends JavaFileObject>> diags, List<String> expectDiagCodes) {
  64.208 +        System.err.print(msg);
  64.209 +        if (diags.isEmpty())
  64.210 +            System.err.println(" OK");
  64.211 +        else {
  64.212 +            System.err.println();
  64.213 +            System.err.println(diags);
  64.214 +        }
  64.215 +
  64.216 +        List<String> foundDiagCodes = new ArrayList<String>();
  64.217 +        for (Diagnostic<? extends JavaFileObject> d: diags)
  64.218 +            foundDiagCodes.add(d.getCode());
  64.219 +
  64.220 +        if (!foundDiagCodes.equals(expectDiagCodes)) {
  64.221 +            System.err.println("Found diag codes:    " + foundDiagCodes);
  64.222 +            System.err.println("Expected diag codes: " + expectDiagCodes);
  64.223 +            error("expected diagnostics not found");
  64.224 +        }
  64.225 +    }
  64.226 +
  64.227 +    /** Marker annotation for test cases. */
  64.228 +    @Retention(RetentionPolicy.RUNTIME)
  64.229 +    @interface Test { }
  64.230 +
  64.231 +    /** Run all test cases. */
  64.232 +    void run() throws Exception {
  64.233 +        initTestClasses();
  64.234 +
  64.235 +        for (Method m: getClass().getDeclaredMethods()) {
  64.236 +            Annotation a = m.getAnnotation(Test.class);
  64.237 +            if (a != null) {
  64.238 +                System.err.println(m.getName());
  64.239 +                try {
  64.240 +                    m.invoke(this, new Object[] { });
  64.241 +                } catch (InvocationTargetException e) {
  64.242 +                    Throwable cause = e.getCause();
  64.243 +                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
  64.244 +                }
  64.245 +                System.err.println();
  64.246 +            }
  64.247 +        }
  64.248 +
  64.249 +        if (errors > 0)
  64.250 +            throw new Exception(errors + " errors occurred");
  64.251 +    }
  64.252 +
  64.253 +    void error(String msg) {
  64.254 +        System.err.println("Error: " + msg);
  64.255 +        errors++;
  64.256 +    }
  64.257 +
  64.258 +    int errors;
  64.259 +
  64.260 +    private static class StringJavaFileObject extends SimpleJavaFileObject {
  64.261 +        StringJavaFileObject(String name, String text) {
  64.262 +            super(URI.create(name), JavaFileObject.Kind.SOURCE);
  64.263 +            this.text = text;
  64.264 +        }
  64.265 +        @Override
  64.266 +        public CharSequence getCharContent(boolean b) {
  64.267 +            return text;
  64.268 +        }
  64.269 +        private String text;
  64.270 +    }
  64.271 +}

mercurial