langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 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 |
41 * |
41 * |
42 * @author Atul M Dambalkar |
42 * @author Atul M Dambalkar |
43 */ |
43 */ |
44 public class ImplementedMethods { |
44 public class ImplementedMethods { |
45 |
45 |
46 private Map<MethodDoc,Type> interfaces = new HashMap<>(); |
46 private final Map<MethodDoc,Type> interfaces = new HashMap<>(); |
47 private List<MethodDoc> methlist = new ArrayList<>(); |
47 private final List<MethodDoc> methlist = new ArrayList<>(); |
48 private Configuration configuration; |
48 private final Configuration configuration; |
|
49 private final Utils utils; |
49 private final ClassDoc classdoc; |
50 private final ClassDoc classdoc; |
50 private final MethodDoc method; |
51 private final MethodDoc method; |
51 |
52 |
52 public ImplementedMethods(MethodDoc method, Configuration configuration) { |
53 public ImplementedMethods(MethodDoc method, Configuration configuration) { |
53 this.method = method; |
54 this.method = method; |
54 this.configuration = configuration; |
55 this.configuration = configuration; |
|
56 this.utils = configuration.utils; |
55 classdoc = method.containingClass(); |
57 classdoc = method.containingClass(); |
56 } |
58 } |
57 |
59 |
58 /** |
60 /** |
59 * Return the array of interface methods which the method passed in the |
61 * Return the array of interface methods which the method passed in the |
86 * implements. If it is not overidden, add it in the method list. |
88 * implements. If it is not overidden, add it in the method list. |
87 * Do this recursively for all the extended interfaces for each interface |
89 * Do this recursively for all the extended interfaces for each interface |
88 * from the array passed. |
90 * from the array passed. |
89 */ |
91 */ |
90 private void buildImplementedMethodList(boolean sort) { |
92 private void buildImplementedMethodList(boolean sort) { |
91 List<Type> intfacs = Util.getAllInterfaces(classdoc, configuration, sort); |
93 List<Type> intfacs = utils.getAllInterfaces(classdoc, configuration, sort); |
92 for (Type interfaceType : intfacs) { |
94 for (Type interfaceType : intfacs) { |
93 MethodDoc found = Util.findMethod(interfaceType.asClassDoc(), method); |
95 MethodDoc found = utils.findMethod(interfaceType.asClassDoc(), method); |
94 if (found != null) { |
96 if (found != null) { |
95 removeOverriddenMethod(found); |
97 removeOverriddenMethod(found); |
96 if (!overridingMethodFound(found)) { |
98 if (!overridingMethodFound(found)) { |
97 methlist.add(found); |
99 methlist.add(found); |
98 interfaces.put(found, interfaceType); |
100 interfaces.put(found, interfaceType); |