in core/src/main/java/com/spotify/missinglink/ConflictChecker.java [168:206]
private List<Conflict> checkForBrokenMethodCalls(
CheckerState state, Artifact artifact, DeclaredClass clazz, DeclaredMethod method) {
List<Conflict> conflicts = new ArrayList<>();
for (CalledMethod calledMethod : method.methodCalls()) {
final ClassTypeDescriptor owningClass = calledMethod.owner();
final DeclaredClass calledClass = state.knownClasses().get(owningClass);
if (calledClass == null) {
final boolean catchesNoClassDef =
calledMethod.caughtExceptions().stream()
.anyMatch(c -> c.getClassName().equals("java.lang.NoClassDefFoundError"));
if (!catchesNoClassDef) {
conflicts.add(
conflict(
ConflictCategory.CLASS_NOT_FOUND,
"Class not found: " + owningClass,
dependency(clazz, method, calledMethod),
artifact.name(),
state.sourceMappings().get(owningClass)));
}
} else if (missingMethod(calledMethod, calledClass, state.knownClasses())) {
final boolean catchesNoSuchMethod =
calledMethod.caughtExceptions().stream()
.anyMatch(c -> c.getClassName().equals("java.lang.NoSuchMethodError"));
if (!catchesNoSuchMethod) {
conflicts.add(
conflict(
ConflictCategory.METHOD_SIGNATURE_NOT_FOUND,
"Method not found: " + calledMethod.pretty(),
dependency(clazz, method, calledMethod),
artifact.name(),
state.sourceMappings().get(owningClass)));
}
}
}
return conflicts;
}