changeset 1742:6118072811e5

Merge
author lana
date Thu, 21 Feb 2013 17:49:56 -0800
parents dabb36173c63 (current diff) af8417e590f4 (diff)
children 8e82e4f225e4
files src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java src/share/classes/com/sun/tools/javac/code/Flags.java src/share/classes/com/sun/tools/javac/code/Symtab.java src/share/classes/com/sun/tools/javac/comp/Attr.java src/share/classes/com/sun/tools/javac/comp/Check.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/resources/compiler.properties
diffstat 64 files changed, 4394 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,7 +150,20 @@
             String tableSummary, Content body) {
         if (packages.length > 0) {
             Arrays.sort(packages);
-            addAllClassesLink(body);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexHeader);
+            addAllClassesLink(div);
+            if (configuration.showProfiles) {
+                addAllProfilesLink(div);
+            }
+            body.addContent(div);
+            if (configuration.showProfiles) {
+                String profileSummary = configuration.getText("doclet.Profiles");
+                String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles"));
+                addProfilesList(profileSummary, profilesTableSummary, body);
+            }
             addPackagesList(packages, text, tableSummary, body);
         }
     }
@@ -182,10 +195,29 @@
     }
 
     /**
-     * Do nothing. This will be overridden in PackageIndexFrameWriter.
+     * Do nothing. This will be overridden.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden.
      *
-     * @param body the document tree to which the all classes link will be added
+     * @param div the document tree to which the all profiles link will be added
      */
-    protected void addAllClassesLink(Content body) {
+    protected void addAllProfilesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden.
+     *
+     * @param profileSummary the profile summary heading
+     * @param profilesTableSummary the profiles table summary information
+     * @param body the content tree to which the profiles list will be added
+     */
+    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+            Content body) {
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.DocPath;
+
+/**
+ * Abstract class to generate the profile overview files in
+ * Frame and Non-Frame format. This will be sub-classed to
+ * generate profile-overview-frame.html as well as profile-overview-summary.html.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
+
+    /**
+     * Profiles to be documented.
+     */
+    protected Profiles profiles;
+
+    /**
+     * Constructor. Also initializes the profiles variable.
+     *
+     * @param configuration  The current configuration
+     * @param filename Name of the profile index file to be generated.
+     */
+    public AbstractProfileIndexWriter(ConfigurationImpl configuration,
+                                      DocPath filename) throws IOException {
+        super(configuration, filename);
+        profiles = configuration.profiles;
+    }
+
+    /**
+     * Adds the navigation bar header to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar header will be added
+     */
+    protected abstract void addNavigationBarHeader(Content body);
+
+    /**
+     * Adds the navigation bar footer to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar footer will be added
+     */
+    protected abstract void addNavigationBarFooter(Content body);
+
+    /**
+     * Adds the overview header to the documentation tree.
+     *
+     * @param body the document tree to which the overview header will be added
+     */
+    protected abstract void addOverviewHeader(Content body);
+
+    /**
+     * Adds the profiles list to the documentation tree.
+     *
+     * @param profiles profiles object
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the profiles list will be added
+     */
+    protected abstract void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body);
+
+    /**
+     * Adds the profile packages list to the documentation tree.
+     *
+     * @param profiles profiles object
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the profiles list will be added
+     * @param profileName the name for the profile being documented
+     */
+    protected abstract void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName);
+
+    /**
+     * Generate and prints the contents in the profile index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     */
+    protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addIndex(body);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Generate and prints the contents in the profile packages index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     * @param profileName the name of the profile being documented
+     */
+    protected void buildProfilePackagesIndexFile(String title,
+            boolean includeScript, String profileName) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addProfilePackagesIndex(body, profileName);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Default to no overview, override to add overview.
+     *
+     * @param body the document tree to which the overview will be added
+     */
+    protected void addOverview(Content body) throws IOException {
+    }
+
+    /**
+     * Adds the frame or non-frame profile index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     */
+    protected void addIndex(Content body) {
+        addIndexContents(profiles, "doclet.Profile_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles")), body);
+    }
+
+    /**
+     * Adds the frame or non-frame profile packages index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     * @param profileName  the name of the profile being documented
+     */
+    protected void addProfilePackagesIndex(Content body, String profileName) {
+        addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles")), body, profileName);
+    }
+
+    /**
+     * Adds profile index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param profiles profiles to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     */
+    protected void addIndexContents(Profiles profiles, String text,
+            String tableSummary, Content body) {
+        if (profiles.getProfileCount() > 0) {
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexHeader);
+            addAllClassesLink(div);
+            addAllPackagesLink(div);
+            body.addContent(div);
+            addProfilesList(profiles, text, tableSummary, body);
+        }
+    }
+
+    /**
+     * Adds profile packages index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param profiles profiles to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     * @param profileName the name of the profile being documented
+     */
+    protected void addProfilePackagesIndexContents(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.indexHeader);
+        addAllClassesLink(div);
+        addAllPackagesLink(div);
+        addAllProfilesLink(div);
+        body.addContent(div);
+        addProfilePackagesList(profiles, text, tableSummary, body, profileName);
+    }
+
+    /**
+     * Adds the doctitle to the documentation tree, if it is specified on the command line.
+     *
+     * @param body the document tree to which the title will be added
+     */
+    protected void addConfigurationTitle(Content body) {
+        if (configuration.doctitle.length() > 0) {
+            Content title = new RawHtml(configuration.doctitle);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
+                    HtmlStyle.title, title);
+            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
+            body.addContent(div);
+        }
+    }
+
+    /**
+     * Returns highlighted "Overview", in the navigation bar as this is the
+     * overview page.
+     *
+     * @return a Content object to be added to the documentation tree
+     */
+    protected Content getNavLinkContents() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
+        return li;
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
+     *
+     * @param div the document tree to which the all packages link will be added
+     */
+    protected void addAllPackagesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfilePackageIndexFrameWriter.
+     *
+     * @param div the document tree to which the all profiles link will be added
+     */
+    protected void addAllProfilesLink(Content div) {
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,10 @@
 
 package com.sun.tools.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
@@ -165,6 +165,20 @@
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
+        if (configuration.showProfiles) {
+            String sep = "";
+            int profile = configuration.profiles.getProfile(getTypeNameForProfile(classDoc));
+            if (profile > 0) {
+                Content profNameContent = new StringContent();
+                for (int i = profile; i < configuration.profiles.getProfileCount(); i++) {
+                    profNameContent.addContent(sep);
+                    profNameContent.addContent(Profile.lookup(i).name);
+                    sep = ", ";
+                }
+                Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profNameContent);
+                div.addContent(profileNameDiv);
+            }
+        }
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
     public FrameOutputWriter(ConfigurationImpl configuration,
                              DocPath filename) throws IOException {
         super(configuration, filename);
-    noOfPackages = configuration.packages.length;
+        noOfPackages = configuration.packages.length;
     }
 
     /**
@@ -135,7 +135,13 @@
     protected Content getFrameDetails() {
         HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
                 "top.loadFrames()");
-        if (noOfPackages <= 1) {
+        if (configuration.showProfiles) {
+            HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
+                "top.loadFrames()");
+            addAllProfilesFrameTag(leftFrameset);
+            addAllClassesFrameTag(leftFrameset);
+            frameset.addContent(leftFrameset);
+        } else if (noOfPackages <= 1) {
             addAllClassesFrameTag(frameset);
         } else if (noOfPackages > 1) {
             HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
@@ -150,6 +156,17 @@
     }
 
     /**
+     * Add the FRAME tag for the frame that lists all profiles.
+     *
+     * @param contentTree the content tree to which the information will be added
+     */
+    private void addAllProfilesFrameTag(Content contentTree) {
+        HtmlTree frame = HtmlTree.FRAME(DocPaths.PROFILE_OVERVIEW_FRAME.getPath(),
+                "profileListFrame", configuration.getText("doclet.All_Profiles"));
+        contentTree.addContent(frame);
+    }
+
+    /**
      * Add the FRAME tag for the frame that lists all packages.
      *
      * @param contentTree the content tree to which the information will be added
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -202,6 +204,44 @@
     /**
      * {@inheritDoc}
      */
+    protected void generateProfileFiles() throws Exception {
+        if (configuration.showProfiles) {
+            ProfileIndexFrameWriter.generate(configuration);
+            Profile prevProfile = null, nextProfile;
+            for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
+                ProfilePackageIndexFrameWriter.generate(configuration, Profile.lookup(i).name);
+                PackageDoc[] packages = configuration.profilePackages.get(
+                        Profile.lookup(i).name);
+                PackageDoc prev = null, next;
+                for (int j = 0; j < packages.length; j++) {
+                    // if -nodeprecated option is set and the package is marked as
+                    // deprecated, do not generate the profilename-package-summary.html
+                    // and profilename-package-frame.html pages for that package.
+                    if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) {
+                        ProfilePackageFrameWriter.generate(configuration, packages[j], i);
+                        next = (j + 1 < packages.length
+                                && packages[j + 1].name().length() > 0) ? packages[j + 1] : null;
+                        AbstractBuilder profilePackageSummaryBuilder =
+                                configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
+                                packages[j], prev, next, Profile.lookup(i));
+                        profilePackageSummaryBuilder.build();
+                        prev = packages[j];
+                    }
+                }
+                nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
+                        Profile.lookup(i + 1) : null;
+                AbstractBuilder profileSummaryBuilder =
+                        configuration.getBuilderFactory().getProfileSummaryBuilder(
+                        Profile.lookup(i), prevProfile, nextProfile);
+                profileSummaryBuilder.build();
+                prevProfile = Profile.lookup(i);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     protected void generatePackageFiles(ClassTree classtree) throws Exception {
         PackageDoc[] packages = configuration.packages;
         if (packages.length > 1) {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -301,6 +301,107 @@
     }
 
     /**
+     * Get Profile Package link, with target frame.
+     *
+     * @param pd the packageDoc object
+     * @param target name of the target frame
+     * @param label tag for the link
+     * @param profileName the name of the profile being documented
+     * @return a content for the target profile packages link
+     */
+    public Content getTargetProfilePackageLink(PackageDoc pd, String target,
+            Content label, String profileName) {
+        return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)),
+                label, "", target);
+    }
+
+    /**
+     * Get Profile link, with target frame.
+     *
+     * @param target name of the target frame
+     * @param label tag for the link
+     * @param profileName the name of the profile being documented
+     * @return a content for the target profile link
+     */
+    public Content getTargetProfileLink(String target, Content label,
+            String profileName) {
+        return getHyperLink(pathToRoot.resolve(
+                DocPaths.profileSummary(profileName)), label, "", target);
+    }
+
+    /**
+     * Get the type name for profile search.
+     *
+     * @param cd the classDoc object for which the type name conversion is needed
+     * @return a type name string for the type
+     */
+    public String getTypeNameForProfile(ClassDoc cd) {
+        StringBuilder typeName =
+                new StringBuilder((cd.containingPackage()).name().replace(".", "/"));
+        typeName.append("/")
+                .append(cd.name().replace(".", "$"));
+        return typeName.toString();
+    }
+
+    /**
+     * Check if a type belongs to a profile.
+     *
+     * @param cd the classDoc object that needs to be checked
+     * @param profileValue the profile in which the type needs to be checked
+     * @return true if the type is in the profile
+     */
+    public boolean isTypeInProfile(ClassDoc cd, int profileValue) {
+        return (configuration.profiles.getProfile(getTypeNameForProfile(cd)) <= profileValue);
+    }
+
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content summaryContentTree,
+            int profileValue) {
+        if(classes.length > 0) {
+            Arrays.sort(classes);
+            Content caption = getTableCaption(label);
+            Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
+                    tableSummary, caption);
+            table.addContent(getSummaryTableHeader(tableHeader, "col"));
+            Content tbody = new HtmlTree(HtmlTag.TBODY);
+            for (int i = 0; i < classes.length; i++) {
+                if (!isTypeInProfile(classes[i], profileValue)) {
+                    continue;
+                }
+                if (!Util.isCoreClass(classes[i]) ||
+                    !configuration.isGeneratedDoc(classes[i])) {
+                    continue;
+                }
+                Content classContent = new RawHtml(getLink(new LinkInfoImpl(
+                        configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i],
+                        false)));
+                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
+                HtmlTree tr = HtmlTree.TR(tdClass);
+                if (i%2 == 0)
+                    tr.addStyle(HtmlStyle.altColor);
+                else
+                    tr.addStyle(HtmlStyle.rowColor);
+                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
+                tdClassDescription.addStyle(HtmlStyle.colLast);
+                if (Util.isDeprecated(classes[i])) {
+                    tdClassDescription.addContent(deprecatedLabel);
+                    if (classes[i].tags("deprecated").length > 0) {
+                        addSummaryDeprecatedComment(classes[i],
+                            classes[i].tags("deprecated")[0], tdClassDescription);
+                    }
+                }
+                else
+                    addSummaryComment(classes[i], tdClassDescription);
+                tr.addContent(tdClassDescription);
+                tbody.addContent(tr);
+            }
+            table.addContent(tbody);
+            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
+            summaryContentTree.addContent(li);
+        }
+    }
+
+    /**
      * Generates the HTML document tree and prints it out.
      *
      * @param metakeywords Array of String keywords for META tag. Each element
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,13 +145,26 @@
      * Adds "All Classes" link for the top of the left-hand frame page to the
      * documentation tree.
      *
-     * @param body the Content object to which the all classes link should be added
+     * @param div the Content object to which the all classes link should be added
      */
-    protected void addAllClassesLink(Content body) {
+    protected void addAllClassesLink(Content div) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
                 allclassesLabel, "", "packageFrame");
-        Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
-        body.addContent(div);
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Profiles" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all profiles link should be added
+     */
+    protected void addAllProfilesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
+                allprofilesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -29,6 +29,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -122,6 +123,21 @@
     /**
      * {@inheritDoc}
      */
+    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+            Content body) {
+        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
+                getTableCaption(profileSummary));
+        table.addContent(getSummaryTableHeader(profileTableHeader, "col"));
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
+        addProfilesList(tbody);
+        table.addContent(tbody);
+        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
+        body.addContent(div);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     protected void addPackagesList(PackageDoc[] packages, String text,
             String tableSummary, Content body) {
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
@@ -135,6 +151,31 @@
     }
 
     /**
+     * Adds list of profiles in the index table. Generate link to each profile.
+     *
+     * @param tbody the documentation tree to which the list will be added
+     */
+    protected void addProfilesList(Content tbody) {
+        for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
+            String profileName = Profile.lookup(i).name;
+            Content profileLinkContent = getTargetProfileLink("classFrame",
+                    new StringContent(profileName), profileName);
+            Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent);
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            tdSummary.addContent(getSpace());
+            HtmlTree tr = HtmlTree.TR(tdProfile);
+            tr.addContent(tdSummary);
+            if (i % 2 == 0) {
+                tr.addStyle(HtmlStyle.altColor);
+            } else {
+                tr.addStyle(HtmlStyle.rowColor);
+            }
+            tbody.addContent(tr);
+        }
+    }
+
+    /**
      * Adds list of packages in the index table. Generate link to each package.
      *
      * @param packages Packages to which link is to be generated
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.jvm.Profile;
+
+/**
+ * Generate the profile index for the left-hand frame in the generated output.
+ * A click on the profile name in this frame will update the page in the top
+ * left hand frame with the listing of packages of the clicked profile.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
+
+    /**
+     * Construct the ProfileIndexFrameWriter object.
+     *
+     * @param configuration the configuration object
+     * @param filename Name of the profile index file to be generated.
+     */
+    public ProfileIndexFrameWriter(ConfigurationImpl configuration,
+                                   DocPath filename) throws IOException {
+        super(configuration, filename);
+    }
+
+    /**
+     * Generate the profile index file named "profile-overview-frame.html".
+     * @throws DocletAbortException
+     * @param configuration the configuration object
+     */
+    public static void generate(ConfigurationImpl configuration) {
+        ProfileIndexFrameWriter profilegen;
+        DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME;
+        try {
+            profilegen = new ProfileIndexFrameWriter(configuration, filename);
+            profilegen.buildProfileIndexFile("doclet.Window_Overview", false);
+            profilegen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                        "doclet.exception_encountered",
+                        exc.toString(), filename);
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body) {
+        Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
+                profilesLabel);
+        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString());
+        for (int i = 1; i < profiles.getProfileCount(); i++) {
+            ul.addContent(getProfile(i));
+        }
+        div.addContent(ul);
+        body.addContent(div);
+    }
+
+    /**
+     * Gets each profile name as a separate link.
+     *
+     * @param profile the profile being documented
+     * @return content for the profile link
+     */
+    protected Content getProfile(int profile) {
+        Content profileLinkContent;
+        Content profileLabel;
+        String profileName = (Profile.lookup(profile)).name;
+        profileLabel = new StringContent(profileName);
+        profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
+                    "profileListFrame");
+        Content li = HtmlTree.LI(profileLinkContent);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarHeader(Content body) {
+        Content headerContent;
+        if (configuration.packagesheader.length() > 0) {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+        } else {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+        }
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.bar, headerContent);
+        body.addContent(heading);
+    }
+
+    /**
+     * Do nothing as there is no overview information in this page.
+     */
+    protected void addOverviewHeader(Content body) {
+    }
+
+    /**
+     * Adds "All Classes" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all classes link should be added
+     */
+    protected void addAllClassesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
+                allclassesLabel, "", "packageFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Packages" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all packages link should be added
+     */
+    protected void addAllPackagesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
+                allpackagesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarFooter(Content body) {
+        Content p = HtmlTree.P(getSpace());
+        body.addContent(p);
+    }
+
+    protected void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each package contents of a profile in the left-hand bottom
+ * frame. This will list all the Class Kinds in the package for a profile. A click on any
+ * class-kind will update the right-hand frame with the clicked class-kind page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageFrameWriter extends HtmlDocletWriter {
+
+    /**
+     * The package being documented.
+     */
+    private PackageDoc packageDoc;
+
+    /**
+     * Constructor to construct ProfilePackageFrameWriter object and to generate
+     * "profilename-package-frame.html" file in the respective package directory.
+     * For example for profile compact1 and package "java.lang" this will generate file
+     * "compact1-package-frame.html" file in the "java/lang" directory. It will also
+     * create "java/lang" directory in the current or the destination directory
+     * if it doesn't exist.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param packageDoc PackageDoc under consideration.
+     * @param profileName the name of the profile being documented
+     */
+    public ProfilePackageFrameWriter(ConfigurationImpl configuration,
+            PackageDoc packageDoc, String profileName)
+            throws IOException {
+        super(configuration, DocPath.forPackage(packageDoc).resolve(
+                DocPaths.profilePackageFrame(profileName)));
+        this.packageDoc = packageDoc;
+    }
+
+    /**
+     * Generate a profile package summary page for the left-hand bottom frame. Construct
+     * the ProfilePackageFrameWriter object and then uses it generate the file.
+     *
+     * @param configuration the current configuration of the doclet.
+     * @param packageDoc The package for which "profilename-package-frame.html" is to be generated.
+     * @param profileValue the value of the profile being documented
+     */
+    public static void generate(ConfigurationImpl configuration,
+            PackageDoc packageDoc, int profileValue) {
+        ProfilePackageFrameWriter profpackgen;
+        try {
+            String profileName = Profile.lookup(profileValue).name;
+            profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc,
+                    profileName);
+            StringBuilder winTitle = new StringBuilder(profileName);
+            String sep = " - ";
+            winTitle.append(sep);
+            String pkgName = Util.getPackageName(packageDoc);
+            winTitle.append(pkgName);
+            Content body = profpackgen.getBody(false,
+                    profpackgen.getWindowTitle(winTitle.toString()));
+            Content profName = new StringContent(profileName);
+            Content sepContent = new StringContent(sep);
+            Content pkgNameContent = new RawHtml(pkgName);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+                    profpackgen.getTargetProfileLink("classFrame", profName, profileName));
+            heading.addContent(sepContent);
+            heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
+                    "classFrame", pkgNameContent, profileName));
+            body.addContent(heading);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexContainer);
+            profpackgen.addClassListing(div, profileValue);
+            body.addContent(div);
+            profpackgen.printHtmlDocument(
+                    configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
+            profpackgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                    "doclet.exception_encountered",
+                    exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * Add class listing for all the classes in this package. Divide class
+     * listing as per the class kind and generate separate listing for
+     * Classes, Interfaces, Exceptions and Errors.
+     *
+     * @param contentTree the content tree to which the listing will be added
+     * @param profileValue the value of the profile being documented
+     */
+    protected void addClassListing(Content contentTree, int profileValue) {
+        if (packageDoc.isIncluded()) {
+            addClassKindListing(packageDoc.interfaces(),
+                getResource("doclet.Interfaces"), contentTree, profileValue);
+            addClassKindListing(packageDoc.ordinaryClasses(),
+                getResource("doclet.Classes"), contentTree, profileValue);
+            addClassKindListing(packageDoc.enums(),
+                getResource("doclet.Enums"), contentTree, profileValue);
+            addClassKindListing(packageDoc.exceptions(),
+                getResource("doclet.Exceptions"), contentTree, profileValue);
+            addClassKindListing(packageDoc.errors(),
+                getResource("doclet.Errors"), contentTree, profileValue);
+            addClassKindListing(packageDoc.annotationTypes(),
+                getResource("doclet.AnnotationTypes"), contentTree, profileValue);
+        }
+    }
+
+    /**
+     * Add specific class kind listing. Also add label to the listing.
+     *
+     * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
+     * @param labelContent content tree of the label to be added
+     * @param contentTree the content tree to which the class kind listing will be added
+     * @param profileValue the value of the profile being documented
+     */
+    protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
+            Content contentTree, int profileValue) {
+        if(arr.length > 0) {
+            Arrays.sort(arr);
+            boolean printedHeader = false;
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
+            for (int i = 0; i < arr.length; i++) {
+                if (!isTypeInProfile(arr[i], profileValue)) {
+                    continue;
+                }
+                if (!Util.isCoreClass(arr[i]) || !
+                        configuration.isGeneratedDoc(arr[i])) {
+                    continue;
+                }
+                if (!printedHeader) {
+                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
+                            true, labelContent);
+                    contentTree.addContent(heading);
+                    printedHeader = true;
+                }
+                Content link = new RawHtml (getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.PACKAGE_FRAME, arr[i],
+                        (arr[i].isInterface() ? italicsText(arr[i].name()) :
+                            arr[i].name()),"classFrame")));
+                Content li = HtmlTree.LI(link);
+                ul.addContent(li);
+            }
+            contentTree.addContent(ul);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Generate the profile package index for the left-hand frame in the generated output.
+ * A click on the package name in this frame will update the page in the bottom
+ * left hand frame with the listing of contents of the clicked profile package.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
+
+    /**
+     * Construct the ProfilePackageIndexFrameWriter object.
+     *
+     * @param configuration the configuration object
+     * @param filename Name of the package index file to be generated.
+     */
+    public ProfilePackageIndexFrameWriter(ConfigurationImpl configuration,
+                                   DocPath filename) throws IOException {
+        super(configuration, filename);
+    }
+
+    /**
+     * Generate the profile package index file.
+     * @throws DocletAbortException
+     * @param configuration the configuration object
+     * @param profileName the name of the profile being documented
+     */
+    public static void generate(ConfigurationImpl configuration, String profileName) {
+        ProfilePackageIndexFrameWriter profpackgen;
+        DocPath filename = DocPaths.profileFrame(profileName);
+        try {
+            profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename);
+            profpackgen.buildProfilePackagesIndexFile("doclet.Window_Overview", false, profileName);
+            profpackgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                        "doclet.exception_encountered",
+                        exc.toString(), filename);
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+        Content profNameContent = new StringContent(profileName);
+        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
+                getTargetProfileLink("classFrame", profNameContent, profileName));
+        heading.addContent(getSpace());
+        heading.addContent(packagesLabel);
+        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
+        PackageDoc[] packages = configuration.profilePackages.get(profileName);
+        for (int i = 0; i < packages.length; i++) {
+            if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
+                ul.addContent(getPackage(packages[i], profileName));
+            }
+        }
+        div.addContent(ul);
+        body.addContent(div);
+    }
+
+    /**
+     * Gets each package name as a separate link.
+     *
+     * @param pd PackageDoc
+     * @param profileName the name of the profile being documented
+     * @return content for the package link
+     */
+    protected Content getPackage(PackageDoc pd, String profileName) {
+        Content packageLinkContent;
+        Content pkgLabel;
+        if (pd.name().length() > 0) {
+            pkgLabel = getPackageLabel(pd.name());
+            packageLinkContent = getHyperLink(pathString(pd,
+                     DocPaths.profilePackageFrame(profileName)), pkgLabel, "",
+                    "packageFrame");
+        } else {
+            pkgLabel = new RawHtml("&lt;unnamed package&gt;");
+            packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
+                    pkgLabel, "", "packageFrame");
+        }
+        Content li = HtmlTree.LI(packageLinkContent);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarHeader(Content body) {
+        Content headerContent;
+        if (configuration.packagesheader.length() > 0) {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+        } else {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+        }
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.bar, headerContent);
+        body.addContent(heading);
+    }
+
+    /**
+     * Do nothing as there is no overview information in this page.
+     */
+    protected void addOverviewHeader(Content body) {
+    }
+
+    protected void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body) {
+    }
+
+    /**
+     * Adds "All Classes" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all classes link should be added
+     */
+    protected void addAllClassesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
+                allclassesLabel, "", "packageFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Packages" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all packages link should be added
+     */
+    protected void addAllPackagesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
+                allpackagesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Profiles" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all profiles link should be added
+     */
+    protected void addAllProfilesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
+                allprofilesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarFooter(Content body) {
+        Content p = HtmlTree.P(getSpace());
+        body.addContent(p);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each profile package contents in the right-hand
+ * frame. This will list all the Class Kinds in the package. A click on any
+ * class-kind will update the frame with the clicked class-kind page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageWriterImpl extends HtmlDocletWriter
+    implements ProfilePackageSummaryWriter {
+
+    /**
+     * The prev package name in the alpha-order list.
+     */
+    protected PackageDoc prev;
+
+    /**
+     * The next package name in the alpha-order list.
+     */
+    protected PackageDoc next;
+
+    /**
+     * The profile package being documented.
+     */
+    protected PackageDoc packageDoc;
+
+    /**
+     * The name of the profile being documented.
+     */
+    protected String profileName;
+
+    /**
+     * The value of the profile being documented.
+     */
+    protected int profileValue;
+
+    /**
+     * Constructor to construct ProfilePackageWriter object and to generate
+     * "profilename-package-summary.html" file in the respective package directory.
+     * For example for profile compact1 and package "java.lang" this will generate file
+     * "compact1-package-summary.html" file in the "java/lang" directory. It will also
+     * create "java/lang" directory in the current or the destination directory
+     * if it doesn't exist.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param packageDoc    PackageDoc under consideration.
+     * @param prev          Previous package in the sorted array.
+     * @param next          Next package in the sorted array.
+     * @param profile       The profile being documented.
+     */
+    public ProfilePackageWriterImpl(ConfigurationImpl configuration,
+            PackageDoc packageDoc, PackageDoc prev, PackageDoc next,
+            Profile profile) throws IOException {
+        super(configuration, DocPath.forPackage(packageDoc).resolve(
+                DocPaths.profilePackageSummary(profile.name)));
+        this.prev = prev;
+        this.next = next;
+        this.packageDoc = packageDoc;
+        this.profileName = profile.name;
+        this.profileValue = profile.value;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageHeader(String heading) {
+        String pkgName = packageDoc.name();
+        Content bodyTree = getBody(true, getWindowTitle(pkgName));
+        addTop(bodyTree);
+        addNavLinks(true, bodyTree);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        Content profileContent = new StringContent(profileName);
+        Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent);
+        div.addContent(profileNameDiv);
+        Content annotationContent = new HtmlTree(HtmlTag.P);
+        addAnnotationInfo(packageDoc, annotationContent);
+        div.addContent(annotationContent);
+        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.title, packageLabel);
+        tHeading.addContent(getSpace());
+        Content packageHead = new RawHtml(heading);
+        tHeading.addContent(packageHead);
+        div.addContent(tHeading);
+        addDeprecationInfo(div);
+        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
+            HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
+            docSummaryDiv.addStyle(HtmlStyle.docSummary);
+            addSummaryComment(packageDoc, docSummaryDiv);
+            div.addContent(docSummaryDiv);
+            Content space = getSpace();
+            Content descLink = getHyperLink(DocLink.fragment("package_description"),
+                    descriptionLabel, "", "");
+            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
+            div.addContent(descPara);
+        }
+        bodyTree.addContent(div);
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getContentHeader() {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.contentContainer);
+        return div;
+    }
+
+    /**
+     * Add the package deprecation information to the documentation tree.
+     *
+     * @param div the content tree to which the deprecation information will be added
+     */
+    public void addDeprecationInfo(Content div) {
+        Tag[] deprs = packageDoc.tags("deprecated");
+        if (Util.isDeprecated(packageDoc)) {
+            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
+            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
+            deprDiv.addContent(deprPhrase);
+            if (deprs.length > 0) {
+                Tag[] commentTags = deprs[0].inlineTags();
+                if (commentTags.length > 0) {
+                    addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
+                }
+            }
+            div.addContent(deprDiv);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+        addClassesSummary(classes, label, tableSummary, tableHeader,
+                packageSummaryContentTree, profileValue);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryHeader() {
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addStyle(HtmlStyle.blockList);
+        return ul;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageDescription(Content packageContentTree) {
+        if (packageDoc.inlineTags().length > 0) {
+            packageContentTree.addContent(getMarkerAnchor("package_description"));
+            Content h2Content = new StringContent(
+                    configuration.getText("doclet.Package_Description",
+                    packageDoc.name()));
+            packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
+                    true, h2Content));
+            addInlineComment(packageDoc, packageContentTree);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageTags(Content packageContentTree) {
+        addTagsInfo(packageDoc, packageContentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageFooter(Content contentTree) {
+        addNavLinks(false, contentTree);
+        addBottom(contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
+                true, contentTree);
+    }
+
+    /**
+     * Get "Use" link for this package in the navigation bar.
+     *
+     * @return a content tree for the class use link
+     */
+    protected Content getNavLinkClassUse() {
+        Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
+                useLabel, "", "");
+        Content li = HtmlTree.LI(useLink);
+        return li;
+    }
+
+    /**
+     * Get "PREV PACKAGE" link in the navigation bar.
+     *
+     * @return a content tree for the previous link
+     */
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prev == null) {
+            li = HtmlTree.LI(prevpackageLabel);
+        } else {
+            DocPath path = DocPath.relativePath(packageDoc, prev);
+            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
+                prevpackageLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "NEXT PACKAGE" link in the navigation bar.
+     *
+     * @return a content tree for the next link
+     */
+    public Content getNavLinkNext() {
+        Content li;
+        if (next == null) {
+            li = HtmlTree.LI(nextpackageLabel);
+        } else {
+            DocPath path = DocPath.relativePath(packageDoc, next);
+            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
+                nextpackageLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "Tree" link in the navigation bar. This will be link to the package
+     * tree file.
+     *
+     * @return a content tree for the tree link
+     */
+    protected Content getNavLinkTree() {
+        Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
+                treeLabel, "", "");
+        Content li = HtmlTree.LI(useLink);
+        return li;
+    }
+
+    /**
+     * Highlight "Package" in the navigation bar, as this is the package page.
+     *
+     * @return a content tree for the package link
+     */
+    protected Content getNavLinkPackage() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
+        return li;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each profile contents in the right-hand
+ * frame. This will list all the packages and Class Kinds in the profile. A click on any
+ * class-kind will update the frame with the clicked class-kind page. A click on any
+ * package will update the frame with the clicked profile package page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileWriterImpl extends HtmlDocletWriter
+    implements ProfileSummaryWriter {
+
+    /**
+     * The prev profile name in the alpha-order list.
+     */
+    protected Profile prevProfile;
+
+    /**
+     * The next profile name in the alpha-order list.
+     */
+    protected Profile nextProfile;
+
+    /**
+     * The profile being documented.
+     */
+    protected Profile profile;
+
+    /**
+     * Constructor to construct ProfileWriter object and to generate
+     * "profileName-summary.html" file.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param profile       Profile under consideration.
+     * @param prevProfile   Previous profile in the sorted array.
+     * @param nextProfile   Next profile in the sorted array.
+     */
+    public ProfileWriterImpl(ConfigurationImpl configuration,
+            Profile profile, Profile prevProfile, Profile nextProfile)
+            throws IOException {
+        super(configuration, DocPaths.profileSummary(profile.name));
+        this.prevProfile = prevProfile;
+        this.nextProfile = nextProfile;
+        this.profile = profile;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getProfileHeader(String heading) {
+        String profileName = profile.name;
+        Content bodyTree = getBody(true, getWindowTitle(profileName));
+        addTop(bodyTree);
+        addNavLinks(true, bodyTree);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.title, profileLabel);
+        tHeading.addContent(getSpace());
+        Content profileHead = new RawHtml(heading);
+        tHeading.addContent(profileHead);
+        div.addContent(tHeading);
+        bodyTree.addContent(div);
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getContentHeader() {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.contentContainer);
+        return div;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryHeader() {
+        HtmlTree li = new HtmlTree(HtmlTag.LI);
+        li.addStyle(HtmlStyle.blockList);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryTree(Content summaryContentTree) {
+        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
+        HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
+        return div;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageSummaryHeader(PackageDoc pkg) {
+        Content pkgName = getTargetProfilePackageLink(pkg,
+                    "classFrame", new StringContent(pkg.name()), profile.name);
+        Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
+        HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageSummaryTree(Content packageSummaryContentTree) {
+        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
+        return ul;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+        addClassesSummary(classes, label, tableSummary, tableHeader,
+                packageSummaryContentTree, profile.value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addProfileFooter(Content contentTree) {
+        addNavLinks(false, contentTree);
+        addBottom(contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
+                true, contentTree);
+    }
+
+    /**
+     * Get "PREV PROFILE" link in the navigation bar.
+     *
+     * @return a content tree for the previous link
+     */
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prevProfile == null) {
+            li = HtmlTree.LI(prevprofileLabel);
+        } else {
+            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+                    prevProfile.name)), prevprofileLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "NEXT PROFILE" link in the navigation bar.
+     *
+     * @return a content tree for the next link
+     */
+    public Content getNavLinkNext() {
+        Content li;
+        if (nextProfile == null) {
+            li = HtmlTree.LI(nextprofileLabel);
+        } else {
+            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+                    nextProfile.name)), nextprofileLabel, "", ""));
+        }
+        return li;
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.io.IOException;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -69,6 +70,24 @@
     /**
      * {@inheritDoc}
      */
+    public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
+        Profile prevProfile, Profile nextProfile) throws Exception {
+        return new ProfileWriterImpl(configuration, profile,
+            prevProfile, nextProfile);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
+        PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
+        return new ProfilePackageWriterImpl(configuration, packageDoc,
+            prevPkg, nextPkg, profile);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
             ClassDoc nextClass, ClassTree classTree) throws IOException {
         return new ClassWriterImpl(configuration, classDoc,
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -168,6 +168,11 @@
     public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
 
     /**
+     * Html tag for the profile name heading.
+     */
+    public static final HtmlTag PROFILE_HEADING = HtmlTag.H2;
+
+    /**
      * Html tag for the member summary heading.
      */
     public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,11 @@
     protected boolean memberDetailsListPrinted;
 
     /**
+     * Header for table displaying profiles and description..
+     */
+    protected final String[] profileTableHeader;
+
+    /**
      * Header for tables displaying packages and description..
      */
     protected final String[] packageTableHeader;
@@ -83,6 +88,8 @@
 
     public final Content packageLabel;
 
+    public final Content profileLabel;
+
     public final Content useLabel;
 
     public final Content prevLabel;
@@ -111,6 +118,10 @@
 
     public final Content allclassesLabel;
 
+    public final Content allpackagesLabel;
+
+    public final Content allprofilesLabel;
+
     public final Content indexLabel;
 
     public final Content helpLabel;
@@ -123,8 +134,14 @@
 
     public final Content nextpackageLabel;
 
+    public final Content prevprofileLabel;
+
+    public final Content nextprofileLabel;
+
     public final Content packagesLabel;
 
+    public final Content profilesLabel;
+
     public final Content methodDetailsLabel;
 
     public final Content annotationTypeDetailsLabel;
@@ -162,6 +179,10 @@
         writer = DocFile.createFileForOutput(configuration, path).openWriter();
         this.configuration = configuration;
         this.memberDetailsListPrinted = false;
+        profileTableHeader = new String[] {
+            configuration.getText("doclet.Profile"),
+            configuration.getText("doclet.Description")
+        };
         packageTableHeader = new String[] {
             configuration.getText("doclet.Package"),
             configuration.getText("doclet.Description")
@@ -175,6 +196,7 @@
         defaultPackageLabel = new RawHtml(
                 DocletConstants.DEFAULT_PACKAGE_NAME);
         packageLabel = getResource("doclet.Package");
+        profileLabel = getResource("doclet.Profile");
         useLabel = getResource("doclet.navClassUse");
         prevLabel = getResource("doclet.Prev");
         nextLabel = getResource("doclet.Next");
@@ -189,13 +211,18 @@
         deprecatedLabel = getResource("doclet.navDeprecated");
         deprecatedPhrase = getResource("doclet.Deprecated");
         allclassesLabel = getResource("doclet.All_Classes");
+        allpackagesLabel = getResource("doclet.All_Packages");
+        allprofilesLabel = getResource("doclet.All_Profiles");
         indexLabel = getResource("doclet.Index");
         helpLabel = getResource("doclet.Help");
         seeLabel = getResource("doclet.See");
         descriptionLabel = getResource("doclet.Description");
         prevpackageLabel = getResource("doclet.Prev_Package");
         nextpackageLabel = getResource("doclet.Next_Package");
+        prevprofileLabel = getResource("doclet.Prev_Profile");
+        nextprofileLabel = getResource("doclet.Next_Profile");
         packagesLabel = getResource("doclet.Packages");
+        profilesLabel = getResource("doclet.Profiles");
         methodDetailsLabel = getResource("doclet.Method_Detail");
         annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
         fieldDetailsLabel = getResource("doclet.Field_Detail");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Feb 21 17:49:56 2013 -0800
@@ -4,7 +4,9 @@
 doclet.Window_Overview=Overview List
 doclet.Window_Overview_Summary=Overview
 doclet.Package=Package
+doclet.Profile=Profile
 doclet.All_Packages=All Packages
+doclet.All_Profiles=All Profiles
 doclet.Tree=Tree
 doclet.Class_Hierarchy=Class Hierarchy
 doclet.Window_Class_Hierarchy=Class Hierarchy
@@ -17,6 +19,8 @@
 doclet.Next_Class=Next Class
 doclet.Prev_Package=Prev Package
 doclet.Next_Package=Next Package
+doclet.Prev_Profile=Prev Profile
+doclet.Next_Profile=Next Profile
 doclet.Prev_Letter=Prev Letter
 doclet.Next_Letter=Next Letter
 doclet.Href_Class_Title=class in {0}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
-import java.io.File;
-import java.util.StringTokenizer;
 
 /**
  * An abstract implementation of a Doclet.
@@ -128,6 +126,7 @@
 
         PackageListWriter.generate(configuration);
         generatePackageFiles(classtree);
+        generateProfileFiles();
 
         generateOtherFiles(root, classtree);
         configuration.tagletManager.printReport();
@@ -148,6 +147,12 @@
     }
 
     /**
+     * Generate the profile documentation.
+     *
+     */
+    protected abstract void generateProfileFiles() throws Exception;
+
+    /**
      * Generate the package documentation.
      *
      * @param classtree the data structure representing the class tree.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Feb 21 17:49:56 2013 -0800
@@ -29,6 +29,8 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -188,6 +190,17 @@
     public String sourcepath = "";
 
     /**
+     * Argument for command line option "-Xprofilespath".
+     */
+    public String profilespath = "";
+
+    /**
+     * Generate profiles documentation if profilespath is set and valid profiles
+     * are present.
+     */
+    public boolean showProfiles = false;
+
+    /**
      * Don't generate deprecated API information at all, if -nodeprecated
      * option is used. <code>nodepracted</code> is set to true if
      * -nodeprecated option is used. Default is generate deprected API
@@ -247,6 +260,16 @@
     public abstract MessageRetriever getDocletSpecificMsg();
 
     /**
+     * A profiles object used to access profiles across various pages.
+     */
+    public Profiles profiles;
+
+    /**
+     * An map of the profiles to packages.
+     */
+    public Map<String,PackageDoc[]> profilePackages;
+
+    /**
      * An array of the packages specified on the command-line merged
      * with the array of packages that contain the classes specified on the
      * command-line.  The array is sorted.
@@ -315,7 +338,8 @@
                    option.equals("-sourcepath") ||
                    option.equals("-tag") ||
                    option.equals("-taglet") ||
-                   option.equals("-tagletpath")) {
+                   option.equals("-tagletpath") ||
+                   option.equals("-xprofilespath")) {
             return 2;
         } else if (option.equals("-group") ||
                    option.equals("-linkoffline")) {
@@ -334,6 +358,38 @@
     public abstract boolean validOptions(String options[][],
         DocErrorReporter reporter);
 
+    private void initProfiles() throws IOException {
+        profiles = Profiles.read(new File(profilespath));
+        // Generate profiles documentation only is profilespath is set and if
+        // profiles is not null and profiles count is 1 or more.
+        showProfiles = (!profilespath.isEmpty() && profiles != null &&
+                profiles.getProfileCount() > 0);
+    }
+
+    private void initProfilePackages() throws IOException {
+        profilePackages = new HashMap<String,PackageDoc[]>();
+        ArrayList<PackageDoc> results;
+        Map<String,PackageDoc> packageIndex = new HashMap<String,PackageDoc>();
+        for (int i = 0; i < packages.length; i++) {
+            PackageDoc pkg = packages[i];
+            packageIndex.put(pkg.name(), pkg);
+        }
+        for (int i = 1; i < profiles.getProfileCount(); i++) {
+            Set<String> profPkgs = profiles.getPackages(i);
+            results = new ArrayList<PackageDoc>();
+            for (String packageName : profPkgs) {
+                packageName = packageName.replace("/", ".");
+                PackageDoc profPkg = packageIndex.get(packageName);
+                if (profPkg != null) {
+                    results.add(profPkg);
+                }
+            }
+            Collections.sort(results);
+            PackageDoc[] profilePkgs = results.toArray(new PackageDoc[]{});
+            profilePackages.put(Profile.lookup(i).name, profilePkgs);
+        }
+    }
+
     private void initPackageArray() {
         Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
         ClassDoc[] classes = root.specifiedClasses();
@@ -404,6 +460,8 @@
                 customTagStrs.add(os);
             } else if (opt.equals("-tagletpath")) {
                 tagletpath = os[1];
+            }  else if (opt.equals("-xprofilespath")) {
+                profilespath = os[1];
             } else if (opt.equals("-keywords")) {
                 keywords = true;
             } else if (opt.equals("-serialwarn")) {
@@ -439,6 +497,14 @@
     public void setOptions() {
         initPackageArray();
         setOptions(root.options());
+        if (!profilespath.isEmpty()) {
+            try {
+                initProfiles();
+                initProfilePackages();
+            } catch (Exception e) {
+                throw new DocletAbortException();
+            }
+        }
         setSpecificDocletOptions(root.options());
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfilePackageSummaryWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile package summary output.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+
+public interface ProfilePackageSummaryWriter {
+
+    /**
+     * Get the header for the summary.
+     *
+     * @param heading Package name.
+     * @return the header to be added to the content tree
+     */
+    public abstract Content getPackageHeader(String heading);
+
+    /**
+     * Get the header for the content.
+     *
+     * @return a content tree for the content header
+     */
+    public abstract Content getContentHeader();
+
+    /**
+     * Get the header for the package summary.
+     *
+     * @return a content tree with the package summary header
+     */
+    public abstract Content getSummaryHeader();
+
+    /**
+     * Adds the table of classes to the documentation tree.
+     *
+     * @param classes the array of classes to document.
+     * @param label the label for this table.
+     * @param tableSummary the summary string for the table
+     * @param tableHeader array of table headers
+     * @param summaryContentTree the content tree to which the summaries will be added
+     */
+    public abstract void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content summaryContentTree);
+
+    /**
+     * Adds the package description from the "packages.html" file to the documentation
+     * tree.
+     *
+     * @param packageContentTree the content tree to which the package description
+     *                           will be added
+     */
+    public abstract void addPackageDescription(Content packageContentTree);
+
+    /**
+     * Adds the tag information from the "packages.html" file to the documentation
+     * tree.
+     *
+     * @param packageContentTree the content tree to which the package tags will
+     *                           be added
+     */
+    public abstract void addPackageTags(Content packageContentTree);
+
+    /**
+     * Adds the footer to the documentation tree.
+     *
+     * @param contentTree the tree to which the footer will be added
+     */
+    public abstract void addPackageFooter(Content contentTree);
+
+    /**
+     * Print the package summary document.
+     *
+     * @param contentTree the content tree that will be printed
+     */
+    public abstract void printDocument(Content contentTree) throws IOException;
+
+    /**
+     * Close the writer.
+     */
+    public abstract void close() throws IOException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfileSummaryWriter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile summary output.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+
+public interface ProfileSummaryWriter {
+
+    /**
+     * Get the header for the summary.
+     *
+     * @param heading profile name.
+     * @return the header to be added to the content tree
+     */
+    public abstract Content getProfileHeader(String heading);
+
+    /**
+     * Get the header for the profile content.
+     *
+     * @return a content tree for the profile content header
+     */
+    public abstract Content getContentHeader();
+
+    /**
+     * Get the header for the summary header.
+     *
+     * @return a content tree with the summary header
+     */
+    public abstract Content getSummaryHeader();
+
+    /**
+     * Get the header for the summary tree.
+     *
+     * @param summaryContentTree the content tree.
+     * @return a content tree with the summary tree
+     */
+    public abstract Content getSummaryTree(Content summaryContentTree);
+
+    /**
+     * Get the header for the package summary header.
+     *
+     * @return a content tree with the package summary header
+     */
+    public abstract Content getPackageSummaryHeader(PackageDoc pkg);
+
+    /**
+     * Get the header for the package summary tree.
+     *
+     * @return a content tree with the package summary
+     */
+    public abstract Content getPackageSummaryTree(Content packageSummaryContentTree);
+
+    /**
+     * Adds the table of classes to the documentation tree.
+     *
+     * @param classes the array of classes to document.
+     * @param label the label for this table.
+     * @param tableSummary the summary string for the table
+     * @param tableHeader array of table headers
+     * @param packageSummaryContentTree the content tree to which the summaries will be added
+     */
+    public abstract void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
+
+    /**
+     * Adds the footer to the documentation tree.
+     *
+     * @param contentTree the tree to which the footer will be added
+     */
+    public abstract void addProfileFooter(Content contentTree);
+
+    /**
+     * Print the profile summary document.
+     *
+     * @param contentTree the content tree that will be printed
+     */
+    public abstract void printDocument(Content contentTree) throws IOException;
+
+    /**
+     * Close the writer.
+     */
+    public abstract void close() throws IOException;
+
+}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.internal.toolkit;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
@@ -65,6 +66,33 @@
     throws Exception;
 
     /**
+     * Return the writer for the profile summary.
+     *
+     * @param profile the profile being documented.
+     * @param prevProfile the previous profile that was documented.
+     * @param nextProfile the next profile being documented.
+     * @return the writer for the profile summary.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract ProfileSummaryWriter getProfileSummaryWriter(Profile
+        profile, Profile prevProfile, Profile nextProfile)
+    throws Exception;
+
+    /**
+     * Return the writer for the profile package summary.
+     *
+     * @param packageDoc the profile package being documented.
+     * @param prevPkg the previous profile package that was documented.
+     * @param nextPkg the next profile package being documented.
+     * @param profile the profile being documented.
+     * @return the writer for the profile package summary.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
+            PackageDoc packageDoc, PackageDoc prevPkg, PackageDoc nextPkg,
+            Profile profile) throws Exception;
+
+    /**
      * Return the writer for a class.
      *
      * @param classDoc the class being documented.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.util.Set;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -96,6 +97,36 @@
     }
 
     /**
+     * Return the builder that builds the profile summary.
+     *
+     * @param profile the profile being documented.
+     * @param prevProfile the previous profile being documented.
+     * @param nextProfile the next profile being documented.
+     * @return the builder that builds the profile summary.
+     */
+    public AbstractBuilder getProfileSummaryBuilder(Profile profile, Profile prevProfile,
+            Profile nextProfile) throws Exception {
+        return ProfileSummaryBuilder.getInstance(context, profile,
+            writerFactory.getProfileSummaryWriter(profile, prevProfile, nextProfile));
+    }
+
+    /**
+     * Return the builder that builds the profile package summary.
+     *
+     * @param pkg the profile package being documented.
+     * @param prevPkg the previous profile package being documented.
+     * @param nextPkg the next profile package being documented.
+     * @param profile the profile being documented.
+     * @return the builder that builds the profile package summary.
+     */
+    public AbstractBuilder getProfilePackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
+            PackageDoc nextPkg, Profile profile) throws Exception {
+        return ProfilePackageSummaryBuilder.getInstance(context, pkg,
+            writerFactory.getProfilePackageSummaryWriter(pkg, prevPkg, nextPkg,
+                profile), profile);
+    }
+
+    /**
      * Return the builder for the class.
      *
      * @param classDoc the class being documented.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile package.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageSummaryBuilder extends AbstractBuilder {
+    /**
+     * The root element of the profile package summary XML is {@value}.
+     */
+    public static final String ROOT = "PackageDoc";
+
+    /**
+     * The profile package being documented.
+     */
+    private final PackageDoc packageDoc;
+
+    /**
+     * The name of the profile being documented.
+     */
+    private final String profileName;
+
+    /**
+     * The value of the profile being documented.
+     */
+    private final int profileValue;
+
+    /**
+     * The doclet specific writer that will output the result.
+     */
+    private final ProfilePackageSummaryWriter profilePackageWriter;
+
+    /**
+     * The content that will be added to the profile package summary documentation tree.
+     */
+    private Content contentTree;
+
+    /**
+     * Construct a new ProfilePackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the profile package being documented.
+     * @param profilePackageWriter the doclet specific writer that will output the
+     *        result.
+     * @param profile the profile being documented.
+     */
+    private ProfilePackageSummaryBuilder(Context context,
+            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+            Profile profile) {
+        super(context);
+        this.packageDoc = pkg;
+        this.profilePackageWriter = profilePackageWriter;
+        this.profileName = profile.name;
+        this.profileValue = profile.value;
+    }
+
+    /**
+     * Construct a new ProfilePackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the profile package being documented.
+     * @param profilePackageWriter the doclet specific writer that will output the
+     *        result.
+     * @param profile the profile being documented.
+     *
+     * @return an instance of a ProfilePackageSummaryBuilder.
+     */
+    public static ProfilePackageSummaryBuilder getInstance(Context context,
+            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+            Profile profile) {
+        return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
+                profile);
+    }
+
+    /**
+     * Build the profile package summary.
+     */
+    public void build() throws IOException {
+        if (profilePackageWriter == null) {
+            //Doclet does not support this output.
+            return;
+        }
+        build(layoutParser.parseXML(ROOT), contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return ROOT;
+    }
+
+    /**
+     * Build the profile package documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     */
+    public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
+        contentTree = profilePackageWriter.getPackageHeader(
+                Util.getPackageName(packageDoc));
+        buildChildren(node, contentTree);
+        profilePackageWriter.addPackageFooter(contentTree);
+        profilePackageWriter.printDocument(contentTree);
+        profilePackageWriter.close();
+        Util.copyDocFiles(configuration, packageDoc);
+    }
+
+    /**
+     * Build the content for the profile package doc.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the package contents
+     *                    will be added
+     */
+    public void buildContent(XMLNode node, Content contentTree) {
+        Content packageContentTree = profilePackageWriter.getContentHeader();
+        buildChildren(node, packageContentTree);
+        contentTree.addContent(packageContentTree);
+    }
+
+    /**
+     * Build the profile package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the package content tree to which the summaries will
+     *                           be added
+     */
+    public void buildSummary(XMLNode node, Content packageContentTree) {
+        Content summaryContentTree = profilePackageWriter.getSummaryHeader();
+        buildChildren(node, summaryContentTree);
+        packageContentTree.addContent(summaryContentTree);
+    }
+
+    /**
+     * Build the summary for the interfaces in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the interface summary
+     *                           will be added
+     */
+    public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
+        String interfaceTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Interface_Summary"),
+                configuration.getText("doclet.interfaces"));
+        String[] interfaceTableHeader = new String[] {
+            configuration.getText("doclet.Interface"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] interfaces =
+                packageDoc.isIncluded()
+                        ? packageDoc.interfaces()
+                        : configuration.classDocCatalog.interfaces(
+                                Util.getPackageName(packageDoc));
+        if (interfaces.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    interfaces,
+                    configuration.getText("doclet.Interface_Summary"),
+                    interfaceTableSummary, interfaceTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the classes in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the class summary will
+     *                           be added
+     */
+    public void buildClassSummary(XMLNode node, Content summaryContentTree) {
+        String classTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Class_Summary"),
+                configuration.getText("doclet.classes"));
+        String[] classTableHeader = new String[] {
+            configuration.getText("doclet.Class"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] classes =
+                packageDoc.isIncluded()
+                        ? packageDoc.ordinaryClasses()
+                        : configuration.classDocCatalog.ordinaryClasses(
+                                Util.getPackageName(packageDoc));
+        if (classes.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    classes,
+                    configuration.getText("doclet.Class_Summary"),
+                    classTableSummary, classTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the enums in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the enum summary will
+     *                           be added
+     */
+    public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
+        String enumTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Summary"),
+                configuration.getText("doclet.enums"));
+        String[] enumTableHeader = new String[] {
+            configuration.getText("doclet.Enum"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] enums =
+                packageDoc.isIncluded()
+                        ? packageDoc.enums()
+                        : configuration.classDocCatalog.enums(
+                                Util.getPackageName(packageDoc));
+        if (enums.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    enums,
+                    configuration.getText("doclet.Enum_Summary"),
+                    enumTableSummary, enumTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the exceptions in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the exception summary will
+     *                           be added
+     */
+    public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
+        String exceptionTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Exception_Summary"),
+                configuration.getText("doclet.exceptions"));
+        String[] exceptionTableHeader = new String[] {
+            configuration.getText("doclet.Exception"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] exceptions =
+                packageDoc.isIncluded()
+                        ? packageDoc.exceptions()
+                        : configuration.classDocCatalog.exceptions(
+                                Util.getPackageName(packageDoc));
+        if (exceptions.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    exceptions,
+                    configuration.getText("doclet.Exception_Summary"),
+                    exceptionTableSummary, exceptionTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the errors in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the error summary will
+     *                           be added
+     */
+    public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
+        String errorTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Error_Summary"),
+                configuration.getText("doclet.errors"));
+        String[] errorTableHeader = new String[] {
+            configuration.getText("doclet.Error"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] errors =
+                packageDoc.isIncluded()
+                        ? packageDoc.errors()
+                        : configuration.classDocCatalog.errors(
+                                Util.getPackageName(packageDoc));
+        if (errors.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    errors,
+                    configuration.getText("doclet.Error_Summary"),
+                    errorTableSummary, errorTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the annotation type in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the annotation type
+     *                           summary will be added
+     */
+    public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
+        String annotationtypeTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Types_Summary"),
+                configuration.getText("doclet.annotationtypes"));
+        String[] annotationtypeTableHeader = new String[] {
+            configuration.getText("doclet.AnnotationType"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] annotationTypes =
+                packageDoc.isIncluded()
+                        ? packageDoc.annotationTypes()
+                        : configuration.classDocCatalog.annotationTypes(
+                                Util.getPackageName(packageDoc));
+        if (annotationTypes.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    annotationTypes,
+                    configuration.getText("doclet.Annotation_Types_Summary"),
+                    annotationtypeTableSummary, annotationtypeTableHeader,
+                    summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the description of the summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the tree to which the package description will
+     *                           be added
+     */
+    public void buildPackageDescription(XMLNode node, Content packageContentTree) {
+        if (configuration.nocomment) {
+            return;
+        }
+        profilePackageWriter.addPackageDescription(packageContentTree);
+    }
+
+    /**
+     * Build the tags of the summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the tree to which the package tags will be added
+     */
+    public void buildPackageTags(XMLNode node, Content packageContentTree) {
+        if (configuration.nocomment) {
+            return;
+        }
+        profilePackageWriter.addPackageTags(packageContentTree);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileSummaryBuilder extends AbstractBuilder {
+    /**
+     * The root element of the profile summary XML is {@value}.
+     */
+    public static final String ROOT = "ProfileDoc";
+
+    /**
+     * The profile being documented.
+     */
+    private final Profile profile;
+
+    /**
+     * The doclet specific writer that will output the result.
+     */
+    private final ProfileSummaryWriter profileWriter;
+
+    /**
+     * The content that will be added to the profile summary documentation tree.
+     */
+    private Content contentTree;
+
+    /**
+     * The profile package being documented.
+     */
+    private PackageDoc pkg;
+
+    /**
+     * Construct a new ProfileSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param profile the profile being documented.
+     * @param profileWriter the doclet specific writer that will output the
+     *        result.
+     */
+    private ProfileSummaryBuilder(Context context,
+            Profile profile, ProfileSummaryWriter profileWriter) {
+        super(context);
+        this.profile = profile;
+        this.profileWriter = profileWriter;
+    }
+
+    /**
+     * Construct a new ProfileSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param profile the profile being documented.
+     * @param profileWriter the doclet specific writer that will output the
+     *        result.
+     *
+     * @return an instance of a ProfileSummaryBuilder.
+     */
+    public static ProfileSummaryBuilder getInstance(Context context,
+            Profile profile, ProfileSummaryWriter profileWriter) {
+        return new ProfileSummaryBuilder(context, profile, profileWriter);
+    }
+
+    /**
+     * Build the profile summary.
+     */
+    public void build() throws IOException {
+        if (profileWriter == null) {
+            //Doclet does not support this output.
+            return;
+        }
+        build(layoutParser.parseXML(ROOT), contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return ROOT;
+    }
+
+    /**
+     * Build the profile documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     */
+    public void buildProfileDoc(XMLNode node, Content contentTree) throws Exception {
+        contentTree = profileWriter.getProfileHeader(profile.name);
+        buildChildren(node, contentTree);
+        profileWriter.addProfileFooter(contentTree);
+        profileWriter.printDocument(contentTree);
+        profileWriter.close();
+        Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
+    }
+
+    /**
+     * Build the content for the profile doc.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the profile contents
+     *                    will be added
+     */
+    public void buildContent(XMLNode node, Content contentTree) {
+        Content profileContentTree = profileWriter.getContentHeader();
+        buildChildren(node, profileContentTree);
+        contentTree.addContent(profileContentTree);
+    }
+
+    /**
+     * Build the profile summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param profileContentTree the profile content tree to which the summaries will
+     *                           be added
+     */
+    public void buildSummary(XMLNode node, Content profileContentTree) {
+        Content summaryContentTree = profileWriter.getSummaryHeader();
+        buildChildren(node, summaryContentTree);
+        profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree));
+    }
+
+    /**
+     * Build the profile package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the content tree to which the summaries will
+     *                           be added
+     */
+    public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
+        PackageDoc[] packages = configuration.profilePackages.get(profile.name);
+        for (int i = 0; i < packages.length; i++) {
+            this.pkg = packages[i];
+            Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
+            buildChildren(node, packageSummaryContentTree);
+            summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
+                    packageSummaryContentTree));
+        }
+    }
+
+    /**
+     * Build the summary for the interfaces in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the interface summary
+     *                           will be added
+     */
+    public void buildInterfaceSummary(XMLNode node, Content packageSummaryContentTree) {
+        String interfaceTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Interface_Summary"),
+                configuration.getText("doclet.interfaces"));
+        String[] interfaceTableHeader = new String[] {
+            configuration.getText("doclet.Interface"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] interfaces = pkg.interfaces();
+        if (interfaces.length > 0) {
+            profileWriter.addClassesSummary(
+                    interfaces,
+                    configuration.getText("doclet.Interface_Summary"),
+                    interfaceTableSummary, interfaceTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the classes in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the class summary will
+     *                           be added
+     */
+    public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
+        String classTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Class_Summary"),
+                configuration.getText("doclet.classes"));
+        String[] classTableHeader = new String[] {
+            configuration.getText("doclet.Class"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] classes = pkg.ordinaryClasses();
+        if (classes.length > 0) {
+            profileWriter.addClassesSummary(
+                    classes,
+                    configuration.getText("doclet.Class_Summary"),
+                    classTableSummary, classTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the enums in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the enum summary will
+     *                           be added
+     */
+    public void buildEnumSummary(XMLNode node, Content packageSummaryContentTree) {
+        String enumTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Summary"),
+                configuration.getText("doclet.enums"));
+        String[] enumTableHeader = new String[] {
+            configuration.getText("doclet.Enum"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] enums = pkg.enums();
+        if (enums.length > 0) {
+            profileWriter.addClassesSummary(
+                    enums,
+                    configuration.getText("doclet.Enum_Summary"),
+                    enumTableSummary, enumTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the exceptions in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the exception summary will
+     *                           be added
+     */
+    public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
+        String exceptionTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Exception_Summary"),
+                configuration.getText("doclet.exceptions"));
+        String[] exceptionTableHeader = new String[] {
+            configuration.getText("doclet.Exception"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] exceptions = pkg.exceptions();
+        if (exceptions.length > 0) {
+            profileWriter.addClassesSummary(
+                    exceptions,
+                    configuration.getText("doclet.Exception_Summary"),
+                    exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the errors in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the error summary will
+     *                           be added
+     */
+    public void buildErrorSummary(XMLNode node, Content packageSummaryContentTree) {
+        String errorTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Error_Summary"),
+                configuration.getText("doclet.errors"));
+        String[] errorTableHeader = new String[] {
+            configuration.getText("doclet.Error"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] errors = pkg.errors();
+        if (errors.length > 0) {
+            profileWriter.addClassesSummary(
+                    errors,
+                    configuration.getText("doclet.Error_Summary"),
+                    errorTableSummary, errorTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the annotation type in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the annotation type
+     *                           summary will be added
+     */
+    public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) {
+        String annotationtypeTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Types_Summary"),
+                configuration.getText("doclet.annotationtypes"));
+        String[] annotationtypeTableHeader = new String[] {
+            configuration.getText("doclet.AnnotationType"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] annotationTypes = pkg.annotationTypes();
+        if (annotationTypes.length > 0) {
+            profileWriter.addClassesSummary(
+                    annotationTypes,
+                    configuration.getText("doclet.Annotation_Types_Summary"),
+                    annotationtypeTableSummary, annotationtypeTableHeader,
+                    packageSummaryContentTree);
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 21 17:49:56 2013 -0800
@@ -28,6 +28,21 @@
 
 <Doclet>
 
+    <ProfileDoc>
+        <Content>
+            <Summary>
+                <PackageSummary>
+                    <InterfaceSummary/>
+                    <ClassSummary/>
+                    <EnumSummary/>
+                    <ExceptionSummary/>
+                    <ErrorSummary/>
+                    <AnnotationTypeSummary/>
+                </PackageSummary>
+            </Summary>
+        </Content>
+    </ProfileDoc>
+
     <PackageDoc>
         <Content>
             <Summary>
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Thu Feb 21 17:49:56 2013 -0800
@@ -31,6 +31,7 @@
 doclet.Building_Index_For_All_Classes=Building index for all classes...
 doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0.
 doclet.Packages=Packages
+doclet.Profiles=Profiles
 doclet.Other_Packages=Other Packages
 doclet.Notice_taglet_registered=Registered Taglet {0} ...
 doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0}
@@ -61,6 +62,7 @@
 doclet.malformed_html_link_tag=<a> tag is malformed:\n"{0}"
 doclet.tag_misuse=Tag {0} cannot be used in {1} documentation.  It can only be used in the following types of documentation: {2}.
 doclet.Package_Summary=Package Summary
+doclet.Profile_Summary=Profile Summary
 doclet.Interface_Summary=Interface Summary
 doclet.Annotation_Types_Summary=Annotation Types Summary
 doclet.Enum_Summary=Enum Summary
@@ -82,6 +84,7 @@
 doclet.Classes=Classes
 doclet.Packages=Packages
 doclet.packages=packages
+doclet.profiles=profiles
 doclet.All_Classes=All Classes
 doclet.All_Superinterfaces=All Superinterfaces:
 doclet.All_Implemented_Interfaces=All Implemented Interfaces:
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Feb 21 17:49:56 2013 -0800
@@ -191,6 +191,9 @@
     margin:10px;
     position:relative;
 }
+.indexHeader span{
+    margin-right:15px;
+}
 .indexHeader h1 {
     font-size:1.3em;
 }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,6 +87,26 @@
     /** The name of the file for the package frame. */
     public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
 
+    /** The name of the file for the profile frame. */
+     public static final DocPath profileFrame(String profileName) {
+        return DocPath.create(profileName + "-frame.html");
+    }
+
+    /** The name of the file for the profile package frame. */
+     public static final DocPath profilePackageFrame(String profileName) {
+        return DocPath.create(profileName + "-package-frame.html");
+    }
+
+    /** The name of the file for the profile package summary. */
+     public static final DocPath profilePackageSummary(String profileName) {
+        return DocPath.create(profileName + "-package-summary.html");
+    }
+
+    /** The name of the file for the profile summary. */
+     public static final DocPath profileSummary(String profileName) {
+        return DocPath.create(profileName + "-summary.html");
+    }
+
     /** The name of the file for the package list. */
     public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
 
@@ -99,6 +119,9 @@
     /** The name of the file for the package usage info. */
     public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
 
+    /** The name of the file for the overview frame. */
+    public static final DocPath PROFILE_OVERVIEW_FRAME = DocPath.create("profile-overview-frame.html");
+
     /** The name of the directory in which resources are generated.
      *  Also the name of the sub-package from which resources are read.
      */
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Thu Feb 21 17:49:56 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 
 /**
@@ -105,6 +106,20 @@
     }
 
     /**
+     * Get the profile keywords.
+     *
+     * @param profile the profile being documented
+     */
+    public String[] getMetaKeywords(Profile profile) {
+        if( configuration.keywords ) {
+            String profileName = profile.name;
+            return new String[] { profileName + " " + "profile" };
+        } else {
+            return new String[] {};
+        }
+    }
+
+    /**
      * Get the overview keywords.
      */
     public String[] getOverviewMetaKeywords(String title, String docTitle) {
--- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Feb 21 17:49:56 2013 -0800
@@ -158,10 +158,11 @@
                 throw new IllegalStateException();
         } else {
             initContext();
+            compilerMain.log = Log.instance(context);
             compilerMain.setOptions(Options.instance(context));
             compilerMain.filenames = new LinkedHashSet<File>();
             Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
-            if (!filenames.isEmpty())
+            if (filenames != null && !filenames.isEmpty())
                 throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
             compiler = JavaCompiler.instance(context);
             compiler.keepComments = true;
--- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 21 17:49:56 2013 -0800
@@ -269,6 +269,11 @@
     public static final long AUXILIARY = 1L<<44;
 
     /**
+     * Flag that marks that a symbol is not available in the current profile
+     */
+    public static final long NOT_IN_PROFILE = 1L<<45;
+
+    /**
      * Flag that indicates that an override error has been detected by Check.
      */
     public static final long BAD_OVERRIDE = 1L<<45;
--- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 21 17:49:56 2013 -0800
@@ -157,6 +157,7 @@
     public final Type deprecatedType;
     public final Type suppressWarningsType;
     public final Type inheritedType;
+    public final Type profileType;
     public final Type proprietaryType;
     public final Type systemType;
     public final Type autoCloseableType;
@@ -361,6 +362,22 @@
 
     }
 
+    // Enter a synthetic class that is used to mark classes in ct.sym.
+    // This class does not have a class file.
+    private Type enterSyntheticAnnotation(String name) {
+        ClassType type = (ClassType)enterClass(name);
+        ClassSymbol sym = (ClassSymbol)type.tsym;
+        sym.completer = null;
+        sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
+        sym.erasure_field = type;
+        sym.members_field = new Scope(sym);
+        type.typarams_field = List.nil();
+        type.allparams_field = List.nil();
+        type.supertype_field = annotationType;
+        type.interfaces_field = List.nil();
+        return type;
+    }
+
     /** Constructor; enters all predefined identifiers and operators
      *  into symbol table.
      */
@@ -524,17 +541,13 @@
         // Enter a synthetic class that is used to mark internal
         // proprietary classes in ct.sym.  This class does not have a
         // class file.
-        ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
-        this.proprietaryType = proprietaryType;
-        ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
-        proprietarySymbol.completer = null;
-        proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
-        proprietarySymbol.erasure_field = proprietaryType;
-        proprietarySymbol.members_field = new Scope(proprietarySymbol);
-        proprietaryType.typarams_field = List.nil();
-        proprietaryType.allparams_field = List.nil();
-        proprietaryType.supertype_field = annotationType;
-        proprietaryType.interfaces_field = List.nil();
+        proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
+
+        // Enter a synthetic class that is used to provide profile info for
+        // classes in ct.sym.  This class does not have a class file.
+        profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
+        MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
+        profileType.tsym.members().enter(m);
 
         // Enter a class for arrays.
         // The class implements java.lang.Cloneable and java.io.Serializable.
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 21 17:49:56 2013 -0800
@@ -3412,6 +3412,7 @@
             if (sym.name != names.init) {
                 chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym);
                 chk.checkSunAPI(tree.pos(), sym);
+                chk.checkProfile(tree.pos(), sym);
             }
 
             // Test (3): if symbol is a variable, check that its type and
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 21 17:49:56 2013 -0800
@@ -80,6 +80,7 @@
     private boolean enableSunApiLintControl;
     private final TreeInfo treeinfo;
     private final JavaFileManager fileManager;
+    private final Profile profile;
 
     // The set of lint options currently in effect. It is initialized
     // from the context, and then is set/reset as needed by Attr as it
@@ -110,7 +111,7 @@
         enter = Enter.instance(context);
         deferredAttr = DeferredAttr.instance(context);
         infer = Infer.instance(context);
-        this.types = Types.instance(context);
+        types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         Options options = Options.instance(context);
         lint = Lint.instance(context);
@@ -133,6 +134,8 @@
         Target target = Target.instance(context);
         syntheticNameChar = target.syntheticNameChar();
 
+        profile = Profile.instance(context);
+
         boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
         boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
         boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
@@ -3068,6 +3071,12 @@
         }
     }
 
+    void checkProfile(final DiagnosticPosition pos, final Symbol s) {
+        if (profile != Profile.DEFAULT && (s.flags() & NOT_IN_PROFILE) != 0) {
+            log.error(pos, "not.in.profile", s, profile);
+        }
+    }
+
 /* *************************************************************************
  * Check for recursive annotation elements.
  **************************************************************************/
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 21 17:49:56 2013 -0800
@@ -134,6 +134,11 @@
      **/
     public boolean preferSource;
 
+    /**
+     * The currently selected profile.
+     */
+    public final Profile profile;
+
     /** The log to use for verbose output
      */
     final Log log;
@@ -284,16 +289,20 @@
         annotate = Annotate.instance(context);
         verbose        = options.isSet(VERBOSE);
         checkClassFile = options.isSet("-checkclassfile");
+
         Source source = Source.instance(context);
         allowGenerics    = source.allowGenerics();
         allowVarargs     = source.allowVarargs();
         allowAnnotations = source.allowAnnotations();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
         allowDefaultMethods = source.allowDefaultMethods();
+
         saveParameterNames = options.isSet("save-parameter-names");
         cacheCompletionFailure = options.isUnset("dev");
         preferSource = "source".equals(options.get("-Xprefer"));
 
+        profile = Profile.instance(context);
+
         completionFailureName =
             options.isSet("failcomplete")
             ? names.fromString(options.get("failcomplete"))
@@ -1372,7 +1381,18 @@
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
                 if (proxy.type.tsym == syms.proprietaryType.tsym)
                     sym.flags_field |= PROPRIETARY;
-                else
+                else if (proxy.type.tsym == syms.profileType.tsym) {
+                    if (profile != Profile.DEFAULT) {
+                        for (Pair<Name,Attribute> v: proxy.values) {
+                            if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
+                                Attribute.Constant c = (Attribute.Constant) v.snd;
+                                if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
+                                    sym.flags_field |= NOT_IN_PROFILE;
+                                }
+                            }
+                        }
+                    }
+                } else
                     proxies.append(proxy);
             }
             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/jvm/Profile.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.jvm;
+
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Options;
+import java.util.EnumSet;
+import java.util.Set;
+
+import static com.sun.tools.javac.main.Option.PROFILE;
+
+/** The target profile.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public enum Profile {
+    COMPACT1("compact1", 1, Target.JDK1_8),
+    COMPACT2("compact2", 2, Target.JDK1_8),
+    COMPACT3("compact3", 3, Target.JDK1_8),
+
+    DEFAULT {
+        @Override
+        public boolean isValid(Target t) {
+            return true;
+        }
+    };
+
+    private static final Context.Key<Profile> profileKey =
+        new Context.Key<Profile>();
+
+    public static Profile instance(Context context) {
+        Profile instance = context.get(profileKey);
+        if (instance == null) {
+            Options options = Options.instance(context);
+            String profileString = options.get(PROFILE);
+            if (profileString != null) instance = lookup(profileString);
+            if (instance == null) instance = DEFAULT;
+            context.put(profileKey, instance);
+        }
+        return instance;
+    }
+
+    public final String name;
+    public final int value;
+    final Set<Target> targets;
+
+    Profile() {
+        name = null;
+        value = Integer.MAX_VALUE;
+        targets = null;
+    }
+
+    Profile(String name, int value, Target t, Target... targets) {
+        this.name = name;
+        this.value = value;
+        this.targets = EnumSet.of(t, targets);
+    }
+
+    public static Profile lookup(String name) {
+        // the set of values is small enough to do linear search
+        for (Profile p: values()) {
+            if (name.equals(p.name))
+                return p;
+        }
+        return null;
+    }
+
+    public static Profile lookup(int value) {
+        // the set of values is small enough to do linear search
+        for (Profile p: values()) {
+            if (value == p.value)
+                return p;
+        }
+        return null;
+    }
+
+    public boolean isValid(Target t) {
+        return targets.contains(t);
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Feb 21 17:49:56 2013 -0800
@@ -31,7 +31,7 @@
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.util.*;
 
-import static com.sun.tools.javac.main.Option.*;
+import static com.sun.tools.javac.main.Option.TARGET;
 
 /** The classfile version target.
  *
--- a/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 21 17:49:56 2013 -0800
@@ -49,6 +49,7 @@
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.file.CacheFSInfo;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.processing.AnnotationProcessingError;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
@@ -76,7 +77,7 @@
 
     /** The log to use for diagnostic output.
      */
-    Log log;
+    public Log log;
 
     /**
      * If true, certain errors will cause an exception, such as command line
@@ -165,6 +166,7 @@
         this.ownName = name;
         this.out = out;
     }
+
     /** A table of all options that's passed to the JavaCompiler constructor.  */
     private Options options = null;
 
@@ -307,6 +309,15 @@
             }
         }
 
+        String profileString = options.get(PROFILE);
+        if (profileString != null) {
+            Profile profile = Profile.lookup(profileString);
+            if (!profile.isValid(target)) {
+                warning("warn.profile.target.conflict", profileString, target.name);
+                return null;
+            }
+        }
+
         // handle this here so it works even if no other options given
         String showClass = options.get("showClass");
         if (showClass != null) {
--- a/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 21 17:49:56 2013 -0800
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.Log;
@@ -218,6 +219,18 @@
         }
     },
 
+    PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String operand) {
+            Profile profile = Profile.lookup(operand);
+            if (profile == null) {
+                helper.error("err.invalid.profile", operand);
+                return true;
+            }
+            return super.process(helper, option, operand);
+        }
+    },
+
     VERSION("-version", "opt.version", STANDARD, INFO) {
         @Override
         public boolean process(OptionHelper helper, String option) {
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 21 17:49:56 2013 -0800
@@ -485,6 +485,10 @@
 compiler.err.illegal.forward.ref=\
     illegal forward reference
 
+# 0: symbol, 1: string
+compiler.err.not.in.profile=\
+    {0} is not available in profile ''{1}''
+
 # 0: symbol
 compiler.warn.forward.ref=\
     reference to variable ''{0}'' before it has been initialized
--- a/src/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Feb 21 17:49:56 2013 -0800
@@ -69,6 +69,8 @@
     Pass <flag> directly to the runtime system
 javac.opt.encoding=\
     Specify character encoding used by source files
+javac.opt.profile=\
+    Check that API used is available in the specified profile
 javac.opt.target=\
     Generate class files for specific VM version
 javac.opt.source=\
@@ -97,6 +99,8 @@
     <directory>
 javac.opt.arg.encoding=\
     <encoding>
+javac.opt.arg.profile=\
+    <profile>
 javac.opt.arg.release=\
     <release>
 javac.opt.arg.number=\
@@ -175,6 +179,8 @@
      key in annotation processor option ''{0}'' is not a dot-separated sequence of identifiers
 javac.err.invalid.flag=\
     invalid flag: {0}
+javac.err.invalid.profile=\
+    invalid profile: {0}
 javac.err.invalid.target=\
     invalid target release: {0}
 javac.err.no.source.files=\
@@ -191,6 +197,8 @@
     source release {0} requires target release {1}
 javac.warn.target.default.source.conflict=\
     target release {0} conflicts with default source release {1}
+javac.warn.profile.target.conflict=\
+    profile {0} is not valid for target release {1}
 javac.err.dir.not.found=\
     directory not found: {0}
 javac.err.file.not.found=\
--- a/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Feb 21 17:49:56 2013 -0800
@@ -34,11 +34,11 @@
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.jvm.ClassWriter;
 import com.sun.tools.javac.jvm.Pool;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Pair;
 
 import java.io.File;
@@ -47,6 +47,7 @@
 import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.Set;
 
@@ -85,7 +86,10 @@
  *
  * @author Peter von der Ah\u00e9
  */
-@SupportedOptions({"com.sun.tools.javac.sym.Jar","com.sun.tools.javac.sym.Dest"})
+@SupportedOptions({
+    "com.sun.tools.javac.sym.Jar",
+    "com.sun.tools.javac.sym.Dest",
+    "com.sun.tools.javac.sym.Profiles"})
 @SupportedAnnotationTypes("*")
 public class CreateSymbols extends AbstractProcessor {
 
@@ -106,6 +110,7 @@
             processingEnv.getMessager()
                 .printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage());
         } catch (Throwable t) {
+            t.printStackTrace();
             Throwable cause = t.getCause();
             if (cause == null)
                 cause = t;
@@ -121,12 +126,17 @@
         Set<String> documented = new HashSet<String>();
         Set<PackageSymbol> packages =
             ((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages();
-        String jarName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Jar");
+        Map<String,String> pOptions = processingEnv.getOptions();
+        String jarName = pOptions.get("com.sun.tools.javac.sym.Jar");
         if (jarName == null)
             throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Jar=LOCATION_OF_JAR");
-        String destName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Dest");
+        String destName = pOptions.get("com.sun.tools.javac.sym.Dest");
         if (destName == null)
             throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Dest=LOCATION_OF_JAR");
+        String profileSpec=pOptions.get("com.sun.tools.javac.sym.Profiles");
+        if (profileSpec == null)
+            throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Profiles=PROFILES_SPEC");
+        Profiles profiles = Profiles.read(new File(profileSpec));
 
         for (PackageSymbol psym : packages) {
             String name = psym.getQualifiedName().toString();
@@ -166,12 +176,19 @@
             tool.getTask(null, fm, null, options, null, null);
         com.sun.tools.javac.main.JavaCompiler compiler =
             com.sun.tools.javac.main.JavaCompiler.instance(task.getContext());
-        ClassReader reader = ClassReader.instance(task.getContext());
         ClassWriter writer = ClassWriter.instance(task.getContext());
         Symtab syms = Symtab.instance(task.getContext());
-        Attribute.Compound proprietary =
+        Names names = Names.instance(task.getContext());
+        Attribute.Compound proprietaryAnno =
             new Attribute.Compound(syms.proprietaryType,
                                    List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
+        Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1];
+        Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym;
+        for (int i = 1; i < profileAnnos.length; i++) {
+            profileAnnos[i] = new Attribute.Compound(syms.profileType,
+                    List.<Pair<Symbol.MethodSymbol, Attribute>>of(
+                    new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
+        }
 
         Type.moreInfo = true;
         Types types = Types.instance(task.getContext());
@@ -208,8 +225,11 @@
             }
             ClassSymbol cs = (ClassSymbol) sym;
             if (addLegacyAnnotation) {
-                cs.annotations.prepend(List.of(proprietary));
+                cs.annotations.prepend(List.of(proprietaryAnno));
             }
+            int p = profiles.getProfile(cs.fullname.toString().replace(".", "/"));
+            if (0 < p && p < profileAnnos.length)
+                cs.annotations.prepend(List.of(profileAnnos[p]));
             writeClass(pool, cs, writer);
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.sym;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import com.sun.tools.javac.util.Assert;
+
+/**
+ * Provide details about profile contents.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public abstract class Profiles {
+    // for debugging
+    public static void main(String[] args) throws IOException {
+        Profiles p = Profiles.read(new File(args[0]));
+        if (args.length >= 2) {
+            Map<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
+            for (int i = 1; i <= 4; i++)
+                lists.put(i, new TreeSet<String>());
+
+            File rt_jar_lst = new File(args[1]);
+            for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) {
+                if (line.endsWith(".class")) {
+                    String type = line.substring(0, line.length() - 6);
+                    int profile = p.getProfile(type);
+                    for (int i = profile; i <= 4; i++)
+                        lists.get(i).add(type);
+                }
+            }
+
+            for (int i = 1; i <= 4; i++) {
+                BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
+                try {
+                    for (String type: lists.get(i)) {
+                        out.write(type);
+                        out.newLine();
+                    }
+                } finally {
+                    out.close();
+                }
+            }
+        }
+    }
+
+    public static Profiles read(File file) throws IOException {
+        BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
+        try {
+            Properties p = new Properties();
+            p.load(in);
+            if (p.containsKey("java/lang/Object"))
+                return new SimpleProfiles(p);
+            else
+                return new MakefileProfiles(p);
+        } finally {
+            in.close();
+        }
+    }
+
+    public abstract int getProfileCount();
+
+    public abstract int getProfile(String typeName);
+
+    public abstract Set<String> getPackages(int profile);
+
+    private static class MakefileProfiles extends Profiles {
+        static class Package {
+            final Package parent;
+            final String name;
+
+            Map<String, Package> subpackages = new TreeMap<String, Package>();
+
+            int profile;
+            Map<String, Integer> includedTypes = new TreeMap<String,Integer>();
+            Map<String, Integer> excludedTypes = new TreeMap<String,Integer>();
+
+            Package(Package parent, String name) {
+                this.parent = parent;
+                this.name = name;
+            }
+
+            int getProfile() {
+                return (parent == null) ? profile : Math.max(parent.getProfile(), profile);
+            }
+
+            int getProfile(String simpleTypeName) {
+                Integer i;
+                if ((i = includedTypes.get(simpleTypeName)) != null)
+                    return i;
+                if ((i = includedTypes.get("*")) != null)
+                    return i;
+                if ((i = excludedTypes.get(simpleTypeName)) != null)
+                    return i + 1;
+                if ((i = excludedTypes.get("*")) != null)
+                    return i + 1;
+                return getProfile();
+            }
+
+            String getName() {
+                return (parent == null) ? name : (parent.getName() + "/" + name);
+            }
+
+            void getPackages(int profile, Set<String> results) {
+                int prf = getProfile();
+                if (prf != 0 && profile >= prf)
+                    results.add(getName());
+                for (Package pkg: subpackages.values())
+                    pkg.getPackages(profile, results);
+            }
+        }
+
+        final static Map<String, Package> packages = new TreeMap<String, Package>();
+        int maxProfile;
+
+        MakefileProfiles(Properties p) {
+            int profile = 1;
+            while (true) {
+                String inclPackages = p.getProperty("PROFILE_" + profile + "_RTJAR_INCLUDE_PACKAGES");
+                if (inclPackages == null)
+                    break;
+                for (String pkg: inclPackages.substring(1).trim().split("\\s+")) {
+                    if (pkg.endsWith("/"))
+                        pkg = pkg.substring(0, pkg.length() - 1);
+                    includePackage(profile, pkg);
+                }
+                String inclTypes =  p.getProperty("PROFILE_" + profile + "_RTJAR_INCLUDE_TYPES");
+                if (inclTypes != null) {
+                    for (String type: inclTypes.replace("$$", "$").split("\\s+")) {
+                        if (type.endsWith(".class"))
+                            includeType(profile, type.substring(0, type.length() - 6));
+                    }
+                }
+                String exclTypes =  p.getProperty("PROFILE_" + profile + "_RTJAR_EXCLUDE_TYPES");
+                if (exclTypes != null) {
+                    for (String type: exclTypes.replace("$$", "$").split("\\s+")) {
+                        if (type.endsWith(".class"))
+                            excludeType(profile, type.substring(0, type.length() - 6));
+                    }
+                }
+                maxProfile = profile;
+                profile++;
+            }
+        }
+
+        @Override
+        public int getProfileCount() {
+            return maxProfile;
+        }
+
+        @Override
+        public int getProfile(String typeName) {
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            return p.getProfile(simpleName);
+        }
+
+        @Override
+        public Set<String> getPackages(int profile) {
+            Set<String> results = new TreeSet<String>();
+            for (Package p: packages.values())
+                p.getPackages(profile, results);
+            return results;
+        }
+
+        private void includePackage(int profile, String packageName) {
+//            System.err.println("include package " + packageName);
+            Package p = getPackage(packageName);
+            Assert.check(p.profile == 0);
+            p.profile = profile;
+        }
+
+        private void includeType(int profile, String typeName) {
+//            System.err.println("include type " + typeName);
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            Assert.check(!p.includedTypes.containsKey(simpleName));
+            p.includedTypes.put(simpleName, profile);
+        }
+
+        private void excludeType(int profile, String typeName) {
+//            System.err.println("exclude type " + typeName);
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            Assert.check(!p.excludedTypes.containsKey(simpleName));
+            p.excludedTypes.put(simpleName, profile);
+        }
+
+        private Package getPackage(String packageName) {
+            int sep = packageName.lastIndexOf("/");
+            Package parent;
+            Map<String, Package> parentSubpackages;
+            String simpleName;
+            if (sep == -1) {
+                parent = null;
+                parentSubpackages = packages;
+                simpleName = packageName;
+            } else {
+                parent = getPackage(packageName.substring(0, sep));
+                parentSubpackages = parent.subpackages;
+                simpleName = packageName.substring(sep + 1);
+            }
+
+            Package p = parentSubpackages.get(simpleName);
+            if (p == null) {
+                parentSubpackages.put(simpleName, p = new Package(parent, simpleName));
+            }
+            return p;
+        }
+    }
+
+    private static class SimpleProfiles extends Profiles {
+        private final Map<String, Integer> map;
+        private final int profileCount;
+
+        SimpleProfiles(Properties p) {
+            int max = 0;
+            map = new HashMap<String, Integer>();
+            for (Map.Entry<Object,Object> e: p.entrySet()) {
+                String typeName = (String) e.getKey();
+                int profile = Integer.valueOf((String) e.getValue());
+                map.put(typeName, profile);
+                max = Math.max(max, profile);
+            }
+            profileCount = max;
+        }
+
+        @Override
+        public int getProfileCount() {
+            return profileCount;
+        }
+
+        @Override
+        public int getProfile(String typeName) {
+            return map.get(typeName);
+        }
+
+        @Override
+        public Set<String> getPackages(int profile) {
+            Set<String> results = new TreeSet<String>();
+            for (Map.Entry<String,Integer> e: map.entrySet()) {
+                String tn = e.getKey();
+                int prf = e.getValue();
+                int sep = tn.lastIndexOf("/");
+                if (sep > 0 && profile >= prf)
+                    results.add(tn);
+            }
+            return results;
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -45,6 +45,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.CapturedType;
 import com.sun.tools.javac.file.BaseFileObject;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.Pretty;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
@@ -197,6 +198,9 @@
         else if (arg instanceof JavaFileObject) {
             return ((JavaFileObject)arg).getName();
         }
+        else if (arg instanceof Profile) {
+            return ((Profile)arg).name;
+        }
         else if (arg instanceof Formattable) {
             return ((Formattable)arg).toString(l, messages);
         }
--- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Feb 21 12:23:27 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Feb 21 17:49:56 2013 -0800
@@ -24,6 +24,7 @@
  */
 package com.sun.tools.javac.util;
 
+import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -96,7 +97,7 @@
         this.diags = JCDiagnostic.Factory.instance(context);
         this.types = Types.instance(context);
         this.messages = JavacMessages.instance(context);
-        whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
+        whereClauses = new EnumMap<WhereClauseKind, Map<Type, JCDiagnostic>>(WhereClauseKind.class);
         configuration = new RichConfiguration(Options.instance(context), formatter);
         for (WhereClauseKind kind : WhereClauseKind.values())
             whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug      8006124
+ * @summary  Test javadoc support for profiles.
+ * @author   Bhavesh Patel
+ * @library  ../lib/
+ * @build    JavadocTester TestProfiles
+ * @run main TestProfiles
+ */
+public class TestProfiles extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8006124";
+    private static final String PROFILE_BUG_ID = BUG_ID + "-1";
+    private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
+    //Javadoc arguments.
+    private static final String[] ARGS1 = new String[]{
+        "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS
+        + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+    };
+    private static final String[] ARGS2 = new String[]{
+        "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+    };
+    //Input for string tests for profiles.
+    private static final String[][] PROFILES_TEST = {
+        // Tests for profile-overview-frame.html listing all profiles.
+        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
+            "<span><a href=\"overview-frame.html\" "
+            + "target=\"profileListFrame\">All Packages</a></span>"
+        },
+        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
+            "<li><a href=\"compact1-frame.html\" target=\"profileListFrame\">"
+            + "compact1</a></li>"
+        },
+        // Tests for profileName-frame.html listing all packages in a profile.
+        {PROFILE_BUG_ID + FS + "compact2-frame.html",
+            "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
+            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-frame.html",
+            "<li><a href=\"pkg4/compact2-package-frame.html\" "
+            + "target=\"packageFrame\">pkg4</a></li>"
+        },
+        // Test for profileName-package-frame.html listing all types in a
+        // package of a profile.
+        {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a>"
+        },
+        // Tests for profileName-summary.html listing the summary for a profile.
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
+            + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<h3><a href=\"pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a></h3>"
+        },
+        // Tests for profileName-package-summary.html listing the summary for a
+        // package in a profile.
+        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
+            + "</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<div class=\"subTitle\">compact3</div>"
+        },
+        //Test for "overview-frame.html" showing the "All Profiles" link.
+        {PROFILE_BUG_ID + FS + "overview-frame.html",
+            "<span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        //Test for "className.html" showing the profile information for the type.
+        {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
+            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
+        }
+    };
+    private static final String[][] PROFILES_NEGATED_TEST = {
+        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
+            "<div class=\"subTitle\">compact1"
+        },
+        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
+            "<div class=\"subTitle\">compact1"
+        },
+        {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
+            "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
+            + "target=\"classFrame\">Anno1Pkg4</a></li>"
+        }
+    };
+    private static final String[][] PACKAGES_TEST = {
+        {PACKAGE_BUG_ID + FS + "overview-frame.html",
+            "<h2 title=\"Packages\">Packages</h2>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
+            "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
+            + "target=\"classFrame\">pkg4</a></h1>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
+            "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
+            + "class=\"title\">Package&nbsp;pkg4</h1>" + NL + "</div>"
+        }
+    };
+    private static final String[][] PACKAGES_NEGATED_TEST = {
+        {PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
+            "<span><a href=\"overview-frame.html\" "
+            + "target=\"profileListFrame\">All Packages</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "compact2-frame.html",
+            "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
+            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a>"
+        },
+        {PACKAGE_BUG_ID + FS + "compact2-summary.html",
+            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<div class=\"subTitle\">compact3</div>"
+        },
+        {PACKAGE_BUG_ID + FS + "overview-frame.html",
+            "<span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
+            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
+        }
+    };
+
+    /**
+     * The entry point of the test.
+     *
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestProfiles tester = new TestProfiles();
+        run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
+        run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Class1Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Class2Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class2Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Class3Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class3Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Interface1Pkg1.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg1 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+
+    /**
+     * Another test method.
+     *
+     * @param c blah.
+     */
+    void method2(int c);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg2/Anno1Pkg2.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg2;
+
+import java.lang.annotation.*;
+
+/**
+ * Test Annotation class.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface Anno1Pkg2 {
+    /**
+     * Comment.
+     */
+    String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg2/Anno2Pkg2.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg2;
+
+import java.lang.annotation.*;
+
+/*
+ * A sample interface.
+ */
+public @interface Anno2Pkg2 {
+    boolean value() default true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg2;
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg2 {
+
+    /**
+     * A sample enum.
+     */
+    public static enum ModalExclusionType {
+        /**
+         * Test comment.
+         */
+        NO_EXCLUDE,
+        /**
+         * Another comment.
+         */
+        APPLICATION_EXCLUDE
+    };
+
+    /**
+     * A string constant.
+     */
+    public static final String CONSTANT1 = "C2";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg3/Class1Pkg3.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg3;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg3 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg3/Class2Pkg3.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg3;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class2Pkg3 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg3/Interface1Pkg3.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg3;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg3 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+
+    /**
+     * Another test method.
+     *
+     * @param c blah.
+     */
+    void method2(int c);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg4/Anno1Pkg4.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg4;
+
+import java.lang.annotation.*;
+
+/**
+ * Test Annotation class.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface Anno1Pkg4 {
+    /**
+     * Comment.
+     */
+    String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg4/Class1Pkg4.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg4;
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg4 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg5/Class1Pkg5.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg5;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg5 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg5/Interface1Pkg5.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg5;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg5 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,42 @@
+PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
+    pkg2 
+
+PROFILE_1_RTJAR_INCLUDE_TYPES := \
+    pkg3/Class1Pkg3.class
+
+PROFILE_1_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_1_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
+    pkg4 
+
+PROFILE_2_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_2_RTJAR_EXCLUDE_TYPES := \
+    pkg4/Anno1Pkg4.class 
+
+PROFILE_2_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
+    pkg5 
+
+PROFILE_3_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_3_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_3_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
+    pkg1 
+
+PROFILE_4_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_4_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_4_INCLUDE_METAINF_SERVICES :=  
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotInProfile.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.in.profile
+// options: -profile compact1
+
+class NotInProfile {
+    Class<?> c = java.awt.Frame.class;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/profiles/ProfileOptionTest.java	Thu Feb 21 17:49:56 2013 -0800
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8004182
+ * @summary Add support for profiles in javac
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.javac.jvm.Target;
+
+
+public class ProfileOptionTest {
+    public static void main(String... args) throws Exception {
+        new ProfileOptionTest().run();
+    }
+
+    private final JavaCompiler javac = JavacTool.create();
+    private final StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
+
+
+    // ---------- Test cases, invoked reflectively via run. ----------
+
+    @Test
+    void testInvalidProfile_CommandLine() throws Exception {
+        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
+        String badName = "foo";
+        List<String> opts = Arrays.asList("-profile", badName);
+        StringWriter sw = new StringWriter();
+        try {
+            JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
+                Arrays.asList(fo));
+            throw new Exception("expected exception not thrown");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
+
+    @Test
+    void testInvalidProfile_API() throws Exception {
+        String badName = "foo";
+        String[] opts = { "-profile", badName };
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(opts, pw);
+
+        // sadly, command line errors are not (yet?) reported to
+        // the diag listener
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out.trim());
+
+        if (!out.contains("invalid profile: " + badName)) {
+            error("expected message not found");
+        }
+    }
+
+    @Test
+    void testTargetProfileCombinations() throws Exception {
+        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
+        for (Target t: Target.values()) {
+            switch (t) {
+                case JDK1_1: case JDK1_2: // no equivalent -source
+                case JDK1_4_1: case JDK1_4_2: case JSR14: // transitional values
+                    continue;
+            }
+
+            for (Profile p: Profile.values()) {
+                List<String> opts = new ArrayList<String>();
+                opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
+                opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
+                if (p != Profile.DEFAULT)
+                    opts.addAll(Arrays.asList("-profile", p.name));
+                StringWriter sw = new StringWriter();
+                JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
+                        Arrays.asList(fo));
+                task.analyze();
+
+                // sadly, command line errors are not (yet?) reported to
+                // the diag listener
+                String out = sw.toString();
+                if (!out.isEmpty())
+                    System.err.println(out.trim());
+
+                switch (t) {
+                    case JDK1_8:
+                        if (!out.isEmpty())
+                            error("unexpected output from compiler");
+                        break;
+                    default:
+                        if (p != Profile.DEFAULT
+                                && !out.contains("profile " + p.name
+                                    + " is not valid for target release " + t.name)) {
+                            error("expected message not found");
+                        }
+                }
+            }
+        }
+    }
+
+    @Test
+    void testClassesInProfiles() throws Exception {
+        for (Profile p: Profile.values()) {
+            for (Map.Entry<Profile, List<JavaFileObject>> e: testClasses.entrySet()) {
+                for (JavaFileObject fo: e.getValue()) {
+                    DiagnosticCollector<JavaFileObject> dl =
+                            new DiagnosticCollector<JavaFileObject>();
+                    List<String> opts = (p == Profile.DEFAULT)
+                            ? Collections.<String>emptyList()
+                            : Arrays.asList("-profile", p.name);
+                    JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
+                            Arrays.asList(fo));
+                    task.analyze();
+
+                    List<String> expectDiagCodes = (p.value >= e.getKey().value)
+                            ? Collections.<String>emptyList()
+                            : Arrays.asList("compiler.err.not.in.profile");
+
+                    checkDiags(opts + " " + fo.getName(), dl.getDiagnostics(), expectDiagCodes);
+                }
+            }
+        }
+    }
+
+    Map<Profile, List<JavaFileObject>> testClasses =
+            new EnumMap<Profile, List<JavaFileObject>>(Profile.class);
+
+    void initTestClasses() {
+        // The following table assumes the existence of specific classes
+        // in specific profiles, as defined in the Java SE 8 spec.
+        init(Profile.COMPACT1,
+                java.lang.String.class);
+
+        init(Profile.COMPACT2,
+                javax.xml.XMLConstants.class);
+
+        init(Profile.COMPACT3,
+                javax.script.Bindings.class,
+                com.sun.security.auth.PolicyFile.class); // specifically included in 3
+
+        init(Profile.DEFAULT,
+                java.beans.BeanInfo.class,
+                javax.management.remote.rmi._RMIServer_Stub.class); // specifically excluded in 3
+    }
+
+    void init(Profile p, Class<?>... classes) {
+        List<JavaFileObject> srcs = new ArrayList<JavaFileObject>();
+        for (Class<?> c: classes) {
+            String name = "T" + c.getSimpleName();
+            String src =
+                    "class T" + name + "{" + "\n" +
+                    "    Class<?> c = " + c.getName() + ".class;\n" +
+                    "}";
+            srcs.add(new StringJavaFileObject(name + ".java", src));
+        }
+        testClasses.put(p, srcs);
+    }
+
+    void checkDiags(String msg, List<Diagnostic<? extends JavaFileObject>> diags, List<String> expectDiagCodes) {
+        System.err.print(msg);
+        if (diags.isEmpty())
+            System.err.println(" OK");
+        else {
+            System.err.println();
+            System.err.println(diags);
+        }
+
+        List<String> foundDiagCodes = new ArrayList<String>();
+        for (Diagnostic<? extends JavaFileObject> d: diags)
+            foundDiagCodes.add(d.getCode());
+
+        if (!foundDiagCodes.equals(expectDiagCodes)) {
+            System.err.println("Found diag codes:    " + foundDiagCodes);
+            System.err.println("Expected diag codes: " + expectDiagCodes);
+            error("expected diagnostics not found");
+        }
+    }
+
+    /** Marker annotation for test cases. */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Test { }
+
+    /** Run all test cases. */
+    void run() throws Exception {
+        initTestClasses();
+
+        for (Method m: getClass().getDeclaredMethods()) {
+            Annotation a = m.getAnnotation(Test.class);
+            if (a != null) {
+                System.err.println(m.getName());
+                try {
+                    m.invoke(this, new Object[] { });
+                } catch (InvocationTargetException e) {
+                    Throwable cause = e.getCause();
+                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
+                }
+                System.err.println();
+            }
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    private static class StringJavaFileObject extends SimpleJavaFileObject {
+        StringJavaFileObject(String name, String text) {
+            super(URI.create(name), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+        @Override
+        public CharSequence getCharContent(boolean b) {
+            return text;
+        }
+        private String text;
+    }
+}