Beispiel #1
0
  private void checkForBrokenMethodCalls(
      CheckerState state,
      Artifact artifact,
      DeclaredClass clazz,
      DeclaredMethod method,
      ImmutableList.Builder<Conflict> builder) {
    for (CalledMethod calledMethod : method.methodCalls()) {
      final ClassTypeDescriptor owningClass = calledMethod.owner();
      final DeclaredClass calledClass = state.knownClasses().get(owningClass);

      if (calledClass == null) {
        builder.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())) {
        builder.add(
            conflict(
                ConflictCategory.METHOD_SIGNATURE_NOT_FOUND,
                "Method not found: " + calledMethod.pretty(),
                dependency(clazz, method, calledMethod),
                artifact.name(),
                state.sourceMappings().get(owningClass)));
      }
    }
  }
Beispiel #2
0
 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();
 }