public MethodInfo findRealOverriddenMethod(String name, String signature, HashSet notStrippable) { if (mReturnType == null) { // ctor return null; } if (mOverriddenMethod != null) { return mOverriddenMethod; } ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>(); if (containingClass().realSuperclass() != null && containingClass().realSuperclass().isAbstract()) { queue.add(containingClass()); } addInterfaces(containingClass().realInterfaces(), queue); for (ClassInfo iface : queue) { for (MethodInfo me : iface.methods()) { if (me.name().equals(name) && me.signature().equals(signature) && me.inlineTags().tags() != null && me.inlineTags().tags().length > 0 && notStrippable.contains(me.containingClass())) { return me; } } } return null; }
public MethodInfo findSuperclassImplementation(HashSet notStrippable) { if (mReturnType == null) { // ctor return null; } if (mOverriddenMethod != null) { // Even if we're told outright that this was the overridden method, we want to // be conservative and ignore mismatches of parameter types -- they arise from // extending generic specializations, and we want to consider the derived-class // method to be a non-override. if (this.signature().equals(mOverriddenMethod.signature())) { return mOverriddenMethod; } } ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>(); if (containingClass().realSuperclass() != null && containingClass().realSuperclass().isAbstract()) { queue.add(containingClass()); } addInterfaces(containingClass().realInterfaces(), queue); for (ClassInfo iface : queue) { for (MethodInfo me : iface.methods()) { if (me.name().equals(this.name()) && me.signature().equals(this.signature()) && notStrippable.contains(me.containingClass())) { return me; } } } return null; }
private static void addInterfaces(ArrayList<ClassInfo> ifaces, ArrayList<ClassInfo> queue) { for (ClassInfo i : ifaces) { queue.add(i); } for (ClassInfo i : ifaces) { addInterfaces(i.interfaces(), queue); } }
private static void addRealInterfaces(ArrayList<ClassInfo> ifaces, ArrayList<ClassInfo> queue) { for (ClassInfo i : ifaces) { queue.add(i); if (i.realSuperclass() != null && i.realSuperclass().isAbstract()) { queue.add(i.superclass()); } } for (ClassInfo i : ifaces) { addInterfaces(i.realInterfaces(), queue); } }
// first looks for a superclass, and then does a breadth first search to // find the least far away match public MethodInfo findOverriddenMethod(String name, String signature) { if (mReturnType == null) { // ctor return null; } if (mOverriddenMethod != null) { return mOverriddenMethod; } ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>(); addInterfaces(containingClass().interfaces(), queue); for (ClassInfo iface : queue) { for (MethodInfo me : iface.methods()) { if (me.name().equals(name) && me.signature().equals(signature) && me.inlineTags().tags() != null && me.inlineTags().tags().length > 0) { return me; } } } return null; }