private MethodElement internalLookUpMethod(String methodName, LibraryElement library,
boolean includeThisClass) {
HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
ClassElement currentElement = this;
if (includeThisClass) {
MethodElement element = currentElement.getMethod(methodName);
if (element != null && element.isAccessibleIn(library)) {
return element;
}
}
while (currentElement != null && visitedClasses.add(currentElement)) {
for (InterfaceType mixin : currentElement.getMixins()) {
ClassElement mixinElement = mixin.getElement();
if (mixinElement != null) {
MethodElement element = mixinElement.getMethod(methodName);
if (element != null && element.isAccessibleIn(library)) {
return element;
}
}
}
InterfaceType supertype = currentElement.getSupertype();
if (supertype == null) {
return null;
}
currentElement = supertype.getElement();
MethodElement element = currentElement.getMethod(methodName);
if (element != null && element.isAccessibleIn(library)) {
return element;
}
}
return null;
}