1 /* |
1 /* |
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 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 |
182 * |
183 * |
183 * @param input the input object used to perform the search. |
184 * @param input the input object used to perform the search. |
184 * |
185 * |
185 * @return an Output object representing the documentation that was found. |
186 * @return an Output object representing the documentation that was found. |
186 */ |
187 */ |
187 public static Output search(Input input) { |
188 public static Output search(Configuration configuration, Input input) { |
188 Output output = new Output(); |
189 Output output = new Output(); |
189 if (input.isInheritDocTag) { |
190 if (input.isInheritDocTag) { |
190 //Do nothing because "element" does not have any documentation. |
191 //Do nothing because "element" does not have any documentation. |
191 //All it has it {@inheritDoc}. |
192 //All it has it {@inheritDoc}. |
192 } else if (input.taglet == null) { |
193 } else if (input.taglet == null) { |
207 inheritedSearchInput.isInheritDocTag = false; |
208 inheritedSearchInput.isInheritDocTag = false; |
208 if (input.element instanceof MethodDoc) { |
209 if (input.element instanceof MethodDoc) { |
209 MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod(); |
210 MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod(); |
210 if (overriddenMethod != null) { |
211 if (overriddenMethod != null) { |
211 inheritedSearchInput.element = overriddenMethod; |
212 inheritedSearchInput.element = overriddenMethod; |
212 output = search(inheritedSearchInput); |
213 output = search(configuration, inheritedSearchInput); |
213 output.isValidInheritDocTag = true; |
214 output.isValidInheritDocTag = true; |
214 if (output.inlineTags.length > 0) { |
215 if (output.inlineTags.length > 0) { |
215 return output; |
216 return output; |
216 } |
217 } |
217 } |
218 } |
218 //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does |
219 //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does |
219 // not pass all implemented interfaces, we will use the |
220 // not pass all implemented interfaces, we will use the |
220 // appropriate element here. |
221 // appropriate element here. |
221 MethodDoc[] implementedMethods = |
222 MethodDoc[] implementedMethods = |
222 (new ImplementedMethods((MethodDoc) input.element, null)).build(false); |
223 (new ImplementedMethods((MethodDoc) input.element, configuration)).build(false); |
223 for (MethodDoc implementedMethod : implementedMethods) { |
224 for (MethodDoc implementedMethod : implementedMethods) { |
224 inheritedSearchInput.element = implementedMethod; |
225 inheritedSearchInput.element = implementedMethod; |
225 output = search(inheritedSearchInput); |
226 output = search(configuration, inheritedSearchInput); |
226 output.isValidInheritDocTag = true; |
227 output.isValidInheritDocTag = true; |
227 if (output.inlineTags.length > 0) { |
228 if (output.inlineTags.length > 0) { |
228 return output; |
229 return output; |
229 } |
230 } |
230 } |
231 } |
231 } else if (input.element instanceof ClassDoc) { |
232 } else if (input.element instanceof ClassDoc) { |
232 ProgramElementDoc superclass = ((ClassDoc) input.element).superclass(); |
233 ProgramElementDoc superclass = ((ClassDoc) input.element).superclass(); |
233 if (superclass != null) { |
234 if (superclass != null) { |
234 inheritedSearchInput.element = superclass; |
235 inheritedSearchInput.element = superclass; |
235 output = search(inheritedSearchInput); |
236 output = search(configuration, inheritedSearchInput); |
236 output.isValidInheritDocTag = true; |
237 output.isValidInheritDocTag = true; |
237 if (output.inlineTags.length > 0) { |
238 if (output.inlineTags.length > 0) { |
238 return output; |
239 return output; |
239 } |
240 } |
240 } |
241 } |