langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
equal
deleted
inserted
replaced
39 * |
39 * |
40 * @author Atul M Dambalkar |
40 * @author Atul M Dambalkar |
41 */ |
41 */ |
42 public class ImplementedMethods { |
42 public class ImplementedMethods { |
43 |
43 |
44 private Map interfaces = new HashMap(); |
44 private Map<MethodDoc,Type> interfaces = new HashMap<MethodDoc,Type>(); |
45 private List methlist = new ArrayList(); |
45 private List<MethodDoc> methlist = new ArrayList<MethodDoc>(); |
46 private Configuration configuration; |
46 private Configuration configuration; |
47 private final ClassDoc classdoc; |
47 private final ClassDoc classdoc; |
48 private final MethodDoc method; |
48 private final MethodDoc method; |
49 |
49 |
50 public ImplementedMethods(MethodDoc method, Configuration configuration) { |
50 public ImplementedMethods(MethodDoc method, Configuration configuration) { |
65 * |
65 * |
66 * @return MethodDoc[] Array of implemented methods. |
66 * @return MethodDoc[] Array of implemented methods. |
67 */ |
67 */ |
68 public MethodDoc[] build(boolean sort) { |
68 public MethodDoc[] build(boolean sort) { |
69 buildImplementedMethodList(sort); |
69 buildImplementedMethodList(sort); |
70 return (MethodDoc[])methlist.toArray(new MethodDoc[methlist.size()]); |
70 return methlist.toArray(new MethodDoc[methlist.size()]); |
71 } |
71 } |
72 |
72 |
73 public MethodDoc[] build() { |
73 public MethodDoc[] build() { |
74 return build(true); |
74 return build(true); |
75 } |
75 } |
76 |
76 |
77 public Type getMethodHolder(MethodDoc methodDoc) { |
77 public Type getMethodHolder(MethodDoc methodDoc) { |
78 return (Type) interfaces.get(methodDoc); |
78 return interfaces.get(methodDoc); |
79 } |
79 } |
80 |
80 |
81 /** |
81 /** |
82 * Search for the method in the array of interfaces. If found check if it is |
82 * Search for the method in the array of interfaces. If found check if it is |
83 * overridden by any other subinterface method which this class |
83 * overridden by any other subinterface method which this class |
109 */ |
109 */ |
110 private void removeOverriddenMethod(MethodDoc method) { |
110 private void removeOverriddenMethod(MethodDoc method) { |
111 ClassDoc overriddenClass = method.overriddenClass(); |
111 ClassDoc overriddenClass = method.overriddenClass(); |
112 if (overriddenClass != null) { |
112 if (overriddenClass != null) { |
113 for (int i = 0; i < methlist.size(); i++) { |
113 for (int i = 0; i < methlist.size(); i++) { |
114 ClassDoc cd = ((MethodDoc)methlist.get(i)).containingClass(); |
114 ClassDoc cd = methlist.get(i).containingClass(); |
115 if (cd == overriddenClass || overriddenClass.subclassOf(cd)) { |
115 if (cd == overriddenClass || overriddenClass.subclassOf(cd)) { |
116 methlist.remove(i); // remove overridden method |
116 methlist.remove(i); // remove overridden method |
117 return; |
117 return; |
118 } |
118 } |
119 } |
119 } |
129 * an overriding method. |
129 * an overriding method. |
130 */ |
130 */ |
131 private boolean overridingMethodFound(MethodDoc method) { |
131 private boolean overridingMethodFound(MethodDoc method) { |
132 ClassDoc containingClass = method.containingClass(); |
132 ClassDoc containingClass = method.containingClass(); |
133 for (int i = 0; i < methlist.size(); i++) { |
133 for (int i = 0; i < methlist.size(); i++) { |
134 MethodDoc listmethod = (MethodDoc)methlist.get(i); |
134 MethodDoc listmethod = methlist.get(i); |
135 if (containingClass == listmethod.containingClass()) { |
135 if (containingClass == listmethod.containingClass()) { |
136 // it's the same method. |
136 // it's the same method. |
137 return true; |
137 return true; |
138 } |
138 } |
139 ClassDoc cd = listmethod.overriddenClass(); |
139 ClassDoc cd = listmethod.overriddenClass(); |