langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
changeset 19937 7dacecdfbad4
parent 19911 1cdd11ae40c8
child 22153 f9f06fcca59d
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Sep 11 08:30:58 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Sep 11 14:50:11 2013 -0700
@@ -396,6 +396,9 @@
             interimResults.put(p, new ArrayList<PackageDoc>());
 
         for (PackageDoc pkg: packages) {
+            if (nodeprecated && Util.isDeprecated(pkg)) {
+                continue;
+            }
             // the getProfile method takes a type name, not a package name,
             // but isn't particularly fussy about the simple name -- so just use *
             int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*");
@@ -409,12 +412,17 @@
         // Build the profilePackages structure used by the doclet
         profilePackages = new HashMap<String,PackageDoc[]>();
         List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
+        int size;
         for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
             Profile p = e.getKey();
             List<PackageDoc> pkgs =  e.getValue();
             pkgs.addAll(prev); // each profile contains all lower profiles
             Collections.sort(pkgs);
-            profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()]));
+            size = pkgs.size();
+            // For a profile, if there are no packages to be documented, do not add
+            // it to profilePackages map.
+            if (size > 0)
+                profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()]));
             prev = pkgs;
         }
 
@@ -719,6 +727,17 @@
     }
 
     /**
+     * Check the validity of the given profile. Return false if there are no
+     * valid packages to be documented for the profile.
+     *
+     * @param profileName the profile that needs to be validated.
+     * @return true if the profile has valid packages to be documented.
+     */
+    public boolean shouldDocumentProfile(String profileName) {
+        return profilePackages.containsKey(profileName);
+    }
+
+    /**
      * Check the validity of the given Source or Output File encoding on this
      * platform.
      *