langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
changeset 9606 e5a619cb5dd3
parent 5520 86e4b9a9da40
child 14259 fb94a1df0d53
equal deleted inserted replaced
9605:c1f91868e24d 9606:e5a619cb5dd3
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.tools.doclets.internal.toolkit.util;
    26 package com.sun.tools.doclets.internal.toolkit.util;
    27 
    27 
       
    28 import java.util.*;
    28 import com.sun.javadoc.*;
    29 import com.sun.javadoc.*;
    29 import java.util.*;
    30 import com.sun.tools.doclets.internal.toolkit.Configuration;
    30 
    31 
    31 /**
    32 /**
    32  * This class acts as an artificial PackageDoc for classes specified
    33  * This class acts as an artificial PackageDoc for classes specified
    33  * on the command line when running Javadoc.  For example, if you
    34  * on the command line when running Javadoc.  For example, if you
    34  * specify several classes from package java.lang, this class will catalog
    35  * specify several classes from package java.lang, this class will catalog
    86      /**
    87      /**
    87       * Stores interfaces for each package
    88       * Stores interfaces for each package
    88       */
    89       */
    89      private Map<String,Set<ClassDoc>> interfaces;
    90      private Map<String,Set<ClassDoc>> interfaces;
    90 
    91 
       
    92      private Configuration configuration;
       
    93 
    91      /**
    94      /**
    92       * Construct a new ClassDocCatalog.
    95       * Construct a new ClassDocCatalog.
    93       *
    96       *
    94       * @param classdocs the array of ClassDocs to catalog
    97       * @param classdocs the array of ClassDocs to catalog
    95       */
    98       */
    96      public ClassDocCatalog (ClassDoc[] classdocs) {
    99      public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) {
    97          init();
   100          init();
       
   101          this.configuration = config;
    98          for (int i = 0; i < classdocs.length; i++) {
   102          for (int i = 0; i < classdocs.length; i++) {
    99              addClassDoc(classdocs[i]);
   103              addClassDoc(classdocs[i]);
   100          }
   104          }
   101      }
   105      }
   102 
   106 
   149        * @param map the Map to add the ClassDoc to.
   153        * @param map the Map to add the ClassDoc to.
   150        */
   154        */
   151       private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
   155       private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
   152 
   156 
   153           PackageDoc pkg = classdoc.containingPackage();
   157           PackageDoc pkg = classdoc.containingPackage();
   154           if (pkg.isIncluded()) {
   158           if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) {
   155               //No need to catalog this class since it's package is
   159               //No need to catalog this class if it's package is
   156               //included on the command line
   160               //included on the command line or if -nodeprecated option is set
       
   161               // and the containing package is marked as deprecated.
   157               return;
   162               return;
   158           }
   163           }
   159           String key = Util.getPackageName(pkg);
   164           String key = Util.getPackageName(pkg);
   160           Set<ClassDoc> s = map.get(key);
   165           Set<ClassDoc> s = map.get(key);
   161           if (s == null) {
   166           if (s == null) {