src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java

changeset 74
5a9172b251dd
parent 1
9a66ca7c79fa
child 117
24a47c3062fe
     1.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Jul 15 09:50:36 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Jul 15 19:22:51 2008 -0700
     1.3 @@ -73,9 +73,9 @@
     1.4       * @return List       List of eligible members for whom
     1.5       *                    documentation is getting generated.
     1.6       */
     1.7 -    public static List excludeDeprecatedMembersAsList(
     1.8 +    public static List<ProgramElementDoc> excludeDeprecatedMembersAsList(
     1.9          ProgramElementDoc[] members) {
    1.10 -        List list = new ArrayList();
    1.11 +        List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>();
    1.12          for (int i = 0; i < members.length; i++) {
    1.13              if (members[i].tags("deprecated").length == 0) {
    1.14                  list.add(members[i]);
    1.15 @@ -372,10 +372,10 @@
    1.16       * We want the list of types in alphabetical order.  However, types are not
    1.17       * comparable.  We need a comparator for now.
    1.18       */
    1.19 -    private static class TypeComparator implements Comparator {
    1.20 -        public int compare(Object type1, Object type2) {
    1.21 -            return ((Type) type1).qualifiedTypeName().toLowerCase().compareTo(
    1.22 -                ((Type) type2).qualifiedTypeName().toLowerCase());
    1.23 +    private static class TypeComparator implements Comparator<Type> {
    1.24 +        public int compare(Type type1, Type type2) {
    1.25 +            return type1.qualifiedTypeName().toLowerCase().compareTo(
    1.26 +                type2.qualifiedTypeName().toLowerCase());
    1.27          }
    1.28      }
    1.29  
    1.30 @@ -391,9 +391,9 @@
    1.31       * @param  sort if true, return list of interfaces sorted alphabetically.
    1.32       * @return List of all the required interfaces.
    1.33       */
    1.34 -    public static List getAllInterfaces(Type type,
    1.35 +    public static List<Type> getAllInterfaces(Type type,
    1.36              Configuration configuration, boolean sort) {
    1.37 -        Map results = sort ? new TreeMap() : new LinkedHashMap();
    1.38 +        Map<ClassDoc,Type> results = sort ? new TreeMap<ClassDoc,Type>() : new LinkedHashMap<ClassDoc,Type>();
    1.39          Type[] interfaceTypes = null;
    1.40          Type superType = null;
    1.41          if (type instanceof ParameterizedType) {
    1.42 @@ -423,7 +423,7 @@
    1.43              }
    1.44          }
    1.45          if (superType == null)
    1.46 -            return new ArrayList(results.values());
    1.47 +            return new ArrayList<Type>(results.values());
    1.48          //Try walking the tree.
    1.49          addAllInterfaceTypes(results,
    1.50              superType,
    1.51 @@ -431,7 +431,7 @@
    1.52                  ((ClassDoc) superType).interfaceTypes() :
    1.53                  ((ParameterizedType) superType).interfaceTypes(),
    1.54              false, configuration);
    1.55 -        List resultsList = new ArrayList(results.values());
    1.56 +        List<Type> resultsList = new ArrayList<Type>(results.values());
    1.57          if (sort) {
    1.58                  Collections.sort(resultsList, new TypeComparator());
    1.59          }
    1.60 @@ -442,7 +442,7 @@
    1.61          return getAllInterfaces(type, configuration, true);
    1.62      }
    1.63  
    1.64 -    private static void findAllInterfaceTypes(Map results, ClassDoc c, boolean raw,
    1.65 +    private static void findAllInterfaceTypes(Map<ClassDoc,Type> results, ClassDoc c, boolean raw,
    1.66              Configuration configuration) {
    1.67          Type superType = c.superclassType();
    1.68          if (superType == null)
    1.69 @@ -454,7 +454,7 @@
    1.70                  raw, configuration);
    1.71      }
    1.72  
    1.73 -    private static void findAllInterfaceTypes(Map results, ParameterizedType p,
    1.74 +    private static void findAllInterfaceTypes(Map<ClassDoc,Type> results, ParameterizedType p,
    1.75              Configuration configuration) {
    1.76          Type superType = p.superclassType();
    1.77          if (superType == null)
    1.78 @@ -466,7 +466,7 @@
    1.79                  false, configuration);
    1.80      }
    1.81  
    1.82 -    private static void addAllInterfaceTypes(Map results, Type type,
    1.83 +    private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
    1.84              Type[] interfaceTypes, boolean raw,
    1.85              Configuration configuration) {
    1.86          for (int i = 0; i < interfaceTypes.length; i++) {
    1.87 @@ -495,8 +495,8 @@
    1.88      }
    1.89  
    1.90  
    1.91 -    public static List asList(ProgramElementDoc[] members) {
    1.92 -        List list = new ArrayList();
    1.93 +    public static List<ProgramElementDoc> asList(ProgramElementDoc[] members) {
    1.94 +        List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>();
    1.95          for (int i = 0; i < members.length; i++) {
    1.96              list.add(members[i]);
    1.97          }
    1.98 @@ -639,7 +639,7 @@
    1.99       * @return an array of tokens.
   1.100       */
   1.101      public static String[] tokenize(String s, char separator, int maxTokens) {
   1.102 -        List tokens = new ArrayList();
   1.103 +        List<String> tokens = new ArrayList<String>();
   1.104          StringBuilder  token = new StringBuilder ();
   1.105          boolean prevIsEscapeChar = false;
   1.106          for (int i = 0; i < s.length(); i += Character.charCount(i)) {
   1.107 @@ -663,7 +663,7 @@
   1.108          if (token.length() > 0) {
   1.109              tokens.add(token.toString());
   1.110          }
   1.111 -        return (String[]) tokens.toArray(new String[] {});
   1.112 +        return tokens.toArray(new String[] {});
   1.113      }
   1.114  
   1.115      /**

mercurial