langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
changeset 22163 3651128c74eb
parent 22159 682da512ec17
child 22165 ec53c8946fc2
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
   305      */
   305      */
   306     public Configuration() {
   306     public Configuration() {
   307         message =
   307         message =
   308             new MessageRetriever(this,
   308             new MessageRetriever(this,
   309             "com.sun.tools.doclets.internal.toolkit.resources.doclets");
   309             "com.sun.tools.doclets.internal.toolkit.resources.doclets");
   310         excludedDocFileDirs = new HashSet<String>();
   310         excludedDocFileDirs = new HashSet<>();
   311         excludedQualifiers = new HashSet<String>();
   311         excludedQualifiers = new HashSet<>();
   312         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
   312         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
   313     }
   313     }
   314 
   314 
   315     /**
   315     /**
   316      * Return the builder factory for this doclet.
   316      * Return the builder factory for this doclet.
   390 
   390 
   391         profiles = Profiles.read(new File(profilespath));
   391         profiles = Profiles.read(new File(profilespath));
   392 
   392 
   393         // Group the packages to be documented by the lowest profile (if any)
   393         // Group the packages to be documented by the lowest profile (if any)
   394         // in which each appears
   394         // in which each appears
   395         Map<Profile, List<PackageDoc>> interimResults =
   395         Map<Profile, List<PackageDoc>> interimResults = new EnumMap<>(Profile.class);
   396                 new EnumMap<Profile, List<PackageDoc>>(Profile.class);
       
   397         for (Profile p: Profile.values())
   396         for (Profile p: Profile.values())
   398             interimResults.put(p, new ArrayList<PackageDoc>());
   397             interimResults.put(p, new ArrayList<>());
   399 
   398 
   400         for (PackageDoc pkg: packages) {
   399         for (PackageDoc pkg: packages) {
   401             if (nodeprecated && Util.isDeprecated(pkg)) {
   400             if (nodeprecated && Util.isDeprecated(pkg)) {
   402                 continue;
   401                 continue;
   403             }
   402             }
   410                 pkgs.add(pkg);
   409                 pkgs.add(pkg);
   411             }
   410             }
   412         }
   411         }
   413 
   412 
   414         // Build the profilePackages structure used by the doclet
   413         // Build the profilePackages structure used by the doclet
   415         profilePackages = new HashMap<String,PackageDoc[]>();
   414         profilePackages = new HashMap<>();
   416         List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
   415         List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
   417         int size;
   416         int size;
   418         for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
   417         for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
   419             Profile p = e.getKey();
   418             Profile p = e.getKey();
   420             List<PackageDoc> pkgs =  e.getValue();
   419             List<PackageDoc> pkgs =  e.getValue();
   432         // of the packages to be documented.
   431         // of the packages to be documented.
   433         showProfiles = !prev.isEmpty();
   432         showProfiles = !prev.isEmpty();
   434     }
   433     }
   435 
   434 
   436     private void initPackageArray() {
   435     private void initPackageArray() {
   437         Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
   436         Set<PackageDoc> set = new HashSet<>(Arrays.asList(root.specifiedPackages()));
   438         for (ClassDoc aClass : root.specifiedClasses()) {
   437         for (ClassDoc aClass : root.specifiedClasses()) {
   439             set.add(aClass.containingPackage());
   438             set.add(aClass.containingPackage());
   440         }
   439         }
   441         ArrayList<PackageDoc> results = new ArrayList<PackageDoc>(set);
   440         ArrayList<PackageDoc> results = new ArrayList<>(set);
   442         Collections.sort(results);
   441         Collections.sort(results);
   443         packages = results.toArray(new PackageDoc[] {});
   442         packages = results.toArray(new PackageDoc[] {});
   444     }
   443     }
   445 
   444 
   446     /**
   445     /**
   447      * Set the command line options supported by this configuration.
   446      * Set the command line options supported by this configuration.
   448      *
   447      *
   449      * @param options the two dimensional array of options.
   448      * @param options the two dimensional array of options.
   450      */
   449      */
   451     public void setOptions(String[][] options) throws Fault {
   450     public void setOptions(String[][] options) throws Fault {
   452         LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<String[]>();
   451         LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<>();
   453 
   452 
   454         // Some options, specifically -link and -linkoffline, require that
   453         // Some options, specifically -link and -linkoffline, require that
   455         // the output directory has already been created: so do that first.
   454         // the output directory has already been created: so do that first.
   456         for (String[] os : options) {
   455         for (String[] os : options) {
   457             String opt = StringUtils.toLowerCase(os[0]);
   456             String opt = StringUtils.toLowerCase(os[0]);
   627      *                  to the end of the last token.
   626      *                  to the end of the last token.
   628      *
   627      *
   629      * @return an array of tokens.
   628      * @return an array of tokens.
   630      */
   629      */
   631     private String[] tokenize(String s, char separator, int maxTokens) {
   630     private String[] tokenize(String s, char separator, int maxTokens) {
   632         List<String> tokens = new ArrayList<String>();
   631         List<String> tokens = new ArrayList<>();
   633         StringBuilder  token = new StringBuilder ();
   632         StringBuilder  token = new StringBuilder ();
   634         boolean prevIsEscapeChar = false;
   633         boolean prevIsEscapeChar = false;
   635         for (int i = 0; i < s.length(); i += Character.charCount(i)) {
   634         for (int i = 0; i < s.length(); i += Character.charCount(i)) {
   636             int currentChar = s.codePointAt(i);
   635             int currentChar = s.codePointAt(i);
   637             if (prevIsEscapeChar) {
   636             if (prevIsEscapeChar) {