// We must do this in the correct order so please
// keep the linked hashset in place!
Set<MethodDef> synthetic = new LinkedHashSet<MethodDef>();
for (Iterator<MethodDef> i = methods.iterator(); i.hasNext();) {
MethodDef m = i.next();
if (m.isSynthetic()) {
synthetic.add(m);
i.remove();
}
}
//System.out.println("methods/synthetic " + clazz+ " " + methods + " " + synthetic);
for (MethodDef m : methods) {
Collection<Element> children = annotations.get(m);
if (children == null)
children = new HashSet<Element>();
access(children, m.getAccess(), m.isDeprecated());
// A final class cannot be extended, ergo,
// all methods defined in it are by definition
// final. However, marking them final (either
// on the method or inheriting it from the class)
// will create superfluous changes if we
// override a method from a super class that was not
// final. So we actually remove the final for methods
// in a final class.
if (clazz.isFinal())
children.remove(FINAL);
// for covariant types we need to add the return types
// and all the implemented and extended types. This is already
// do for us when we get the element of the return type.
getCovariantReturns(children, m.getType());
/**
* No longer includes synthetic methods in the tree
*/
// for (Iterator<MethodDef> i = synthetic.iterator(); i.hasNext();) {
// MethodDef s = i.next();
// if (s.getName().equals(m.getName()) && Arrays.equals(s.getPrototype(), m.getPrototype())) {
// i.remove();
// getCovariantReturns(children, s.getType());
// }
// }
Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()), children, add, remove,
null);
if (!members.add(member)) {
members.remove(member);
members.add(member);