langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java
changeset 25454 376a52c9540c
parent 22163 3651128c74eb
equal deleted inserted replaced
25453:be80cf0463b3 25454:376a52c9540c
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2014, 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
    42  * @see com.sun.javadoc.PackageDoc
    42  * @see com.sun.javadoc.PackageDoc
    43  * @author Atul M Dambalkar
    43  * @author Atul M Dambalkar
    44  */
    44  */
    45 public class PackageListWriter extends PrintWriter {
    45 public class PackageListWriter extends PrintWriter {
    46 
    46 
    47     private Configuration configuration;
    47     private final Configuration configuration;
       
    48     private final Utils utils;
    48 
    49 
    49     /**
    50     /**
    50      * Constructor.
    51      * Constructor.
    51      *
    52      *
    52      * @param configuration the current configuration of the doclet.
    53      * @param configuration the current configuration of the doclet.
    53      */
    54      */
    54     public PackageListWriter(Configuration configuration) throws IOException {
    55     public PackageListWriter(Configuration configuration) throws IOException {
    55         super(DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST).openWriter());
    56         super(DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST).openWriter());
    56         this.configuration = configuration;
    57         this.configuration = configuration;
       
    58         this.utils = configuration.utils;
    57     }
    59     }
    58 
    60 
    59     /**
    61     /**
    60      * Generate the package index.
    62      * Generate the package index.
    61      *
    63      *
    78     protected void generatePackageListFile(RootDoc root) {
    80     protected void generatePackageListFile(RootDoc root) {
    79         ArrayList<String> names = new ArrayList<>();
    81         ArrayList<String> names = new ArrayList<>();
    80         for (PackageDoc pkg : configuration.packages) {
    82         for (PackageDoc pkg : configuration.packages) {
    81             // if the -nodeprecated option is set and the package is marked as
    83             // if the -nodeprecated option is set and the package is marked as
    82             // deprecated, do not include it in the packages list.
    84             // deprecated, do not include it in the packages list.
    83             if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
    85             if (!(configuration.nodeprecated && utils.isDeprecated(pkg)))
    84                 names.add(pkg.name());
    86                 names.add(pkg.name());
    85         }
    87         }
    86         Collections.sort(names);
    88         Collections.sort(names);
    87         for (String name : names) {
    89         for (String name : names) {
    88             println(name);
    90             println(name);