code: void checkType(JCTree tree, Type type, String diag) {
          if (!tree.type.isErroneous() && !types.isSameType(tree.type, type)) {
              log.error(tree, diag, type, tree.type);
          }
      }
docs: where