private boolean missingMethod( CalledMethod calledMethod, DeclaredClass calledClass, Map<ClassTypeDescriptor, DeclaredClass> classMap) { final MethodDescriptor descriptor = calledMethod.descriptor(); final DeclaredMethod method = calledClass.methods().get(descriptor); if (method != null) { if (calledMethod.isStatic() != method.isStatic()) { return true; } // TODO: also validate return type return false; } // Might be defined in a super class for (ClassTypeDescriptor parentClass : calledClass.parents()) { final DeclaredClass declaredClass = classMap.get(parentClass); // ignore null parents - this means that the parent cannot be found, and this error gets // reported since the class's constructor tries to call its parent's constructor. if (declaredClass != null) { if (!missingMethod(calledMethod, declaredClass, classMap)) { return false; } } } return true; }
private Dependency dependency( DeclaredClass clazz, DeclaredMethod method, CalledMethod calledMethod) { return new MethodDependencyBuilder() .fromClass(clazz.className()) .fromMethod(method.descriptor()) .fromLineNumber(calledMethod.lineNumber()) .targetMethod(calledMethod.descriptor()) .targetClass(calledMethod.owner()) .build(); }