Ejemplo n.º 1
0
  private void handleMethodCall(ASTNode node, IMethodBinding methodBinding, List arguments) {
    if (methodBinding == null) return;

    // name check
    checks.add(
        new MethodInvocationCheck(
            file,
            jdtTypingProvider,
            bridge(node),
            OverridingRelationUtils.getIASTNodeList(arguments),
            methodBinding));
  }
Ejemplo n.º 2
0
  private void handleOverridingRelationshipViolation(
      MethodDeclaration node, IMethodBinding methodBinding, List<MethodPathItem> inhMethods) {

    // get first overridden item
    MethodPathItem superItem = OverridingRelationUtils.getFirstNonAbstractItem(inhMethods);

    if (superItem == null) return;

    // add check for method name and params
    checks.add(
        new InheritedMethodCheck(
            file,
            jdtTypingProvider,
            bridge(node),
            OverridingRelationUtils.getIASTNodeList(node.parameters()),
            methodBinding.getName(),
            superItem));

    // get all keys of method exceptions in super classes which are cast
    // compatible to exceptions of "node"
    // the list should contain at least one overridden exception key
    List exceptionList = node.thrownExceptions();
    Name curExcNode;
    for (int i = 0; i < exceptionList.size(); i++) {

      curExcNode = (Name) exceptionList.get(i);
      ITypeBinding curExcBinding = curExcNode.resolveTypeBinding();

      if (curExcBinding == null) continue;

      checks.add(
          new InheritedMethodExceptionCheck(
              file,
              jdtTypingProvider,
              bridge(curExcNode),
              curExcBinding.getName(),
              superItem.getInheritedExceptionKeys(methodBinding).get(curExcBinding.getKey())));
    }
  }