private static CompletableFuture<ThreeState> check(Location location, SourcePosition position, Project project) {
    Method method = DebuggerUtilsEx.getMethod(location);
    // for now skip constructors, bridges, lambdas etc.
    if (method == null ||
        method.isConstructor() ||
        method.isSynthetic() ||
        method.isBridge() ||
        method.isStaticInitializer() ||
        (method.declaringType() instanceof ClassType && ((ClassType)method.declaringType()).isEnum()) ||
        DebuggerUtilsEx.isLambda(method)) {
      return CompletableFuture.completedFuture(ThreeState.UNSURE);
    }
    return DebuggerUtilsAsync.allLineLocationsAsync(method).thenApply(locations -> {
      if (ContainerUtil.isEmpty(locations)) {
        return ThreeState.UNSURE;
      }
      if (position != null) {
        return ReadAction.compute(() -> {
          PsiFile psiFile = position.getFile();
          if (!psiFile.getLanguage().isKindOf(JavaLanguage.INSTANCE)) { // only for java for now
            return ThreeState.UNSURE;
          }
          Document document = psiFile.getViewProvider().getDocument();
          if (document == null) {
            return ThreeState.UNSURE;
          }
          boolean res = false;
          PsiElement psiMethod = DebuggerUtilsEx.getContainingMethod(position);
          if (psiMethod != null) {
            TextRange range = psiMethod.getTextRange();
            if (psiMethod instanceof PsiDocCommentOwner) {
              PsiDocComment comment = ((PsiDocCommentOwner)psiMethod).getDocComment();
              if (comment != null) {
                range = new TextRange(comment.getTextRange().getEndOffset() + 1, range.getEndOffset());
              }
            }
            int startLine = document.getLineNumber(range.getStartOffset()) + 1;
            int endLine = document.getLineNumber(range.getEndOffset()) + 1;
            res = getLinesStream(locations, psiFile).allMatch(line -> startLine <= line && line <= endLine);
            if (!res) {
              LOG.debug("Source check failed: Method " + method.name() + ", source: " + ((NavigationItem)psiMethod).getName() +
                        "\nLines: " + getLinesStream(locations, psiFile).joining(", ") +
                        "\nExpected range: " + startLine + "-" + endLine
              );
            }
          }
          else {
            LOG.debug("Source check failed: method " + method.name() + " not found in sources");
          }
          if (!res) {
            VirtualFile virtualFile = position.getFile().getVirtualFile();
            AppUIUtil.invokeOnEdt(() -> {
              if (!project.isDisposed()) {
                FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(virtualFile);
                if (editor instanceof TextEditor) {
                  HintManager.getInstance().showErrorHint(((TextEditor)editor).getEditor(),
                                                          JavaDebuggerBundle.message("warning.source.code.not.match"));
                }
                else {
                  XDebuggerManagerImpl.getNotificationGroup()
                    .createNotification(JavaDebuggerBundle.message("warning.source.code.not.match"), NotificationType.WARNING)
                    .notify(project);
                }
              }
            });
            return ThreeState.NO;
          }
          return ThreeState.YES;
        });
      }
      return ThreeState.YES;
    });
  }
private static CompletableFuture<ThreeState> check(Location location, SourcePosition position, Project project)